淘宝拍单优化
This commit is contained in:
1 parent
ea14ad3af4
commit
e7d22984df
12 files changed
+2233
-46
No files matched your search
@@ -49,9 +49,32 @@ public partial class TaobaoBuyOrderCtrl : UserControl
|
||||
{
|
||||
this.tcBuyAddress.Title = "拍单地址:";
|
||||
}
|
||||
Window parentWindow = Window.GetWindow(this);
|
||||
if (this.IsLoaded && parentWindow != null)
|
||||
{
|
||||
parentWindow.Closed += ParentWindow_Closed;
|
||||
}
|
||||
|
||||
await ViewModel.Start();
|
||||
}
|
||||
|
||||
private void ParentWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
// 1. 解除 JS 绑定
|
||||
this.ViewModel?.CefWebBrowser?.JavascriptObjectRepository?.UnRegisterAll();
|
||||
//this.ViewModel.CefWebBrowser?.CloseDevTools();
|
||||
|
||||
// 2. 优雅关闭浏览器
|
||||
this.ViewModel?.CefWebBrowser?.GetBrowser()?.CloseBrowser(false);
|
||||
|
||||
// 3. 清理残留子进程(按路径判断,避免误杀)
|
||||
//CleanupBrowserSubprocesses();
|
||||
|
||||
// 4. 释放控件
|
||||
this.ViewModel?.CefWebBrowser?.Dispose();
|
||||
//this.ViewModel.CefWebBrowser = null;
|
||||
}
|
||||
|
||||
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
|
||||
{
|
||||
Grid.SetRow(browser, 0);
|
||||
|
||||
Reference in new issue
Block a user