Example #1
0
        private void login(object sender, EventArgs e)
        {
            if (saveCheckBox.Checked)
            {
                Properties.Settings.Default["savedid"] = IDTextBox.Text;
                Properties.Settings.Default["savedpw"] = PWTextBox.Text;
                if (autoLoginCheckBox.Checked)
                {
                    DialogResult result = MessageBox.Show("This option will log you in automatically with the credentials you entered.\nTo reset it again, launch this application as administrator once.\n\nDo you really want to enable it?", "Enabling Autologin", MessageBoxButtons.YesNo);

                    if (result == System.Windows.Forms.DialogResult.No)
                    {
                        autoLoginCheckBox.Checked = false;
                    }
                    else
                    {
                        Properties.Settings.Default["autologin"] = true;
                    }
                }
                else
                {
                    Properties.Settings.Default["autologin"] = false;
                }
                Properties.Settings.Default.Save();
            }
            else
            {
                Properties.Settings.Default["savedid"] = "";
                Properties.Settings.Default["savedpw"] = "";
                Properties.Settings.Default.Save();
            }

            StatusLabel.Text = "Logging in...";
            try
            {
                XIVGame.launchGame(XIVGame.getRealSID(IDTextBox.Text, PWTextBox.Text, OTPTextBox.Text), Settings.GetLanguage(), Settings.IsDX11(), Settings.GetExpansionLevel());
                Environment.Exit(0);
            }
            catch
            {
                MessageBox.Show("Logging in failed, check your login information or try again.", "Login failed", MessageBoxButtons.OK);
                StatusLabel.Text = "";
                return;
            }
        }
Example #2
0
        public MainForm()
        {
            InitializeComponent();

            if (Properties.Settings.Default.savedid != "")
            {
                IDTextBox.Text       = Properties.Settings.Default.savedid;
                PWTextBox.Text       = Properties.Settings.Default.savedpw;
                saveCheckBox.Checked = true;
            }

            if (Properties.Settings.Default.setupcomplete != true)
            {
                initialSetup();
            }

            if (Properties.Settings.Default.autologin == true && !Settings.IsAdministrator())
            {
                try
                {
                    this.Enabled = false;
                    XIVGame.launchGame(XIVGame.getRealSID(IDTextBox.Text, PWTextBox.Text, OTPTextBox.Text), Settings.GetLanguage(), Settings.IsDX11(), Settings.GetExpansionLevel());
                    Environment.Exit(0);
                }
                catch
                {
                    this.Enabled = true;
                    MessageBox.Show("Logging in failed, check your login information or try again.", "Login failed", MessageBoxButtons.OK);
                }
            }
            else
            {
                Properties.Settings.Default["autologin"] = false;
                Properties.Settings.Default.Save();
            }
        }