void ShowMainMenu() { int selectedIndex = 0; for (; ;) { Console.SetCursorPosition(0, 0); ConsoleHelper.WriteCenter("Администратор"); menu.Clear(); menu.StartY = 2; menu.Update(mainMenu, false); selectedIndex = menu.Choice(selectedIndex); if (selectedIndex != 4) { ConsoleHelper.ClearArea(0, 0, Console.WindowWidth - 1, 0); menu.Clear(); menu.StartY = 0; } switch (selectedIndex) { case 0: ShowGroupsMenu(); break; case 1: ShowAccountsMenu(); break; case 2: ShowAccountAddMenu(); break; case 3: ShowGroupAddMenu(); break; case 4: string pass = CurrentAccount.Password; if (UIFunctions.ChangePassword(ref pass, 2 + mainMenu.Length + 1)) { CurrentAccount.Password = pass; using (BinaryWriter writer = settings.GetAccountFileWriter(CurrentAccount.Login)) CurrentAccount.Export(writer); } Console.SetCursorPosition(0, 0); break; case 5: return; } } }
void ShowMainMenu() { int selectedIndex = 0; for (; ;) { ConsoleHelper.WriteCenter($"{UIFunctions.GetFullName(CurrentAccount)} - преподаватель"); menu.Clear(); menu.StartY = 2; menu.Update(mainMenu, false); selectedIndex = menu.Choice(selectedIndex); if (selectedIndex != 1) { ConsoleHelper.ClearArea(0, 0, Console.WindowWidth - 1, 0); menu.Clear(); menu.StartY = 0; } switch (selectedIndex) { case 0: ShowGroupsMenu(); break; case 1: string pass = CurrentAccount.Password; if (UIFunctions.ChangePassword(ref pass, 6)) { CurrentAccount.Password = pass; using (BinaryWriter writer = settings.GetAccountFileWriter(CurrentAccount.Login)) CurrentAccount.Export(writer); } Console.SetCursorPosition(0, 0); break; case 2: return; } } }