示例#1
0
 private void HotKeyEventHandler_ListRem(HotkeyBarItem item)
 {
     if (service.Executables.Count > 0)
     {
         service.Executables.RemoveAt(exeViewList.SelectionIndex);
     }
 }
示例#2
0
        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);
        }
示例#3
0
 private void HotKeyEventHandler_CaptureModeCancel(HotkeyBarItem item)
 {
     SwitchPage(optionsPage);
     service.SetNormalMode();
 }
示例#4
0
 private void HotKeyEventHandler_CaptureModeOK(HotkeyBarItem item)
 {
     service.AddCapturedExecutable();
     SwitchPage(optionsPage);
 }
示例#5
0
 private void HotKeyEventHandler_ListEnd(HotkeyBarItem item)
 {
     exeViewList.SelectionIndex = exeViewList.Items.Count - 1;
 }
示例#6
0
 private void HotKeyEventHandler_ListStart(HotkeyBarItem item)
 {
     exeViewList.SelectionIndex = 0;
 }
示例#7
0
 private void HotKeyEventHandler_ListDown(HotkeyBarItem item)
 {
     exeViewList.SelectionIndex += 1;
 }
示例#8
0
 private void HotKeyEventHandler_ListAdd(HotkeyBarItem item)
 {
     SwitchPage(addExePage);
     service.SetCaptureMode();
 }
示例#9
0
 private void HotKeyEventHandler_OptionsCancel(HotkeyBarItem item)
 {
     SwitchPage(mainPage);
 }
示例#10
0
 private void HotKeyEventHandler_Options(HotkeyBarItem item)
 {
     SwitchPage(optionsPage);
 }
示例#11
0
 private void HotKeyEventHandler_StateToggle(HotkeyBarItem item)
 {
     service.Active = !service.Active;
 }
示例#12
0
        //*** EVENT HANDLERS [START] *********************************************

        private void HotKeyEventHandler_Exit(HotkeyBarItem item)
        {
            app.Exit();
        }