private void PrintMenu() { Console.ResetColor(); SetConsole(); string line = new string('-', Console.WindowWidth); string lineaAyuda1 = "Esc-Salir V-Visualizacion S-Buscar " + "Enter-Abrir dia"; string helpLine1 = "Esc-Exit V-Visualization S-Search " + "Enter-Open Day"; config.WriteBack("black"); config.WriteFore("white"); config.WriteBack(0, (Console.WindowHeight - 4), line, false); if (!GetLanguage) { config.WriteBack(Console.WindowWidth / 2 - (helpLine1.Length / 2), Console.WindowHeight - 3, helpLine1, "black", true); } else { config.WriteBack(Console.WindowWidth / 2 - (helpLine1.Length / 2), Console.WindowHeight - 3, lineaAyuda1, "black", true); } /*config.WriteBack(Console.WindowWidth / 2 - * (helpLine2.Length / 2), Console.WindowHeight - 2, helpLine2, true);*/ }
private void DisplayContactsList(ContactsList Contacts, int option) { string line = new string('-', Console.WindowWidth); string helpLine1 = "1-Add 2-Modify 3-Delete 4-Search Esc-Exit"; string helpLine2 = "7-Listados"; if (listContact.Count == 0) { SetConsoleEmpty(); Console.WriteLine("Not dates"); Console.Write("Do you want add first record(yes/no): "); string answer = Console.ReadLine().ToLower(); if (answer == "yes") { Add(); } else if (answer == "no") { Console.WriteLine("Okey. See you!"); Console.WriteLine("Press Esc to return."); } } else { SetConsole(); int x = 2; int y = 1; for (int i = 0; i < listContact.Count; i++) { config.WriteFore(x, y + i, "white"); if (i == option - 1)/// { config.WriteBack("green"); config.WriteFore(listContact.Contacts[i].Name + " (" + listContact.Contacts[i].Telephone + ")", "white", false); } else { config.WriteBack(listContact.Contacts[i].Name + " (" + listContact.Contacts[i].Telephone + ")", "blue", false); } Console.ResetColor(); } config.WriteBack("blue"); config.WriteFore("white"); config.WriteBack(0, (Console.WindowHeight - 4), line, false); config.WriteBack(Console.WindowWidth / 2 - (helpLine1.Length / 2), Console.WindowHeight - 3, helpLine1, true); config.WriteBack(Console.WindowWidth / 2 - (helpLine2.Length / 2), Console.WindowHeight - 2, helpLine2, true); //Program body ShowContactCursor(Contacts, option); } }
private void SetConsole(NotesList notes) { Console.ResetColor(); Console.Clear(); Console.BackgroundColor = ConsoleColor.Blue; for (int i = 0; i < Console.WindowHeight; i++) { Console.Write(new string(' ', Console.WindowWidth)); //To draw bar vertical in middle of screen if (i <= 23) { Console.SetCursorPosition((Console.WindowWidth / 2 - 1), i); Console.Write("|" + new string(' ', Console.WindowWidth / 2)); } if (i == 2 || i == 21) { Console.SetCursorPosition(0, i); Console.Write(new string('-', (Console.WindowWidth / 2))); Console.SetCursorPosition(Console.WindowWidth / 2 + 1, i); Console.Write(new string('-', (Console.WindowWidth / 2))); } if (i == 1) { config.WriteBack((Console.WindowWidth / 2 - 20) - notes.Notes[noteActual].Title.Length / 2, i, notes.Notes[noteActual].Title, true); } if (i == 22) { string page = "Page " + noteActual + " of " + notes.NumPages; Console.SetCursorPosition(Console.WindowWidth / 2 - 25, i); Console.Write(page + new string(' ', 10)); Console.SetCursorPosition(Console.WindowWidth / 2 + 1, i); Console.Write(new string(' ', Console.WindowWidth / 2 - 1)); } } Console.SetCursorPosition(0, 0); Console.ForegroundColor = ConsoleColor.White; }
public void DisplayTaskList(TasksList Tasks, int option) { string line = new string('-', Console.WindowWidth); string lineaAyuda1 = "1-Añadir 2-Modificar 3-Borrar 4-Buscar Esc-Salir"; string helpLine1 = "1-Add 2-Modify 3-Delete 4-Search Esc-Exit"; string languageHelp; if (!GetLanguage) languageHelp = helpLine1; else languageHelp = lineaAyuda1; if (Tasks.Count == 0) { SetConsoleEmpty(); if (!GetLanguage) { Console.WriteLine("Not dates!"); Console.Write("Do you want add first record(yes/no): "); string answer = Console.ReadLine(); if (answer == "yes") Add(); else if (answer == "no") { Console.WriteLine("Okey. See you!"); Console.WriteLine("Pres ESC to return."); } } else { Console.WriteLine("No hay datos!"); Console.Write("Quieres añadir el primer registro (si/no): "); string answer = Console.ReadLine(); if (answer == "si") Add(); else if (answer == "no") { Console.WriteLine("Vale. Nos vemos!"); Console.WriteLine("Presione ESC para volver."); } } } else { SetConsole(); int x = 0; int y = 1; for (int i = 0; i < Tasks.Count; i++) { config.WriteFore(x, y + i, "white"); if (i == option - 1)/// { config.WriteBack("green"); config.WriteFore((i + 1) + "." + Tasks.Tasks[i].Description + " (" + Tasks.Tasks[i].DateDue + ")", "white", false); } else { config.WriteBack((i + 1) + "." + Tasks.Tasks[i].Description + " (" + Tasks.Tasks[i].DateDue + ")", "blue", false); } Console.ResetColor(); } config.WriteBack("blue"); config.WriteFore("white"); config.WriteBack(0, (Console.WindowHeight - 4), line, false); config.WriteBack(Console.WindowWidth / 2 - (languageHelp.Length / 2), Console.WindowHeight - 3, languageHelp, true); ShowTaskCursor(Tasks, option); } }