コード例 #1
0
        public static void AdministrationDialog(ReplyBot replybot)
        {
            while (true) {
                Console.WriteLine (
                    "--- ADMINISTRATION ---" + "\n" +
                    "'U' for user administration." + "\n" +
                    "'T' for text administration." + "\n" +
                    "'B' to get back to the main menu."
                );
                Console.Write ("> ");

                char pressedkey = Char.ToUpper (Console.ReadKey ().KeyChar);
                Console.WriteLine ("");
                switch (pressedkey) {
                case 'U':
                    AdministrationUserDialog (replybot);
                    break;
                case 'T':
                    AdministrationTextDialog (replybot);
                    break;
                case 'B':
                    return;
                default:
                    Console.WriteLine ("Key not recognized! Please try again!");
                    break;
                }
            }
        }
コード例 #2
0
        public static void AdministrationDialog(ReplyBot replybot)
        {
            while (true)
            {
                Console.WriteLine(
                    "--- ADMINISTRATION ---" + "\n" +
                    "'U' for user administration." + "\n" +
                    "'T' for text administration." + "\n" +
                    "'B' to get back to the main menu."
                    );
                Console.Write("> ");

                char pressedkey = Char.ToUpper(Console.ReadKey().KeyChar);
                Console.WriteLine("");
                switch (pressedkey)
                {
                case 'U':
                    AdministrationUserDialog(replybot);
                    break;

                case 'T':
                    AdministrationTextDialog(replybot);
                    break;

                case 'B':
                    return;

                default:
                    Console.WriteLine("Key not recognized! Please try again!");
                    break;
                }
            }
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            ReplyBot replybot = new ReplyBot();

            /*
             * E execute
             * A administration
             *  - u User
             *    - a Add
             *    - d Delete
             *    - v View
             *  - t Texts
             *    - a Add
             *    - d Delete
             *    - v View
             *  Q quit
             */

            //starting dialogue
            while (true)
            {
                Console.WriteLine(
                    " ____            _       ____        _   \n|  _ \\ ___ _ __ | |_   _| __ )  ___ | |_ \n| |_) / _ \\ '_ \\| | | | |  _ \\ / _ \\| __|\n|  _ <  __/ |_) | | |_| | |_) | (_) | |_ \n|_| \\_\\___| .__/|_|\\__, |____/ \\___/ \\__|\n          |_|      |___/                 \n" +
                    "Welcome to ReplyBot, your very own Twitter bot!" + "\n" +
                    "What would you like to do?" + "\n" +
                    "'E' to execute the bot." + "\n" +
                    "'A' to administrate." + "\n" +
                    "'Q' to quit."
                    );
                Console.Write("> ");

                char pressedkey = Char.ToUpper(Console.ReadKey().KeyChar);
                Console.WriteLine("");
                switch (pressedkey)
                {
                case 'E':
                    replybot.Execute();
                    break;

                case 'A':
                    AdministrationDialog(replybot);
                    break;

                case 'Q':
                    Console.WriteLine("Bye!");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Key not recognized! Please try again!");
                    break;
                }
            }
        }
コード例 #4
0
        public static void AdministrationTextDialog(ReplyBot replybot)
        {
            while (true)
            {
                Console.WriteLine(
                    "--- TEXT ADMINISTRATION ---" + "\n" +
                    "'A' to add a text to the database." + "\n" +
                    "'V' to view all texts in the database." + "\n" +
                    "'D' to delete a text from the database." + "\n" +
                    "'B' to go back to the main administration menu."
                    );
                Console.Write("> ");

                char pressedkey = Char.ToUpper(Console.ReadKey().KeyChar);
                Console.WriteLine("");
                switch (pressedkey)
                {
                case 'A':
                    replybot.AddTextToDatabase();
                    break;

                case 'V':
                    replybot.ViewTextDatabase();
                    break;

                case 'D':
                    replybot.DeleteTextFromDatabase();
                    break;

                case 'B':
                    return;

                default:
                    Console.WriteLine("Key not recognized! Please try again!");
                    break;
                }
            }
        }
コード例 #5
0
        public static void AdministrationTextDialog(ReplyBot replybot)
        {
            while (true) {
                Console.WriteLine (
                    "--- TEXT ADMINISTRATION ---" + "\n" +
                    "'A' to add a text to the database." + "\n" +
                    "'V' to view all texts in the database." + "\n" +
                    "'D' to delete a text from the database." + "\n" +
                    "'B' to go back to the main administration menu."
                );
                Console.Write ("> ");

                char pressedkey = Char.ToUpper (Console.ReadKey ().KeyChar);
                Console.WriteLine ("");
                switch (pressedkey) {
                case 'A':
                    replybot.AddTextToDatabase ();
                    break;
                case 'V':
                    replybot.ViewTextDatabase ();
                    break;
                case 'D':
                    replybot.DeleteTextFromDatabase ();
                    break;
                case 'B':
                    return;
                default:
                    Console.WriteLine ("Key not recognized! Please try again!");
                    break;
                }
            }
        }
コード例 #6
0
        public static void Main(string[] args)
        {
            ReplyBot replybot = new ReplyBot ();
            /*
             * E execute
             * A administration
             * 	- u User
             *    - a Add
             *    - d Delete
             *    - v View
             *  - t Texts
             *    - a Add
             *    - d Delete
             *    - v View
             *  Q quit
             */

            //starting dialogue
            while (true) {
                Console.WriteLine (
                    " ____            _       ____        _   \n|  _ \\ ___ _ __ | |_   _| __ )  ___ | |_ \n| |_) / _ \\ '_ \\| | | | |  _ \\ / _ \\| __|\n|  _ <  __/ |_) | | |_| | |_) | (_) | |_ \n|_| \\_\\___| .__/|_|\\__, |____/ \\___/ \\__|\n          |_|      |___/                 \n" +
                    "Welcome to ReplyBot, your very own Twitter bot!" + "\n" +
                    "What would you like to do?" + "\n" +
                    "'E' to execute the bot." + "\n" +
                    "'A' to administrate." + "\n" +
                    "'Q' to quit."
                );
                Console.Write ("> ");

                char pressedkey = Char.ToUpper (Console.ReadKey ().KeyChar);
                Console.WriteLine ("");
                switch (pressedkey) {
                case 'E':
                    replybot.Execute ();
                    break;
                case 'A':
                    AdministrationDialog (replybot);
                    break;
                case 'Q':
                    Console.WriteLine ("Bye!");
                    Environment.Exit (0);
                    break;
                default:
                    Console.WriteLine ("Key not recognized! Please try again!");
                    break;
                }
            }
        }