1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.IO;
- using System.Windows;
- using InABox.Core;
- using Microsoft.Web.WebView2.Core;
- namespace PRSDesktop;
- public partial class DownloadSupportAppWindow : Window
- {
- public DownloadSupportAppWindow()
- {
- InitializeComponent();
- }
- private void Download_Click(object sender, RoutedEventArgs e)
- {
- Browser.Source = new Uri(URL.Text);
- }
- private void Browser_OnNavigationStarting(object? sender, CoreWebView2NavigationStartingEventArgs e)
- {
- Browser.CoreWebView2.DownloadStarting += (o, args) =>
- {
- args.ResultFilePath = System.IO.Path.Combine(CoreUtils.GetPath(), "helpwire.exe");
- args.DownloadOperation.StateChanged += (o, e) =>
- {
- if (args.DownloadOperation.State == CoreWebView2DownloadState.Interrupted)
- {
- if (File.Exists(args.ResultFilePath))
- File.Delete(args.ResultFilePath);
- }
- if (args.DownloadOperation.State == CoreWebView2DownloadState.Completed)
- Close();
- };
- };
- }
- }
|