예제 #1
0
        void UpdateCAPIState()
        {
            buttonExtCAPI.Text  = "Login".Tx(this);          // default state.. information needed.
            labelCAPIState.Text = "No Credentials".Tx(this);
            labelCAPILogin.Text = "Login ID:".Tx(this);
            textBoxBorderCompanionLogin.Visible = textBoxBorderCompanionPassword.Visible = labelCAPILogin.Visible = labelCAPIPassword.Visible = true;
            toolTip.SetToolTip(textBoxBorderCompanionLogin, "Enter your Frontier ID, which is the email you registered with Frontier. Does not work for Steam installs".Tx(this, "TTCAPI"));
            buttonExtCAPI.Enabled      = false;
            checkBoxCAPIEnable.Visible = false;

            if (textBoxBorderCmdr.Text.Length > 0)
            {
                bool isdisabled;
                CompanionCredentials.State s = CompanionCredentials.CredentialState(textBoxBorderCmdr.Text, out isdisabled);

                if (s == CompanionCredentials.State.CONFIRMED)
                {
                    labelCAPIState.Text = "Confirmed Credentials".Tx(this, "CC");
                    textBoxBorderCompanionLogin.Visible        = labelCAPILogin.Visible =
                        textBoxBorderCompanionPassword.Visible = labelCAPIPassword.Visible = false;
                    textBoxBorderCompanionLogin.Text           = textBoxBorderCompanionPassword.Text = "";
                    buttonExtCAPI.Text          = "Clear".Tx(this);
                    buttonExtCAPI.Enabled       = true;
                    checkBoxCAPIEnable.Location = labelCAPILogin.Location;
                    checkBoxCAPIEnable.Visible  = true;
                    checkBoxCAPIEnable.Checked  = !isdisabled;
                }
                else if (s == CompanionCredentials.State.NEEDS_CONFIRMATION)
                {
                    labelCAPIState.Text = "Require Confirmation".Tx(this, "RC");
                    labelCAPILogin.Text = "Confirm Code:".Tx(this, "CFC");
                    textBoxBorderCompanionPassword.Visible = labelCAPIPassword.Visible = false;
                    textBoxBorderCompanionLogin.Text       = textBoxBorderCompanionPassword.Text = "";
                    buttonExtCAPI.Text    = "Clear".Tx(this);        // default state is clear/abort
                    buttonExtCAPI.Enabled = true;
                    toolTip.SetToolTip(textBoxBorderCompanionLogin, "Enter the confirmation code you just received via email from Frontier".Tx(this, "ConfirmCode"));

                    if (capi.NeedLogin)
                    {
                        try
                        {
                            capi.LoginAs(textBoxBorderCmdr.Text);
                        }
                        catch (Exception ex)
                        {
                            ExtendedControls.MessageBoxTheme.Show(this,
                                                                  string.Format(("Login Failed: " + Environment.NewLine + "{0}").Tx(this, "LIF"), ex.Message), "Warning".Tx(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
예제 #2
0
        void UpdateCAPIState()
        {
            buttonExtCAPI.Text  = "Login";          // default state.. information needed.
            labelCAPIState.Text = "No Credentials";
            labelCAPILogin.Text = "Login ID:";
            textBoxBorderCompanionLogin.Visible = textBoxBorderCompanionPassword.Visible = labelCAPILogin.Visible = labelCAPIPassword.Visible = true;
            toolTip1.SetToolTip(textBoxBorderCompanionLogin, "Enter you Frontier ID, which is the email you registered with Frontier. Does not work for Steam installs");
            buttonExtCAPI.Enabled = false;

            if (textBoxBorderCmdr.Text.Length > 0)
            {
                CompanionCredentials.State s = CompanionCredentials.CredentialState(textBoxBorderCmdr.Text);

                if (s == CompanionCredentials.State.CONFIRMED)
                {
                    labelCAPIState.Text = "Confirmed Credentials";
                    textBoxBorderCompanionLogin.Visible        = labelCAPILogin.Visible =
                        textBoxBorderCompanionPassword.Visible = labelCAPIPassword.Visible = false;
                    textBoxBorderCompanionLogin.Text           = textBoxBorderCompanionPassword.Text = "";
                    buttonExtCAPI.Text    = "Clear";
                    buttonExtCAPI.Enabled = true;
                }
                else if (s == CompanionCredentials.State.NEEDS_CONFIRMATION)
                {
                    labelCAPIState.Text = "Require Confirmation";
                    labelCAPILogin.Text = "Confirm Code:";
                    textBoxBorderCompanionPassword.Visible = labelCAPIPassword.Visible = false;
                    textBoxBorderCompanionLogin.Text       = textBoxBorderCompanionPassword.Text = "";
                    buttonExtCAPI.Text    = "Clear";        // default state is clear/abort
                    buttonExtCAPI.Enabled = true;
                    toolTip1.SetToolTip(textBoxBorderCompanionLogin, "Enter the confirmation code you just received via email from Frontier");

                    if (capi.NeedLogin)
                    {
                        try
                        {
                            capi.LoginAs(textBoxBorderCmdr.Text);
                        }
                        catch (Exception ex)
                        {
                            ExtendedControls.MessageBoxTheme.Show(this, "Login Failed:" + Environment.NewLine + ex.Message, "Companion API Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }