Example #1
0
        public void MenuRunningProcess()
        {
            Console.Clear();
            ProcessHandler processhandler = new ProcessHandler(MhLogger);

            while (true)
            {
                string menu =
                    "1 - List all running processes\n" +
                    "2 - Searh process by PID\n" +
                    "3 - Comment process by PID\n" +
                    "4 - Save all info to XML\n" +
                    "5 - Exit programme";
                Console.WriteLine(menu);
                Console.Write("Enter a number to navigate the menu: ");
                int userChocie = int.Parse(Console.ReadLine());

                switch (userChocie)
                {
                case 1:
                    processhandler.ListProcess();
                    Serializer.SerializeProcess(processhandler.allMyProcess);
                    break;

                case 2:
                    Console.WriteLine(Serializer.filepath);

                    processhandler.SearchById();
                    break;

                case 3:
                    processhandler.CommentAProcess();
                    break;

                case 4:
                    Serializer.SaveData(processhandler);
                    break;

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

                default: throw new ArgumentException("This is an invalid argument");
                }
            }
        }