private void buttonEventPeriod_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxEventPeriodCategory.Text.Trim()) || string.IsNullOrEmpty(textBoxEventPeriodName.Text.Trim()))
            {
                MessageBox.Show(this, "A required field is empty", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            _watcher.EventPeriod(textBoxEventPeriodCategory.Text.Trim(), textBoxEventPeriodName.Text.Trim(), (int)numericUpDownEventPeriodDuration.Value, checkBoxEventPeriodCompleted.Checked);
            MessageBox.Show(this, "Tracked: Event Period", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#2
0
        /// <summary>
        /// Begins scanning the registry
        /// </summary>
        private void ScanRegistry()
        {
            // Clear old results
            this.treeModel.Nodes.Clear();

            // Get number of sections to scan
            int nSectionCount = 0;

            foreach (TreeNode tn in this.treeView1.TopNode.Nodes)
            {
                if (tn.Checked)
                {
                    nSectionCount++;
                }
            }

            if (nSectionCount == 0)
            {
                MessageBox.Show(this, Properties.Resources.mainSelectSections, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Read start time of scan
            DateTime dtStart = DateTime.Now;

            // Create new logger instance + write header
            Main._logger = new Logger(Path.GetTempFileName());

            // Open Scan dialog
            ScanDlg      frmScanBox = new ScanDlg(nSectionCount);
            DialogResult dlgResult  = frmScanBox.ShowDialog(this);

            // See if there are any bad registry keys
            if (ScanDlg.arrBadRegistryKeys.Count > 0)
            {
                // Load bad registry keys
                foreach (BadRegistryKey p in ScanDlg.arrBadRegistryKeys)
                {
                    this.treeModel.Nodes.Add(p);
                }

                // Expand all and Resize columns
                this.treeViewAdvResults.ExpandAll();
                this.treeViewAdvResults.AutoSizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

                // Show notify box and set status text
                ResourceManager rm = new ResourceManager(this.GetType());
                if (dlgResult == DialogResult.OK)
                {
                    this.notifyIcon1.ShowBalloonTip(6000, Application.ProductName, Properties.Resources.mainScanningFinished, ToolTipIcon.Info);
                    this.toolStripStatusLabel1.Text = Properties.Resources.mainScanningFinished;
                    this.toolStripStatusLabel1.Tag  = "mainScanningFinished";
                }
                else
                {
                    this.notifyIcon1.ShowBalloonTip(6000, Application.ProductName, Properties.Resources.mainScanningAborted, ToolTipIcon.Info);
                    this.toolStripStatusLabel1.Text = Properties.Resources.mainScanningAborted;
                    this.toolStripStatusLabel1.Tag  = "mainScanningAborted";
                }

                // Copy to directory and display log file
                Main.Logger.DisplayLogFile((Properties.Settings.Default.bOptionsAutoRepair && dlgResult == DialogResult.OK));

                // Enable menu items
                this.fixToolStripMenuItem.Enabled = true;
                this.toolStripButtonFix.Enabled   = true;

                // Send usage data to Little Software Stats
                Watcher.EventPeriod("Functions", "Scan Registry", (int)DateTime.Now.Subtract(dtStart).TotalSeconds, (dlgResult == DialogResult.OK));

                // If power user option selected, Automatically fix problems
                if (Properties.Settings.Default.bOptionsAutoRepair && dlgResult == DialogResult.OK)
                {
                    this.FixProblems();
                }
            }
        }