Exemplo n.º 1
0
        private Result <Parameters> ParseParameters(string[] programArgs)
        {
            var parser = SetupParser();

            var parseResult = parser.Parse(programArgs);

            if (!parseResult.HasErrors && !parseResult.HelpCalled)
            {
                return(argumentsParser.ParseArgumentsToParameters(parser.Object));
            }

            return(Result.Fail <Parameters>(parseResult.ErrorText));
        }
Exemplo n.º 2
0
        private Button GetPerformButton()
        {
            var performButton = new MetroButton
            {
                Text = @"Показать облако",
                Dock = DockStyle.Bottom
            };

            performButton.Click += (sender, args) =>
            {
                var colors    = colorSelector.Text.Split(' ').Where(s => s.Length > 0).ToList();
                var arguments = new UserInterfaceArguments(inputFilePathTextBox.Text,
                                                           outputFileTextBox.Text, (int)widthSetter.Value, (int)heightSetter.Value,
                                                           fontSelector.Text, colors, formatSelector.Text);
                argumentsParser.ParseArgumentsToParameters(arguments)
                .OnFail(ShowError)
                .Then(runProgramAction);
            };
            return(performButton);
        }