using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Shapes; namespace Muchinfo.MTPClient.Update { /// /// App.xaml 的交互逻辑 /// public partial class App : Application { App() { this.DispatcherUnhandledException += App_DispatcherUnhandledException; } void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { try { if (! (e.Exception.InnerException is System.Net.Sockets.SocketException)) { var tipWindow = new TipsWindow(e.Exception.Message); tipWindow.ShowDialog(); // MessageBox.Show(e.Exception.Message, "交易端更新提示"); e.Handled = true; } } catch (Exception ex) { } Environment.Exit(0); } protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (e.Args.Length > 0) { string[] str = e.Args[0].Split(','); this.ShutdownMode = ShutdownMode.OnExplicitShutdown; if (str.Length>=1) { string applictionUpdateUrl = str[0]; string memberCode = str.Length==2? str[1]:string.Empty; var updateInto = UpdateManage.RunUpdate(applictionUpdateUrl, memberCode); if (updateInto != null) { UpdateForm mWindow = new UpdateForm(applictionUpdateUrl, updateInto); this.MainWindow = mWindow; mWindow.Show(); } else { Environment.Exit(0); } } } else { Environment.Exit(0); } } } }