Beispiel #1
0
        public static void StartProgram()
        {
            Console.Title = "My Classmates";
            if (FileHandling.CheckFileFolderExistance() > 0)
            {
                Classmates.Populate(myClassmates);

                //Method for saving mockdata and user changes to a file.
                FileHandling.BinarySerializer(myClassmates);
            }

            // Else read the file
            else
            {
                myClassmates = FileHandling.BinaryDeSerializer(myClassmates);
            }
            Console.SetWindowSize(100, 40);
            FileHandling.CreateLogos();

            //Runs the login method
            Login.UserLogin();
            //If the program had to add any files, then populate that file with the standard classmates

            Menus.StartMenu(myClassmates);
        }
Beispiel #2
0
        /*----------------------------------------------------------
        *                   DIFFERENT MENUES
        *  ----------------------------------------------------------*/

        public static void StartMenu(List <Classmates> listOfClassmates)
        {
            do
            {
                Console.Clear();
                FileHandling.LogoPrint("start");

                PrintMenu(startMenu);
                Print.Blue(@"Ange ett alternativ \>");
                int menuChoice;
                int.TryParse(Console.ReadLine(), out menuChoice);

                switch (menuChoice)
                {
                case 1:
                    Menus.ListAllClassmates(listOfClassmates);
                    break;

                case 2:
                    Menus.ListDetailsClassmates(listOfClassmates, listBasicClassmatesMenu);
                    break;

                case 3:
                    RemoveMenu(listOfClassmates, listBasicClassmatesMenu);
                    break;

                case 4:
                    listOfClassmates.Clear();
                    Classmates.Populate(listOfClassmates);
                    FileHandling.BinarySerializer(listOfClassmates);
                    top  = startMenu.Count + 11;
                    left = 0;
                    Console.SetCursorPosition(left, top);
                    Print.Yellow("Mockdata återställd");
                    Thread.Sleep(1500);
                    break;

                case 5:
                    Environment.Exit(0);
                    break;

                case 0:
                default:
                    top  = startMenu.Count + 11;
                    left = 0;
                    Console.SetCursorPosition(left, top);
                    Print.Red("Felaktigt val, försök igen");
                    Thread.Sleep(1500);

                    break;
                }
            } while (true);
        }