示例#1
0
        /// <summary>
        /// Handles click event of Compact button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void buttonCompact_Click(object sender, RoutedEventArgs e)
        {
            if (
                MessageBox.Show(Application.Current.MainWindow, Properties.Resources.RegistryCompactQuestion,
                                Properties.Resources.RegistryCompactor, MessageBoxButton.YesNo, MessageBoxImage.Question) ==
                MessageBoxResult.No)
                return;

            SecureDesktop secureDesktop = new SecureDesktop();
            secureDesktop.Show();

            CompactingProgress compactingProgress = new CompactingProgress();
            compactingProgress.ShowDialog();

            secureDesktop.Close();

            if (
                MessageBox.Show(Application.Current.MainWindow, Properties.Resources.RestartComputerQuestion,
                                Properties.Resources.RegistryCompactor, MessageBoxButton.YesNo, MessageBoxImage.Question) ==
                MessageBoxResult.Yes)
                // Restart computer
                PInvoke.ExitWindowsEx(0x02, PInvoke.MajorOperatingSystem | PInvoke.MinorReconfig | PInvoke.FlagPlanned);

            Close();
        }
示例#2
0
        /// <summary>
        /// handle Click event to started optimizing the registry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Start_Click(object sender, RoutedEventArgs e)
        {
            if (
                MessageBox.Show(Application.Current.MainWindow, Properties.Resources.CloseProgramsBeforeOptimizing,
                                Properties.Resources.RegistryCompactor, MessageBoxButton.OKCancel, MessageBoxImage.Information) !=
                MessageBoxResult.OK)
                return;

            SecureDesktop secureDesktop = new SecureDesktop();
            secureDesktop.Show();

            AnalyzingProgress progressWindow = new AnalyzingProgress();
            progressWindow.ShowDialog();

            secureDesktop.Close();

            // Check registry size before continuing
            if (Utilites.GetNewRegistrySize() <= 0 || IsCompacted)
            {
                MessageBox.Show(Application.Current.MainWindow, Properties.Resources.RegistryAlreadyCompacted,
                                Properties.Resources.RegistryCompactor, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            // Showing Analyzed Result
            Init();
            gridAnalyzingResults.Visibility = Visibility.Visible;
            gridMainView.Visibility = Visibility.Collapsed;
        }