Exemple #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textAccountName.Text.Length == 0)
            {
                buttonGeneral.Selected = true;
                MessageBox.Show(this, "An identifier / account or display name is required", "Identifier / name required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            Rectangle windowBounds;

            if (checkWindowed.Checked)
            {
                Rectangle r = ParseWindowSize(textWindowed.Text);
                windowBounds = FixSize(r);
            }
            else
                windowBounds = Rectangle.Empty;

            Settings.IDatFile datFile;

            try
            {
                datFile = GetDatFile();
                selectedFile = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "An error occured while handling Local.dat.\n\n" + ex.Message, "Failed handling Local.dat", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (this.account == null)
            {
                this.account = Settings.CreateAccount();
                this.account.LastUsedUtc = DateTime.MinValue;
                this.account.CreatedUtc = DateTime.UtcNow;
            }

            this.account.Windowed = checkWindowed.Checked;
            this.account.Name = textAccountName.Text;
            this.account.WindowsAccount = textWindowsAccount.Text;
            this.account.Arguments = textArguments.Text;
            this.account.ShowDaily = checkShowDaily.Checked;
            this.account.DatFile = datFile;
            this.account.WindowBounds = windowBounds;
            this.account.RecordLaunches = checkRecordLaunch.Checked;

            if (checkAutomaticLogin.Checked && textAutoLoginEmail.TextLength > 0 && textAutoLoginPassword.TextLength > 0)
            {
                this.account.AutomaticLoginEmail = textAutoLoginEmail.Text;
                this.account.AutomaticLoginPassword = textAutoLoginPassword.Text;
            }
            else
            {
                this.account.AutomaticLoginEmail = null;
                this.account.AutomaticLoginPassword = null;
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Exemple #2
0
        private void buttonBrowseLocalDat_Click(object sender, EventArgs e)
        {
            using (formBrowseLocalDat f = new formBrowseLocalDat(null))
            {
                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    if (selectedFile != null)
                        selectedFile.Cancel();

                    selectedFile = f.Result;
                    if (selectedFile == null)
                        textLocalDat.Text = "";
                    else if (selectedFile.DatFile != null)
                        textLocalDat.Text = selectedFile.DatFile.Path;
                    else
                        textLocalDat.Text = selectedFile.Path;
                }
            }
        }
Exemple #3
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            if (selectedFile != null)
            {
                selectedFile.Cancel();
                selectedFile = null;
            }
        }