private void btnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("Undo Changes", "Restore original values for this setting", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { this.pgSettings.SelectedObject = null; ConfigSandbox = ((WeedKillerConfig)this.lvwConfigSet.Items[SelectedConfiguration].Tag).CloneTyped(); this.pgSettings.SelectedObject = ConfigSandbox; EditMode = false; AdjustControls(); this.lvwConfigSet.Focus(); } }
private void lvwConfigSet_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvwConfigSet.SelectedIndices.Count == 1) { SelectedConfiguration = this.lvwConfigSet.SelectedIndices[0]; ConfigSandbox = ((WeedKillerConfig)this.lvwConfigSet.Items[SelectedConfiguration].Tag).CloneTyped(); this.pgSettings.SelectedObject = ConfigSandbox; } else { SelectedConfiguration = -1; this.pgSettings.SelectedObject = null; } AdjustControls(); }
private void BackgroundWorkerStarts() { BackgroundWorkerIsProcessing = true; OriginalText = this.btnLaunch.Text; workset = _c; this.lblWaitMessage.Refresh(); workset.TestOnly = this.chkForceTestMode.Checked ? true : workset.TestOnly; this.btnLaunch.Enabled = false; this.btnLaunch.Text = "Processing..."; this.txtResults.Text = string.Format("Start Time: {0:F}\r\n\r\n", DateTime.Now); FileEventResults.Clear(); this.dgvFileResults.Rows.Clear(); this.chkForceTestMode.Enabled = false; this.chkStopAfter.Enabled = false; this.tbarStopAfter.Enabled = false; this.cbxlEventsOfInterest.Enabled = false; this.btnAdjustColorBG.Enabled = false; this.btnAdjustColorFG.Enabled = false; this.btnClearAll.Enabled = false; this.btnInvertAll.Enabled = false; this.btnSelectAll.Enabled = false; this.cbxTemplateName.Enabled = false; this.btnSaveTemplate.Enabled = false; this.btnDropTemplate.Enabled = false; this.Refresh(); string OriginalRoot = workset.RootFolder; if (!workset.Enabled) { AppendToScrollingTextbox(ref this.txtResults, "*** WARNING: The process is set to disabled... forcing test mode to on.\r\n"); workset.TestOnly = true; } AppendToScrollingTextbox(ref this.txtResults, string.Format("\r\n-- Process: {0}\r\n", workset.Description)); worker = new WeedKiller(); ItemEventCount = 0; }
private void btnAdd_Click(object sender, EventArgs e) { NameEntry dialog = new NameEntry("Enter the name of the configuration", "New Configuration"); if (dialog.ShowDialog(this) == DialogResult.Cancel) { return; } WeedKillerConfig c = new WeedKillerConfig(); c.Description = dialog.GetName; ListViewItem i = new ListViewItem(c.Description); i.Tag = (object)"new"; i.Group = new ListViewGroup("Configuration Set"); this.lvwConfigSet.Items.Add(i); int ActiveIndex; for (ActiveIndex = 0; ActiveIndex < this.lvwConfigSet.Items.Count; ActiveIndex++) { try { if ((string)this.lvwConfigSet.Items[ActiveIndex].Tag == "new") { break; } } catch { } } this.lvwConfigSet.Items[ActiveIndex].Tag = c; this.lvwConfigSet.SelectedItems.Clear(); this.lvwConfigSet.Items[ActiveIndex].Selected = true; AdjustListViewItemColor(ActiveIndex); _Saved = false; AdjustControls(); }
public void DoWork() { WeedKillerConfig config = new WeedKillerConfig(); config.Description = "not needed in local applications"; config.Enabled = true; config.RootFolder = Environment.GetFolderPath(Environment.SpecialFolder.Cookies); // for regular expressions config.FilePattern = @"domain_.+\.cookie"; // would match the pattern domain_*.cookie config.FilePattern_Evaluation = WeedKillerConfig.ExpressionEvaluation.RegularExpression; // for legacy wildcard patterns config.FilePattern = @"domain_*.cookie"; // would match the pattern domain_*.cookie config.FilePattern_Evaluation = WeedKillerConfig.ExpressionEvaluation.Wildcards; // for regular expressions config.SubFolderPattern = ".+"; config.FilePattern_Evaluation = WeedKillerConfig.ExpressionEvaluation.RegularExpression; // for legacy wildcard patterns config.SubFolderPattern = "*.*"; config.FilePattern_Evaluation = WeedKillerConfig.ExpressionEvaluation.Wildcards; config.FileEval = WeedKillerConfig.FileDateEvaluation.Created; config.AgeMetric = 30; config.AgeMeasureUnit = WeedKillerConfig.AgeUnitOfMeasure.Days; config.ServerList = string.Empty; config.Aggressive = true; config.IgnoreZeroLength = false; config.MinimumRetentionCount = 1; config.MaximumRetentionCount = 2000; config.RecurseSubFolders = true; config.SubFoldersOnly = false; config.RemoveEmptyFolders = false; config.TestOnly = true; WeedKiller worker = new WeedKiller(); try { if (WantEvents) { worker.WeedKillerEvent += new WeedKillerEventHandler(WeedKillerEventProcessor); } worker.KillWeeds(config); } catch { // handle your exception here. } finally { try { if (WantEvents) { worker.WeedKillerEvent -= new WeedKillerEventHandler(WeedKillerEventProcessor); } } finally { } } }