Ejemplo n.º 1
0
        private void SubmitButton_Click_1(object sender, EventArgs e)
        {
            var _name         = ListName;
            var languageArray = WordList.LoadList(_name).Languages;
            var answer        = AnswerBox.Text.ToLower();

            AnswerBox.Text = string.Empty;

            if (answer == WordForPractice.Translations[WordForPractice.ToLanguage].ToLower())
            {
                Score++;
                Tries++;
            }
            else
            {
                var caption = "Wrong Answer";
                var message =
                    $"You answered wrong. Your answer was {answer} and the correct answer is {WordForPractice.Translations[WordForPractice.ToLanguage].ToLower()} ";
                var buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, caption, buttons);
                Tries++;
                Fails++;
            }

            PracticeGenerator();
            PracticeWordBox.Text =
                $"Here is the {languageArray[WordForPractice.FromLanguage]} word {WordForPractice.Translations[WordForPractice.FromLanguage]}\r\n Please submit the {languageArray[WordForPractice.ToLanguage]} translation";
            ScoreAmount.Text = Score.ToString();
            FailAmount.Text  = Fails.ToString();
            TriesAmount.Text = Tries.ToString();
        }
        internal void Evaluate(ProcessArgumentBuilder arguments)
        {
            if (Help)
            {
                arguments.Append(this.GetArgumentName(nameof(Help)));
            }

            if (Version)
            {
                arguments.Append(this.GetArgumentName(nameof(Version)));
            }

            if (Url != default)
            {
                arguments.Append(Url.AbsoluteUri);
            }

            if (!string.IsNullOrWhiteSpace(OutputDocument))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(OutputDocument)), SwitchSeparator, OutputDocument);
            }

            if (!string.IsNullOrWhiteSpace(OutputFile))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(OutputFile)), SwitchSeparator, OutputFile);
            }

            if (!string.IsNullOrWhiteSpace(AppendOutput))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(AppendOutput)), SwitchSeparator, AppendOutput);
            }

            if (Quiet)
            {
                arguments.Append(this.GetArgumentName(nameof(Quiet)));
            }

            if (Debug)
            {
                arguments.Append(this.GetArgumentName(nameof(Debug)));
            }

            if (Verbose)
            {
                arguments.Append(this.GetArgumentName(nameof(Verbose)));
            }

            if (NoVerbose)
            {
                arguments.Append(this.GetArgumentName(nameof(NoVerbose)));
            }

            if (!string.IsNullOrWhiteSpace(InputFile))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(InputFile)), SwitchSeparator, InputFile);
            }

            if (ForceHtml)
            {
                arguments.Append(this.GetArgumentName(nameof(ForceHtml)));
            }

            if (!string.IsNullOrWhiteSpace(Base))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(Base)), SwitchSeparator, Base);
            }

            if (!string.IsNullOrWhiteSpace(RejectedLog))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(RejectedLog)), SwitchSeparator, RejectedLog);
            }

            if (Tries != default)
            {
                arguments.AppendSwitch(this.GetArgumentName(nameof(Tries)), SwitchSeparator, Tries.ToString());
            }

            if (!string.IsNullOrWhiteSpace(DirectoryPrefix))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(DirectoryPrefix)), SwitchSeparator, DirectoryPrefix);
            }

            if (LimitRate != null && LimitRate.Value > 0.0)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(LimitRate)),
                    SwitchSeparator,
                    LimitRate.GetFormattedLimitRateValue());
            }

            if (RetryConnectionRefused)
            {
                arguments.Append(this.GetArgumentName(nameof(RetryConnectionRefused)));
            }

            if (Recursive)
            {
                arguments.Append(this.GetArgumentName(nameof(Recursive)));
            }

            if (Level != default)
            {
                arguments.AppendSwitch(this.GetArgumentName(nameof(Level)), SwitchSeparator, Level.ToString());
            }

            if (Wait.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(Wait)),
                    SwitchSeparator,
                    Wait.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (WaitRetry.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(WaitRetry)),
                    SwitchSeparator,
                    WaitRetry.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (RandomWait)
            {
                arguments.Append(this.GetArgumentName(nameof(RandomWait)));
            }

            if (!string.IsNullOrWhiteSpace(User))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(User)), SwitchSeparator, User);
            }

            if (!string.IsNullOrWhiteSpace(Password))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(Password)), SwitchSeparator, new SecretArgument(new TextArgument(Password)));
            }

            if (!string.IsNullOrWhiteSpace(HttpUser))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(HttpUser)), SwitchSeparator, HttpUser);
            }

            if (!string.IsNullOrWhiteSpace(HttpPassword))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(HttpPassword)), SwitchSeparator, new SecretArgument(new TextArgument(HttpPassword)));
            }

            if (!string.IsNullOrWhiteSpace(FtpUser))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(FtpUser)), SwitchSeparator, FtpUser);
            }

            if (!string.IsNullOrWhiteSpace(FtpPassword))
            {
                arguments.AppendSwitchQuoted(this.GetArgumentName(nameof(FtpPassword)), SwitchSeparator, new SecretArgument(new TextArgument(FtpPassword)));
            }

            if (Continue)
            {
                arguments.Append(this.GetArgumentName(nameof(Continue)));
            }

            if (Timeout.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(Timeout)),
                    SwitchSeparator,
                    Timeout.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (DnsTimeout.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(DnsTimeout)),
                    SwitchSeparator,
                    DnsTimeout.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (ConnectTimeout.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(ConnectTimeout)),
                    SwitchSeparator,
                    ConnectTimeout.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (ReadTimeout.HasValue)
            {
                arguments.AppendSwitch(
                    this.GetArgumentName(nameof(ReadTimeout)),
                    SwitchSeparator,
                    ReadTimeout.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture));
            }

            if (Background)
            {
                arguments.Append(this.GetArgumentName(nameof(Background)));
            }
        }