コード例 #1
0
ファイル: Program.cs プロジェクト: xbnr/x3-ws-tester
        private void DisplayPromptMenu()
        {
            PromptHelper.ShowPromptInfo($"\r");
            PromptHelper.ShowPromptInfo($"{(int)Menu.ListSolutions}. List configurations");
            PromptHelper.ShowPromptInfo($"{(int)Menu.OpenConfiguration}. Open configuration");

            PromptHelper.ShowPromptInfo($"{(int)Menu.CreateNewConfiguration}. Create new configuration");
            PromptHelper.ShowPromptInfo($"{(int)Menu.ExitProgram}. Quit");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: xbnr/x3-ws-tester
        private void Prompt()
        {
            PromptHelper.ShowPromptInfo("Welcome to SAGE X3 Tester.");
            PromptHelper.ShowPromptInfo("");


            while (true)
            {
                FileInfo[] files = ConfigurationFileList();

                DisplayPromptMenu();

                string lineRead = PromptHelper.EnterValue("Please, enter your choice, or the solution you want to open : ");
                int    number   = -1;
                bool   ok       = int.TryParse(lineRead, out number);

                string configurationName = null;
                if (!ok)
                {
                    if (lineRead.Equals("Quit", StringComparison.InvariantCultureIgnoreCase) || lineRead.Equals("Exit", StringComparison.InvariantCultureIgnoreCase))
                    {
                        number = (int)Menu.ExitProgram;
                    }
                    else
                    {
                        number            = (int)Menu.OpenConfiguration;
                        configurationName = lineRead;
                    }
                }

                switch (number)
                {
                case (int)Menu.DisplayPrompt:
                    DisplayPromptMenu();
                    break;

                case (int)Menu.CreateNewConfiguration:
                    CreateNewConfiguration();
                    break;

                case (int)Menu.OpenConfiguration:
                    ConnectConfiguration(files, configurationName);
                    break;

                case (int)Menu.ExitProgram:
                    Environment.Exit(0);
                    break;
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: xbnr/x3-ws-tester
        private static FileInfo[] ConfigurationFileList()
        {
            FileInfo[] files = new FileInfo[0];
            var        dir   = new DirectoryInfo(ProgramUI.GetWorkspaceDirectory());

            if (dir.Exists)
            {
                files = dir.GetFiles();
                foreach (var item in files)
                {
                    PromptHelper.ShowPromptInfo($"{item.Name}");
                }
                PromptHelper.ShowPromptInfo($" ");
            }
            return(files);
        }
コード例 #4
0
ファイル: PromptHelper.cs プロジェクト: xbnr/x3-ws-tester
        public static bool EnterBooleanValue(string promptLabel, bool defaultValue)
        {
            bool result = defaultValue;

            PromptHelper.ShowPromptInfo(promptLabel);
            string valueEntered = EnterString();

            if (!string.IsNullOrEmpty(valueEntered))
            {
                if (valueEntered.Trim().Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = true;
                }
                if (valueEntered.Trim().Equals("True", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = true;
                }
            }
            return(result);
        }