Echarts+WPF
2021-06-09 08:05
阅读:618
YPE html>
标签:hidden dia tle chart asi generic sso requested rest
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace WpfBrowserApp1 { ////// Page1.xaml 的交互逻辑 /// public partial class Page1 : Page { public dynamic scriptObject = null; public Page1() { InitializeComponent(); if (!BrowserInteropHelper.IsBrowserHosted) { MessageBox.Show("不满足与JS调用条件"); return; } scriptObject = BrowserInteropHelper.HostScript; if (scriptObject != null) { scriptObject.SetWpfObj(new OprateBasic()); } webbrowser.Source = new Uri("html页面的路径"); webbrowser.ObjectForScripting = new OprateBasic(); // m_webFrame.Source = // new Uri( // ""); // m_webFrame.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden; // Web.Navigate(); } private void Button_Click(object sender, RoutedEventArgs e) { //O option = JsonConvert.DeserializeObject (Readjson("")); webbrowser.InvokeScript("msg",Readjson("")); //Web.InvokeScript("msg", Tb1.Text); } ////// 读取JSON文件 /// /// JSON文件中的key值 /// JSON文件中的value值 public static string Readjson(string key) { string jsonfile = "";//JSON文件路径 using (System.IO.StreamReader file = System.IO.File.OpenText(jsonfile)) { using (JsonTextReader reader = new JsonTextReader(file)) { JObject o = (JObject)JToken.ReadFrom(reader); var value = o.ToString(); return value; } } } } [System.Runtime.InteropServices.ComVisible(true)] // 将该类设置为com可访问 public class OprateBasic { public void palymusic(string msg) { //string json = File.ReadAllText("json文件路径“); //dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(json); // string output = JsonConvert.SerializeObject(msg, Newtonsoft.Json.Formatting.Indented); File.WriteAllText("data.json", msg); // MessageBox.Show("WPF弹出框:" + msg); } } }
html
1 2 3 4 5 "utf-8"> 6 "X-UA-Compatible" content="IE=edge" /> 7ECharts 8 9 10 11 12 13 14 15 16"main" style="width: 600px;height:400px;">17 "text" id="txtInput" /> 18 19 35 51 52
配置
1 "1.0" encoding="utf-8"?> 2"1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 3 "1.0.0.0" name="MyApplication.app" /> 4 "urn:schemas-microsoft-com:asm.v2"> 5 276 26"urn:schemas-microsoft-com:asm.v3"> 7 19 21 22"asInvoker" uiAccess="false" /> 20 "Custom" /> 23 class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" /> 24 25 "urn:schemas-microsoft-com:compatibility.v1"> 28 29 30 31 32 33 34 35 47
Echarts+WPF
标签:hidden dia tle chart asi generic sso requested rest
原文地址:https://www.cnblogs.com/hegezhishouzhetian/p/10659333.html
上一篇:win 10 dpi 缩放
下一篇:windows下的vimrc
评论
亲,登录后才可以留言!