private void buttonAnalyze_Click(object sender, RoutedEventArgs e) { if ( MessageBox.Show(Application.Current.MainWindow, "You must close running programs before optimizing the registry.\nPlease save your work and close any running programs now.", Utils.ProductName, MessageBoxButton.OKCancel, MessageBoxImage.Information) != MessageBoxResult.OK) { return; } Wizard.IsBusy = true; var secureDesktop = new SecureDesktop(); secureDesktop.Show(); var analyzeWnd = new Analyze(); analyzeWnd.ShowDialog(); secureDesktop.Close(); Wizard.IsBusy = false; // Check registry size before continuing if (HiveManager.GetNewRegistrySize() <= 0 || IsCompacted) { MessageBox.Show(Application.Current.MainWindow, "It appears that the registry has already been compacted.", Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Error); return; } _scanBase.MoveNext(); }
private void buttonCompact_Click(object sender, RoutedEventArgs e) { if ( MessageBox.Show(Application.Current.MainWindow, "Are you sure you want to compact your registry?", Utils.ProductName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } Wizard.IsBusy = true; var secureDesktop = new SecureDesktop(); secureDesktop.Show(); var compactWnd = new Compact(); compactWnd.ShowDialog(); secureDesktop.Close(); Wizard.IsBusy = false; if ( MessageBox.Show(Application.Current.MainWindow, "You must restart your computer before the new setting will take effect. Do you want to restart your computer now?", Utils.ProductName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { // Restart computer Misc.PInvoke.ExitWindowsEx(Misc.PInvoke.ShutdownFlags.Reboot, Misc.PInvoke.ShutdownReasons.MajorOperatingsystem | Misc.PInvoke.ShutdownReasons.MinorReconfig | Misc.PInvoke.ShutdownReasons.FlagsPlanned); } _scanBase.MoveFirst(); }
private void buttonCompact_Click(object sender, RoutedEventArgs e) { if ( MessageBox.Show(Application.Current.MainWindow, "Are you sure you want to compact your registry?", Utils.ProductName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } Wizard.IsBusy = true; var secureDesktop = new SecureDesktop(); secureDesktop.Show(); var compactWnd = new Compact(); compactWnd.ShowDialog(); secureDesktop.Close(); // Set errors fixed to number of registry hives Settings.Default.lastScanErrorsFixed = Wizard.RegistryHives.Count; Settings.Default.totalErrorsFixed += Settings.Default.lastScanErrorsFixed; Wizard.IsBusy = false; if ( MessageBox.Show(Application.Current.MainWindow, "You must restart your computer before the new setting will take effect. Do you want to restart your computer now?", Utils.ProductName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { // Restart computer PInvoke.ExitWindowsEx(0x02, PInvoke.MajorOperatingSystem | PInvoke.MinorReconfig | PInvoke.FlagPlanned); } _scanBase.MoveFirst(); }