/// <summary> /// View menu pulls from the load method > which opens the file location and assigns the list values to "MyList" /// </summary> public void ViewListMenu() { Files files = new Files(); List <Tuple <string, bool> > MyList = files.LoadItem(); int i = 1; int currentPage = 0; int totalPages = (int)Math.Ceiling(MyList.Count() / 25.0); /// To Do do { MenuDisplaySettings(); ViewList(); int lowerLimit = currentPage * 25; int count = (currentPage == totalPages) ? (MyList.Count - currentPage * 25) : 25; /// Creates the list of the items currently on the list. Also evaluates if the task is complete. foreach (Tuple <string, bool> item in MyList.GetRange(lowerLimit, count)) { if (item.Item2 == true) { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine($"{i++}){item.Item1}"); } else { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine($"{i++}) {item.Item1}"); } } i = 1; /// bottom of the list view page. Console.WriteLine($"\nCurrent Page #{currentPage + 1} of {totalPages}"); Console.WriteLine("---------------------"); // condition next && previous pages Console.WriteLine($"'n') Next Page"); Console.WriteLine($"'p') Previous Page"); Console.Write("\nEnter Your Selection: "); string userInput = Console.ReadLine().ToLower(); try { if (userInput != "p" || userInput != "n" || userInput != "q") { MenuDisplaySettings(); int intUserInput = Convert.ToInt32(userInput); Console.WriteLine($"Task:\t{MyList[( (currentPage*25)+ intUserInput) - 1].Item1}"); Console.WriteLine("\n\n1) Complete"); Console.WriteLine("\n2) Do It Later"); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(" This Option will mark the item as\n" + " complete and create a Incomplete\n" + " at the end of the list. "); /// Add Method to Complete or Do Later Console.ReadLine(); } /// Next else if (userInput == "n") { if (currentPage == totalPages) { currentPage = 0; } else { currentPage++; } } else if (userInput == "p") { if (currentPage == 0) { currentPage = (totalPages - 1); } else { currentPage--; } } } catch (Exception) { break; } /// Previous } while (true); Console.ReadLine(); /// Takes the user selection from the list view menu /// a.Mark as Complete /// b.Mark as Incomplete /// /// Next page (if more than 25) /// Previous page Console.ReadLine(); }
public void Formalities() { Files files = new Files(); files.LoadItem(); }