Esempio n. 1
0
 private void ClassLibraryException(object sender, RoutedEventArgs e)
 {
     try
     {
         CrashUtils.BackgroundExceptionTask().RunSynchronously();
     }
     catch (Exception ex) when(HandleExceptions.IsOn)
     {
         Crashes.TrackError(ex);
     }
 }
 public void ClassLibException(object sender, EventArgs e)
 {
     try
     {
         CrashUtils.BackgroundExceptionTask().RunSynchronously();
     }
     catch (Exception ex) when(HandleExceptionsSwitchCell.On)
     {
         TrackException(ex);
     }
 }
Esempio n. 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            string[] commandLineArguments = e.Args;

            if (commandLineArguments.Length == 0)
            {
                CreateShortcut();
                RunUpdate();
            }

            switch (commandLineArguments[0])
            {
            case "disable_shortcut":
                RunUpdate();
                break;

            case "process_update":
                break;

            case "delete_temp":
                if (commandLineArguments.Length != 2)
                {
                    InvalidArguments();
                    return;
                }

                try
                {
                    IOUtils.TryDeleteFile(commandLineArguments[1], 20, 500);
                }
                catch (Exception ex)
                {
                    CrashUtils.HandleException(ex);
                }

                Process.Start(GetCreatorPath());

                Shutdown(0);
                return;

            default:
                InvalidArguments();
                return;
            }

            base.OnStartup(e);

            new UpdaterWindow().Show();
        }
Esempio n. 4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            DispatcherUnhandledException += (_, args) =>
            {
                MessageBoxUtils.ShowError($"Unhandled exception: `{args.Exception}`");
            };

            Task.Run(() =>
            {
                try
                {
                    int[] appVersion    = UpdateUtils.ConvertVersion(Assembly.GetExecutingAssembly().GetName().Version.ToString(4));
                    int[] latestVersion = UpdateUtils.ConvertVersion(UpdateUtils.GetLatestVersion());

                    for (int i = 0; i < 4; i++)
                    {
                        if (appVersion[i] > latestVersion[i])
                        {
                            break;
                        }
                        if (appVersion[i] == latestVersion[i])
                        {
                            continue;
                        }

                        Process.Start(
                            Path.Combine(ApplicationDataUtils.PathToRootFolder, "updater.exe"),
                            "disable_shortcut"
                            );
                        Environment.Exit(0);
                    }
                }
                catch (Exception ex)
                {
                    CrashUtils.HandleException(ex);
                }
            });

            SetCurrentLanguage();
            new PackStartupWindow().Show();
        }
 private void ClassLibraryException_Click(object sender, RoutedEventArgs e)
 {
     CrashUtils.BackgroundExceptionTask().RunSynchronously();
 }