From 69dbf7b5848a7e657b2911a9662e6dbd4f8f516b Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期四, 03 七月 2025 17:48:38 +0800 Subject: [PATCH] 可视化 --- 2025年6月12日/AuxAllWCS/Build/Project/界面/View1.xaml.cs | 44 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 39 insertions(+), 5 deletions(-) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" index d874b53..3421993 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\347\225\214\351\235\242/View1.xaml.cs" @@ -28,6 +28,7 @@ using GZ.DB.Repository.OIDATABASE; using GZ.DB.IRepository.OIDATABASE; using GZ.DB.Entity.OIDATABASE; + namespace GZ.Projects.AuxAllWCS { /// <summary> @@ -38,18 +39,51 @@ public View1() { InitializeComponent(); - #region 闄愬埗杩愯瀹炰緥鏁伴噺 + #region 闄愬埗杩愯瀹炰緥鏁伴噺 System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("AuxAllWCS"); if (processes.Length > System.Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["InstanceLimit"])) { System.Windows.MessageBox.Show("杩愯澶辫触:杩愯瀹炰緥鏁伴噺宸茶秴鍑洪檺鍒�); this.Close(); } - #endregion - this.DataContext = ViewModel.CreateInstance(this,typeof(View1)); + #endregion + this.DataContext = ViewModel.CreateInstance(this, typeof(View1)); this.Loaded += (this.DataContext as ViewModel).View1_LoadEvent; - this.Closing += (this.DataContext as ViewModel).View1_CloseEvent; + this.Closing += (this.DataContext as ViewModel).View1_CloseEvent; + commmd(); + } + + public async void commmd() + { + await webView.EnsureCoreWebView2Async(); + + labbb: + if (!string.IsNullOrEmpty(HttpServer._listenerPrefix)) + if (webView.Source != new Uri(HttpServer._listenerPrefix)) + { + webView.CoreWebView2.Navigate(HttpServer._listenerPrefix + "/index.html"); + goto EndInit; + } + System.Threading.Thread.Sleep(2000); + goto labbb; + EndInit: + Console.WriteLine("end Set Uri"); + webView.PreviewKeyDown += (object sender, KeyEventArgs e) => + { + // 妫�煡鎸変笅鐨勯敭鏄惁鏄�F12锛屽鏋滄槸锛岀姝㈠叾榛樿琛屼负 + if (e.Key == Key.F12) + { + e.Handled = true; + } + }; + await webView.CoreWebView2.ExecuteScriptAsync( + @" + document.addEventListener('contextmenu', function(event) { + event.preventDefault(); + }, false); + " + ); } } } - + -- Gitblit v1.9.1