void _file_system_watcher_Created(object sender, FileSystemEventArgs e) { try { if ((DateTime.Now - _last_user_action) <= _accept_user_action) { if (IsValidSubdirectory(e.Name)) { lock (_locker) { UpdateWorkingDir(false); if (_is_monitoring) { UserAction action = new FileCreatedAction(e.FullPath, _working_path); _actions.AddAction(action); NotifyOtherAgents(); } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public WizardFilePicker(UserAction action, List <string> items, Dictionary <string, bool> active) { InitializeComponent(); switch (action.ActionType) { case UserAction.UserActionType.FileCreatedAction: { FileCreatedAction faction = (FileCreatedAction)action; TextLabel1.Text = "Which items should be created in folder \"" + faction.Folder + "\"?"; } break; case UserAction.UserActionType.FileDeletedAction: { FileDeletedAction faction = (FileDeletedAction)action; TextLabel1.Text = "Which items should be deleted in folder \"" + faction.Folder + "\"?"; } break; case UserAction.UserActionType.FileMovedAction: { FileMovedAction faction = (FileMovedAction)action; TextLabel1.Text = "Which items should be moved from \"" + faction.Folder + "\" to \"" + Path.GetDirectoryName(faction.FileName) + "\"?"; } break; case UserAction.UserActionType.FileRenamedAction: { FileRenamedAction faction = (FileRenamedAction)action; TextLabel1.Text = "Which items should be renamed in folder \"" + faction.Folder + "\"?"; } break; } _items = items; _active = active; foreach (string item in _items) { ItemsListBox.Items.Add(item, _active[item]); } ItemsListBox.ItemCheck += new ItemCheckEventHandler(ItemsListBox_ItemCheck); }