示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Choose mode - basic, pro, expert");
            string mode = Console.ReadLine().ToLower();

            DocumentProgram docProgram = new DocumentProgram();

            switch (mode)
            {
            case "basic":
                docProgram = new DocumentProgram();
                break;

            case "pro":
                docProgram = new ProDocumentProgram();
                break;

            case "expert":
                docProgram = new ExpertDocument();
                break;

            default:
                Console.WriteLine("Wrong mode");
                break;
            }
            docProgram.OpenDocument();
            docProgram.EditDocument();
            docProgram.SaveDocument();
        }
示例#2
0
        static void Main(string[] args)
        {
            string key;

            while (true)
            {
                try
                {
                    Console.WriteLine("Enter key");
                    key = Console.ReadLine();
                    switch (key)
                    {
                    case "basic":
                        Console.Clear();
                        DocumentProgram documentProgram = new DocumentProgram();
                        documentProgram.OpenDocument();
                        documentProgram.EditDocument();
                        documentProgram.SaveDocument();
                        break;

                    case "pro":
                        Console.Clear();
                        DocumentProgram proDocumentProgram = new ProDocumentProgram();
                        proDocumentProgram.OpenDocument();
                        proDocumentProgram.EditDocument();
                        proDocumentProgram.SaveDocument();
                        break;

                    case "expert":
                        Console.Clear();
                        DocumentProgram expertDocument = new ExpertDocument();
                        expertDocument.OpenDocument();
                        expertDocument.EditDocument();
                        expertDocument.SaveDocument();
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
        static void Main(string[] args)
        {
            string keyword;

            do
            {
                Console.WriteLine("Please enter keyword: ");
                keyword = Console.ReadLine();

                if (keyword == "basic")
                {
                    DocumentProgram docProgram = new DocumentProgram();

                    docProgram.OpenDocument();
                    docProgram.EditDocument();
                    docProgram.SaveDocument();
                }

                else if (keyword == "pro")
                {
                    DocumentProgram docProgram = new ProDocumentProgram();

                    docProgram.OpenDocument();
                    docProgram.EditDocument();
                    docProgram.SaveDocument();
                }

                else if (keyword == "expert")
                {
                    DocumentProgram docProgram = new ExpertDocument();

                    docProgram.OpenDocument();
                    docProgram.EditDocument();
                    docProgram.SaveDocument();
                }
                else
                {
                    Console.WriteLine("It is not correct keyword");
                }
            } while (!(keyword == "basic" || keyword == "pro" || keyword == "expert"));
        }