public void Start( ) { try { display = new POSDisplay(Properties.Settings.Default["COMPort"].ToString( )); } catch (Exception ex) { MessageBox.Show(ex.Message); } keyboard = LogitechG19.GetG19Keyboard( ); rootMenu = new Menu("Office Locator", keyboard); Menu setDisplayMenu = new Menu("Set Display", rootMenu); setDisplayMenu.AddMenuItem(new ActionMenuItem(setDisplayMenu, "Open", runCmd, activeLabelCheck)); setDisplayMenu.AddMenuItem(new ActionMenuItem(setDisplayMenu, "Phone", runCmd, activeLabelCheck)); setDisplayMenu.AddMenuItem(new ActionMenuItem(setDisplayMenu, "On Call", runCmd, activeLabelCheck)); setDisplayMenu.AddMenuItem(new ActionMenuItem(setDisplayMenu, "Closed for lunch", runCmd, activeLabelCheck)); setDisplayMenu.AddMenuItem(new ActionMenuItem(setDisplayMenu, "Gone home", runCmd, activeLabelCheck)); rootMenu.AddMenuItem(new SubMenuItem(rootMenu, "Set Display", setDisplayMenu)); keyboard.OnButtonDown += Keyboard_OnButtonDown; imgGen = new LogitechImageGenerator( ); }
private void Window_Closed(object sender, EventArgs e) { display?.ClearScreen( ); keyboard.Shutdown( ); keyboard = null; }