private void button4_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { var rep = Setting.Orders[listView1.SelectedItems[0].Index]; Setting.Orders[listView1.SelectedItems[0].Index].Enabled = !rep.Enabled; if (rep.Option.RealtimeWatch) { if (rep.Enabled) { Watcher.Start(rep.WatcherIndex); } else { Watcher.Stop(rep.WatcherIndex); } } RefrashOrderList(); } }
public CreateOrder(ManagedDirectory d, int index) { InitializeComponent(); folderBrowserDialog1.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); this.index = index; if (d.WatcherIndex > 0) { Watcher.Stop(d.WatcherIndex); Watcher.Remove(d.WatcherIndex); } TextBoxdeparture.Text = d.DepartureFolder; TextBoxDestination.Text = d.DestinationFolder; var sb = new StringBuilder(); if (d.Option.FileExtensions.Count > 0) { CheckBoxFileExtensions.Checked = true; TextBoxFileExtensions.Enabled = true; for (int i = 0; i < d.Option.FileExtensions.Count; i++) { sb.Append(d.Option.FileExtensions[i]); if (d.Option.FileExtensions.Count - 1 != i) { sb.Append(' '); } } TextBoxFileExtensions.Text = sb.ToString(); if (sb.Length > 0) { sb.Remove(0, sb.Length); } } if (d.Option.IncludeStrings.Count > 0) { CheckBoxIncludes.Checked = true; TextBoxInclude.Enabled = true; for (int i = 0; i < d.Option.IncludeStrings.Count; i++) { sb.Append(d.Option.IncludeStrings[i]); if (d.Option.IncludeStrings.Count - 1 != i) { sb.Append(' '); } } TextBoxInclude.Text = sb.ToString(); if (sb.Length > 0) { sb.Remove(0, sb.Length); } } if (d.Option.DecludeStrings.Count > 0) { CheckBoxDecludeStrings.Checked = true; TextBoxDecludeStrings.Enabled = true; for (int i = 0; i < d.Option.DecludeStrings.Count; i++) { sb.Append(d.Option.DecludeStrings[i]); if (d.Option.DecludeStrings.Count - 1 != i) { sb.Append(' '); } } TextBoxInclude.Text = sb.ToString(); if (sb.Length > 0) { sb.Remove(0, sb.Length); } } if (d.Option.OptionStrings.Count > 0) { CheckBoxOptions.Checked = true; TextBoxOptionStrings.Enabled = true; for (int i = 0; i < d.Option.OptionStrings.Count; i++) { sb.Append(d.Option.OptionStrings[i]); if (d.Option.OptionStrings.Count - 1 != i) { sb.Append(' '); } } TextBoxOptionStrings.Text = sb.ToString(); } RadioIsCopy.Checked = d.Option.isCopy; RadioIsMove.Checked = !d.Option.isCopy; if (d.Option.Duplicate == DuplicateProcessing.Overwrite) { dubCombobox.Text = Properties.Resources.OverwriteString; } else if (d.Option.Duplicate == DuplicateProcessing.Renaming) { dubCombobox.Text = Properties.Resources.RenamingString; } else if (d.Option.Duplicate == DuplicateProcessing.None) { dubCombobox.Text = Properties.Resources.NoneString; } RootSearch.Checked = d.Option.RootSerach; RealTimeWatchService.Checked = d.Option.RealtimeWatch; }