/// <summary> /// Print out all menu items and highlight the current item /// </summary> private void PrintMenuItems() { ConsoleModification.AlignText(); Console.ForegroundColor = ConsoleColor.Yellow; PrintMenuHeading(); for (int i = 0; i < this._menuItems.Count; i++) { ConsoleModification.ResetColor(); ConsoleModification.SetCursorPosition(this._menuItems[i].Length); if (this._item == i) { ConsoleModification.ChangeColour(); } Console.WriteLine(this._menuItems[i]); } }
/// <summary> /// Executes the user`s choice item as raise the launch application event /// with application name as an arg. /// </summary> private void ExecuteChoice() { Console.Clear(); ConsoleModification.ShowCursor(); switch (this._item) { case 0: OnLaunchApplicationEvent(DISTANCE_CONVERTER); break; case 1: OnLaunchApplicationEvent(BMI_CALCULATOR); break; case 2: OnLaunchApplicationEvent(STUDENT_GRADES); break; case 3: ExitCommand(); break; } }
/// <summary> /// Print out the menu heading /// </summary> private void PrintMenuHeading() { ConsoleModification.SetCursorPosition(MENU_HEADING.Length); Console.WriteLine($"{MENU_HEADING} \n\r\n\r"); }