From 1cf00bcc4e6869b356dd15310648bb93c9b1bbde Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期三, 23 七月 2025 09:10:15 +0800 Subject: [PATCH] init_内存泄漏测试- 增加全部释放 --- 2025年6月12日/AuxAllWCS/Build/Project/界面/View1.xaml.cs | 43 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 38 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 0b220b8..3940a94 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" @@ -39,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