コード例 #1
0
        public void MessagesMenu()
        {
            while (true)
            {
                string Choice = MenuStyle.Vertical(new List <string>
                {
                    "Create Message",
                    "Inbox",
                    "View Sent",
                    "Show All Messages",
                    "Edit Message",
                    "Delete Message",
                    "Back"
                });

                switch (Choice)
                {
                case "Create Message":
                    PersonalMessage.CreateMessage();
                    break;

                case "Inbox":
                    PersonalMessage.ShowReceivedMessages();
                    break;

                case "View Sent":
                    PersonalMessage.ShowSentMessages();
                    break;

                case "Show All Messages":
                    PersonalMessage.ShowAllMessages();
                    break;

                case "Edit Message":
                    PersonalMessage.UpdateMessage();
                    break;

                case "Delete Message":
                    PersonalMessage.DeleteMessage();
                    break;

                case "Back":
                    return;
                }
            }
        }
コード例 #2
0
        public void ShowMenu()
        {
            if (ActiveUser != null)
            {
                MessageActions View        = new MessageActions(DataProvider, ActiveUser);
                SignInRegister InitialMenu = new SignInRegister(DataProvider);
                SpecificMenu   MenuActions = new SpecificMenu(DataProvider, ActiveUser);
                while (true)
                {
                    string selecteditem = string.Empty;

                    switch (ActiveUser.UserAccess)
                    {
                    case Role.visitor:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Create Message", "Inbox", "View Sent", "Log Out", "Exit"
                        });
                        break;

                    case Role.user:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Create Message", "Inbox", "View Sent", "Edit Message", "Delete Message", "Log Out", "Exit"
                        });
                        break;

                    case Role.moderator:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Messages", "Log Out", "Exit"
                        });
                        break;

                    case Role.administrator:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Manage Users", "Messages", "Log Out", "Exit"
                        });
                        break;
                    }
                    switch (selecteditem)
                    {
                    case "Manage Users":
                        MenuActions.ManageUserMenu();
                        break;

                    case "Messages":
                        MenuActions.MessagesMenu();
                        break;

                    case "Create Message":
                        View.CreateMessage();
                        break;

                    case "Inbox":
                        View.ShowReceivedMessages();
                        break;

                    case "View Sent":
                        View.ShowSentMessages();
                        break;

                    case "Edit Message":
                        View.UpdateMessage();
                        break;

                    case "Delete Message":
                        View.DeleteMessage();
                        break;

                    case "Log Out":
                        return;

                    case "Exit":
                        Console.WriteLine("\tThank you for watching");
                        Thread.Sleep(1600);
                        Environment.Exit(0);
                        break;
                    }
                }
            }
        }