public static void Start(MainForm mainForm) { if (_guard == null) { _guard = new ReloadGuard(mainForm); } }
public MenuEngine(MainForm form, Menu rootMenu) { Form = form; Form.Execute += OnExecute; Form.ShortcutPressed += OnShortcutPressed; State = new MenuState(rootMenu); _textChangedTimer = new Timer(); _textChangedTimer.Elapsed += (s, e) => OnTextChangedTimerElapsed(); _textChangedTimer.Interval = 100; SearchBar.TextChanged += (s, e) => OnTextBoxTextChanged(); SearchBar.KeyDown += OnTextBoxKeyDown; ListBox.SelectedIndexChanged += (s, a) => OnSelectedIndexChanged(); ClearSearchBar(); }
public ReloadGuard(MainForm mainForm) { _enabled = true; _mainForm = mainForm; var watcher = new FileSystemWatcher { Path = ".", NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName }; watcher.Changed += (sender, args) => OnFileSystemChange(); watcher.Created += (sender, args) => OnFileSystemChange(); watcher.Deleted += (sender, args) => OnFileSystemChange(); watcher.Renamed += (sender, args) => OnFileSystemChange(); watcher.EnableRaisingEvents = true; }
public static void Start(MainForm mainForm, Menu rootMenu) { if (_engine == null) { _engine = new MenuEngine(mainForm, rootMenu); } _engine.State = new MenuState(rootMenu); _engine.ClearSearchBar(); }