| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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
- {
- /// <summary>
- /// App.xaml 的交互逻辑
- /// </summary>
- 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);
- }
- }
-
- }
- }
|