private void HotKeyEventHandler_ListRem(HotkeyBarItem item) { if (service.Executables.Count > 0) { service.Executables.RemoveAt(exeViewList.SelectionIndex); } }
private void InitPages() { //** MAIN PAGE *********************************** HotkeyBarItem startStopKey = new HotkeyBarItem(ConsoleKey.F4, "Start / Stop", HotKeyEventHandler_StateToggle); HotkeyBarItem optinsKey = new HotkeyBarItem(ConsoleKey.F6, "Options", HotKeyEventHandler_Options); HotkeyBarItem exitKey = new HotkeyBarItem(ConsoleKey.F10, "Exit", HotKeyEventHandler_Exit, 3); HotkeyBar mainBar = new HotkeyBar(4); mainBar.Items.Add(startStopKey); mainBar.Items.Add(optinsKey); mainBar.Items.Add(exitKey); mainPage = new ConsolePage <Service>(MainPagePrintHandler, service, mainBar); //** OPTIONS PAGE ******************************** HotkeyBarItem escKey1 = new HotkeyBarItem(ConsoleKey.Escape, "ESC", "Back", HotKeyEventHandler_OptionsCancel); HotkeyBarItem addKey = new HotkeyBarItem(ConsoleKey.Insert, "INS", "Add", HotKeyEventHandler_ListAdd); HotkeyBarItem removeKey = new HotkeyBarItem(ConsoleKey.Delete, "DEL", "Remove", HotKeyEventHandler_ListRem); HotkeyBarItem upKey = new HotkeyBarItem(ConsoleKey.UpArrow, " ↑", "", HotKeyEventHandler_ListUp); HotkeyBarItem downKey = new HotkeyBarItem(ConsoleKey.DownArrow, " ↓", "", HotKeyEventHandler_ListDown); HotkeyBarItem homeKey = new HotkeyBarItem(ConsoleKey.Home, "HOME", "", HotKeyEventHandler_ListStart); homeKey.Visible = false; HotkeyBarItem endKey = new HotkeyBarItem(ConsoleKey.End, "END", "", HotKeyEventHandler_ListEnd); endKey.Visible = false; HotkeyBar optionsBar = new HotkeyBar(4); optionsBar.Items.Add(escKey1); optionsBar.Items.Add(addKey); optionsBar.Items.Add(removeKey); optionsBar.Items.Add(exitKey); optionsBar.Items.Add(upKey); optionsBar.Items.Add(downKey); optionsBar.Items.Add(homeKey); optionsBar.Items.Add(endKey); optionsPage = new ConsolePage <Service>(OptionsPagePrintHandler, service, optionsBar); //** ADD EXECUTABLE PAGE ************************* HotkeyBarItem escKey2 = new HotkeyBarItem(ConsoleKey.Escape, "ESC", "Cancel", HotKeyEventHandler_CaptureModeCancel); HotkeyBarItem okKey = new HotkeyBarItem(ConsoleKey.Enter, " ENTER", "Add Executable", HotKeyEventHandler_CaptureModeOK); HotkeyBar addExeBar = new HotkeyBar(4); addExeBar.Items.Add(escKey2); addExeBar.Items.Add(okKey); addExeBar.Items.Add(exitKey); addExePage = new ConsolePage <Service>(AddExePagePrintHandler, service, addExeBar); }
private void HotKeyEventHandler_CaptureModeCancel(HotkeyBarItem item) { SwitchPage(optionsPage); service.SetNormalMode(); }
private void HotKeyEventHandler_CaptureModeOK(HotkeyBarItem item) { service.AddCapturedExecutable(); SwitchPage(optionsPage); }
private void HotKeyEventHandler_ListEnd(HotkeyBarItem item) { exeViewList.SelectionIndex = exeViewList.Items.Count - 1; }
private void HotKeyEventHandler_ListStart(HotkeyBarItem item) { exeViewList.SelectionIndex = 0; }
private void HotKeyEventHandler_ListDown(HotkeyBarItem item) { exeViewList.SelectionIndex += 1; }
private void HotKeyEventHandler_ListAdd(HotkeyBarItem item) { SwitchPage(addExePage); service.SetCaptureMode(); }
private void HotKeyEventHandler_OptionsCancel(HotkeyBarItem item) { SwitchPage(mainPage); }
private void HotKeyEventHandler_Options(HotkeyBarItem item) { SwitchPage(optionsPage); }
private void HotKeyEventHandler_StateToggle(HotkeyBarItem item) { service.Active = !service.Active; }
//*** EVENT HANDLERS [START] ********************************************* private void HotKeyEventHandler_Exit(HotkeyBarItem item) { app.Exit(); }