public void Start() { Console.Title = "BlueMoon - Contacts Application"; Console.Clear(); AsciiClass ac = new AsciiClass(); ac.BlueMoon(3); int left = 37; int top = 14; Console.SetCursorPosition(left, top); Console.WriteLine("PERSONAL ASSISTANT APPLICATION"); top++; Console.SetCursorPosition(37, top); Console.WriteLine("Contact Details Page."); top += 3; int topA = top; Console.SetCursorPosition(39, top); String textA = "(A). Add contacts"; Console.WriteLine(textA); top += 2; int topE = top; Console.SetCursorPosition(39, top); string textE = "(E). Edit Contacts"; Console.WriteLine(textE); top += 2; int topV = top; Console.SetCursorPosition(39, top); string textV = "(V). View Contacts "; Console.WriteLine(textV); top += 2; int topS = top; Console.SetCursorPosition(39, top); string textS = "(S). Search Contacts "; Console.WriteLine(textS); top += 2; int topD = top; Console.SetCursorPosition(39, top); string textD = "(D). Delete Contacts "; Console.WriteLine(textD); top += 2; int topR = top; Console.SetCursorPosition(39, top); string textR = "(R). Return to Main Page "; Console.WriteLine(textR); Station.StartTimeThread(); Console.CursorVisible = false; ConsoleKeyInfo key; key = Console.ReadKey(true); if (key.Key == ConsoleKey.A) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topA, textA); AddContacts ad = new AddContacts(); ad.Start(); } else if (key.Key == ConsoleKey.E) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topE, textE); EditContacts ec = new EditContacts(); ec.Start(); } else if (key.Key == ConsoleKey.V) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topV, textV); ViewContacts vc = new ViewContacts(); vc.Start(); } else if (key.Key == ConsoleKey.S) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topS, textS); SearchContacts sc = new SearchContacts(); sc.Start(); } else if (key.Key == ConsoleKey.D) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topD, textD); DeleteContacts dc = new DeleteContacts(); dc.Start(); } else if (key.Key == ConsoleKey.R) { Station.StopTimeThread(); Station.BeepClick(); Station.Highlight(39, topR, textR); PersonalAssistant pa = new PersonalAssistant(); pa.Start(); } else { Station.StopTimeThread(); top += 4; Station.BeepError(); Console.SetCursorPosition(39, top); Console.WriteLine("Invalid Key."); Thread.Sleep(200); Console.Clear(); Start(); } }
public void Start() { Console.Title = "BlueMoon - Search Contacts"; Console.Clear(); AsciiClass ac = new AsciiClass(); ac.BlueMoon(3); Console.SetCursorPosition(37, 13); Console.WriteLine("==========PERSONAL ASSISTANT APPLICATION=========="); Console.SetCursorPosition(37, 15); Console.WriteLine("Press BackSpace to go to previous menu or any key to start Search...."); Console.CursorVisible = false; ConsoleKeyInfo key1; key1 = Console.ReadKey(true); if (key1.Key == ConsoleKey.Backspace) { ContactDetails cd2 = new ContactDetails(); cd2.Start(); return; } Console.SetCursorPosition(37, 15); Console.WriteLine(" "); Console.SetCursorPosition(37, 15); Console.WriteLine("Search contact Menu"); string curPath = Directory.GetCurrentDirectory(); string path = curPath + "\\Contacts.ebase"; string[] EbRows = File.ReadAllLines(path); Console.SetCursorPosition(39, 19); Console.WriteLine("enter the name of the contact to search"); Console.SetCursorPosition(39, 20); // Start add string name = Station.MeteredInput(12, 39, 20); name = name.ToLower(); bool editer = true; bool found = false; // end add string[] fieldName = { "Name", "Phone Number", "Email", "State", "City", "Address" }; while (editer) { //add found = false; for (int i = 0; i < EbRows.Length; i++) { string[] EbCol = EbRows[i].Split('~'); for (int j = 0; j < EbCol.Length; j++) { //Start add if (editer) { string EbColtemp = EbCol[0].ToLower(); if (name == EbColtemp || EbColtemp.Contains(name)) { found = true; // End add make sure to complete } Console.SetCursorPosition(39, 22); Console.WriteLine("=======Contact Found======="); EditContactsClear(); Console.SetCursorPosition(39, 24); Console.WriteLine("{0,-12} : {1}", fieldName[0], EbCol[0]); Console.SetCursorPosition(39, 25); Console.WriteLine("{0,-12} : {1}", fieldName[1], EbCol[1]); Console.SetCursorPosition(39, 26); Console.WriteLine("{0,-12} : {1}", fieldName[2], EbCol[2]); Console.SetCursorPosition(39, 27); Console.WriteLine("{0,-12} : {1}", fieldName[3], EbCol[3]); Console.SetCursorPosition(39, 28); Console.WriteLine("{0,-12} : {1}", fieldName[4], EbCol[4]); Console.SetCursorPosition(39, 29); Console.WriteLine("{0,-12} : {1}", fieldName[5], EbCol[5]); Console.SetCursorPosition(25, 31); Console.WriteLine("(Backspace) to return -- (N) to Next Search -- (any key) to start again"); Console.CursorVisible = false; ConsoleKeyInfo key; key = Console.ReadKey(true); if (key.Key == ConsoleKey.Backspace) { Station.clearRow(25, 31, 90); editer = false; } else if (key.Key == ConsoleKey.N) { break; } else { SearchContacts scc = new SearchContacts(); scc.Start(); } } } } } if (!found) { Console.SetCursorPosition(48, 27); Console.Write("Contact Not Found"); Thread.Sleep(500); Start(); } } ContactDetails cd = new ContactDetails(); cd.Start(); }