private void UnPatchBtn_Click(object sender, RoutedEventArgs e) { PatchBtn.IsEnabled = UnPatchBtn.IsEnabled = false; try { List <InstallationPaths> installPaths = new List <InstallationPaths>(); foreach (CustomCheckBox installBox in InstallationList.Items) { installPaths.Add(new InstallationPaths(installBox.Content.ToString(), installBox.ToolTip.ToString().Split(new string[] { " & " }, StringSplitOptions.None)[1])); // chromeExePath is always in the ToolTip after " & " } PatcherInstaller installer = new PatcherInstaller(installPaths); if (installer.UninstallAll(Log)) { foreach (CustomCheckBox installBox in InstallationList.Items) { if (installBox.IsChecked == true) { installBox.Foreground = installBox.BorderBrush = new SolidColorBrush(Color.FromRgb(72, 207, 133)); } } } } catch (Exception ex) { Log("Error while uninstalling:" + ex.Message); } PatchBtn.IsEnabled = UnPatchBtn.IsEnabled = true; }
private void OnUninstall(object sender, RoutedEventArgs e) { this.DisableButtons(true); new Thread((() => { try { List <InstallationPaths> installPaths = this.GetEnabledInstallationPaths(); PatcherInstaller installer = new PatcherInstaller(installPaths); if (installer.UninstallAll(this.Log)) { foreach (InstallationPaths paths in installPaths) { this.Log($"Successfully uninstalled from {paths.ChromeExePath}", Brushes.Green); } } } catch (Exception exception) { this.Log("Error while uninstalling: " + exception.Message, Brushes.Red); } this.DisableButtons(false); })).Start(); }