Skip to content

Commit

Permalink
try to fix not-stopping background processes
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Mar 26, 2024
1 parent 960b46b commit 9fe36aa
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public MainWindow()
}
else
{
Close();
closeExe();
return;
}
}
Expand Down Expand Up @@ -270,7 +270,7 @@ void WebView_KeyDown(object sender, KeyEventArgs e)

if (e.KeyboardDevice.IsKeyDown(Key.Escape))
{
Close();
closeExe();
}

/* bool ctrl = e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) || e.KeyboardDevice.IsKeyDown(Key.RightCtrl);
Expand All @@ -284,7 +284,7 @@ void WebView_KeyDown(object sender, KeyEventArgs e)
}
else if (e.Key == Key.W && ctrl && !alt && !shift)
{
Close();
closeExe();
e.Handled = true;
}
*/
Expand Down Expand Up @@ -427,7 +427,7 @@ void WebView_CoreWebView2InitializationCompleted(object sender, CoreWebView2Init
if (e.InitializationException.HResult == -2147024593)
{
MessageBox.Show($"Failed to create webview, because the profile's name has been marked as deleted, please use a different profile's name.");
Close();
closeExe();
return;
}
MessageBox.Show($"WebView2 creation failed with exception = {e.InitializationException}");
Expand Down Expand Up @@ -529,7 +529,7 @@ private void CloseWebViewForUpdate()
private void sourceChanged(object sender, CoreWebView2SourceChangedEventArgs e)
{

if (webView.Source.AbsoluteUri.Contains("webdemoexe_exit")) Close();
if (webView.Source.AbsoluteUri.Contains("webdemoexe_exit")) closeExe();
}


Expand Down Expand Up @@ -567,6 +567,13 @@ void WebView_PermissionRequested(object sender, CoreWebView2PermissionRequestedE
}
// </OnPermissionRequested>



void closeExe()
{
webView.Source = new Uri("about:blank");
webView.Dispose();
Close();
System.Environment.Exit(1);
}
}
}

0 comments on commit 9fe36aa

Please sign in to comment.