Exemple #1
0
        private static void ShowMenuSettings()
        {
            bool menuClose = false;

            while (!menuClose)
            {
                var      menuTitle   = "Settings Menu";
                var      description = "Select a setting to modify or an action:";
                string[] choices     = new string[]
                {
                    "Back to the Main Menu",
                    "Show Running Environment & Settings Details",
                    "Check for an Update",
                    "Email Settings",
                    "Enable Beta Updates"
                };
                int answer = Prompts.PromptMenu(menuTitle, choices, description);
                switch (answer)
                {
                case 1:
                    menuClose = true;
                    break;

                case 2:
                    ShowEnvironmentVariables();
                    break;

                case 3:
                    bool updateAvailable = Core.CheckForUpdate();
                    if (updateAvailable)
                    {
                        Console.WriteLine("An update is available and is downloading now, we'll alert you when it's ready");
                    }
                    else
                    {
                        Console.WriteLine("You are on the latest version!");
                    }
                    StopForMessage();
                    break;

                case 4:
                    Prompts.PromptEmailSettings();
                    break;

                case 5:
                    Constants.Config.BetaUpdates = Prompts.PromptYesNo("Would you like to get Beta versions of this app? (Some updates may be unstable)");
                    break;

                default:
                    Log.Information("Answer entered wasn't a valid presented option");
                    Console.WriteLine("Answer entered isn't one of the options, please press enter and try again");
                    Console.ReadLine();
                    break;
                }
                Console.Clear();
            }
        }
Exemple #2
0
        private static void ShowMenuOpenDirectory()
        {
            bool menuClose = false;

            while (!menuClose)
            {
                string   menuName    = "Open Directory";
                string   description = "Which directory would you like to open?";
                string[] menuChoices = new string[]
                {
                    "Open Config Directory",
                    "Open Log Directory",
                    "Open SaveData Directory",
                    "Back to Main Menu"
                };
                int answer = Prompts.PromptMenu(menuName, menuChoices, description);
                switch (answer)
                {
                case 1:
                    if (Core.OpenDir(AppFile.Config) != StatusReturn.Success)
                    {
                        UI.StopForMessage();
                    }
                    break;

                case 2:
                    if (Core.OpenDir(AppFile.Log) != StatusReturn.Success)
                    {
                        UI.StopForMessage();
                    }
                    break;

                case 3:
                    if (Core.OpenDir(AppFile.SavedData) != StatusReturn.Success)
                    {
                        UI.StopForMessage();
                    }
                    break;

                case 4:
                    menuClose = true;
                    break;

                default:
                    Log.Information("Answer entered wasn't a valid presented option");
                    Console.WriteLine("Answer entered isn't one of the options, please press enter and try again");
                    Console.ReadLine();
                    break;
                }
                Console.Clear();
            }
            Log.Information("Exited Menu OpenDirectory");
        }
Exemple #3
0
        internal static void ShowMenuRoot()
        {
            Log.Debug("Presenting Menu Root");
            while (!Constants.CloseApp)
            {
                try
                {
                    string   menuName    = "Main Menu";
                    string   description = "Enter the corresponding menu number for the action you want to perform:";
                    string[] menuChoices = new string[]
                    {
                        "Add Watcher",
                        "Modify Watcher",
                        "Test Watcher Alert",
                        "Test Keyword On Website",
                        "Open Directory",
                        "Settings",
                        "Close Bot"
                    };
                    int answer = Prompts.PromptMenu(menuName, menuChoices, description, true);
                    if (Constants.DebugMode && answer == 99)
                    {
                        Handler.TestAction();
                    }

                    switch (answer)
                    {
                    case 1:
                        ShowMenuAddWatcher();
                        break;

                    case 2:
                        ShowMenuModifyWatcher();
                        break;

                    case 3:
                        ShowMenuTestWatcherAlert();
                        break;

                    case 4:
                        ShowMenuTestKeywordOnWebpage();
                        break;

                    case 5:
                        ShowMenuOpenDirectory();
                        break;

                    case 6:
                        ShowMenuSettings();
                        break;

                    case 7:
                        Handler.CloseApp();
                        break;

                    default:
                        Log.Information("Answer entered wasn't a valid presented option");
                        Console.WriteLine("Answer entered isn't one of the options, please press enter and try again");
                        Console.ReadLine();
                        break;
                    }
                    Console.Clear();
                }
                catch (Exception ex)
                {
                    Log.Error(ex, $"Error: {ex.Message}");
                    Handler.NotifyError(ex);
                }
            }
            Log.Information("Exited menu root");
        }