private static void SumItem_onKeyPress( Menu sender, onKeyPressArgs args ) { //First we check if the selected index is one we want to handle. if( sender.SelectedIndex != 2 && sender.SelectedIndex != 3 ) return; //Next we get the current menu item. SumItem cur = (SumItem)args.MenuItem; //Now we check if the input key is one we want to handle. if( args.Key.Key != ConsoleKey.LeftArrow && args.Key.Key != ConsoleKey.RightArrow ) return; //Now we handle the input. if( args.Key.Key == ConsoleKey.LeftArrow ) cur.Value--; if( args.Key.Key == ConsoleKey.RightArrow ) cur.Value++; Sum.Value = First.Value + Second.Value; }
private static void MainMenu_Sum_Click( Menu sender, onKeyPressArgs args ) { if( args.Key.Key == ConsoleKey.Enter ) { //Because the window may be resized when showing the next menu, //the main menu should force a resize on the next cycle. sender.ForceReset = true; m_sumMenu.Show(); } }