private void CheckInstallation() { bool CanInst = true, CanUnins = false; CanInst = LagfreeServicesInstall.CheckInstallSource(); CanUnins = Directory.Exists(App.TargetDir); if (CanInst && CanUnins) { InstallButton.Content = "更新"; PerformUpdate = true; } else { InstallButton.Content = "安装"; PerformUpdate = false; } InstallButton.IsEnabled = CanInst; UninstallButton.IsEnabled = CanUnins; }
private void UninstallButton_Click(object sender, RoutedEventArgs e) { DisableUI(); new Task(() => { try { if (LagfreeServicesInstall.PerformUninstall()) { Dispatcher.InvokeAsync(SuccessMsg); } else { Dispatcher.InvokeAsync(FailedMsg); } } finally { Dispatcher.InvokeAsync(EnableUI); } }).Start(); }