BF2Statistics.GamespyRedirectForm.NextBtn_Click C# (CSharp) Method

NextBtn_Click() private method

Event fired when the Next button is pushed
private NextBtn_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private async void NextBtn_Click(object sender, EventArgs e)
        {
            // Get our next step
            switch (pageControl1.SelectedTab.Name)
            {
                case "tabPageSelect":
                    // Make sure we are going to redirect something...
                    if (!Bf2webCheckbox.Checked && !GpcmCheckbox.Checked)
                    {
                        MessageBox.Show(
                            "Please select at least 1 redirect option",
                            "Select an Option", MessageBoxButtons.OK, MessageBoxIcon.Information
                        );
                        return;
                    }

                    // Show loading status so the user sees progress
                    StatusPic.Visible = StatusText.Visible = true;
                    NextBtn.Enabled = false;

                    // Validate hostnames, and convert them to IPAddresses
                    bool IsValid = await GetRedirectAddressesAsync();
                    if (IsValid)
                        Step = pageControl1.TabPages.IndexOf(tabPageRedirectType);

                    // Hide status icon and next
                    StatusPic.Visible = StatusText.Visible = false;
                    break;
                case "tabPageRedirectType":
                    if (IcsRadio.Checked)
                        Step = pageControl1.TabPages.IndexOf(tabPageVerifyIcs);
                    else if (HostsRadio.Checked)
                        Step = pageControl1.TabPages.IndexOf(tabPageVerifyHosts);
                    else
                        Step = pageControl1.TabPages.IndexOf(tabPageDiagnostic);

                    // Set new redirect options
                    Redirector.SetRedirectMode(SelectedMode);
                    Redirector.StatsServerAddress = StatsServerAddress;
                    Redirector.GamespyServerAddress = GamespyServerAddress;
                    break;
                case "tabPageVerifyIcs":
                case "tabPageVerifyHosts":
                    // Reset diag page
                    Status1.Image = Status2.Image = Status4.Image = Status5.Image = null;
                    Address1.Text = Address2.Text = Address4.Text = Address5.Text = "Queued";

                    // Get our next page index
                    Step = pageControl1.TabPages.IndexOf(tabPageDiagnostic);
                    break;
                case "tabPageDiagnostic":
                    // All processing is done in the after select
                    Step = pageControl1.TabPages.IndexOf(tabPageSuccess);
                    break;
                case "tabPageError":
                case "tabPageSuccess":
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                    break;
            }

            // Make sure we have a change before changing our index
            if (Step == pageControl1.SelectedIndex)
                return;

            // Set the new index
            pageControl1.SelectedIndex = Step;
        }