Пример #1
0
        private void frmProfileManager_Load(object sender, EventArgs e)
        {
            if (_loaded)
                return;

            switch (lstProfiles.Items.Count)
            {
                case 0:
                    using (frmWelcome frm = new frmWelcome(_localAppData))
                    {
                        DialogResult result = frm.ShowDialog(this);

                        switch (result)
                        {
                            case System.Windows.Forms.DialogResult.OK:
                                _profile = frm.Profile;
                                _profileFilePath = frm.ProfileFilePath;

                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                this.Close();
                                break;

                            case System.Windows.Forms.DialogResult.Ignore:
                                btnImportProfile_Click(null, null);
                                break;

                            default:
                                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                                this.Close();
                                break;
                        }
                    }
                    break;

                case 1:
                    _profileFilePath = Path.Combine(_localAppData, (lstProfiles.Items[0] as string) + ".profile");

                    using (frmPassword frm = new frmPassword(_profileFilePath))
                    {
                        switch (frm.ShowDialog(this))
                        {
                            case System.Windows.Forms.DialogResult.OK:
                                _profile = frm.Profile;

                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                this.Close();
                                break;

                            case System.Windows.Forms.DialogResult.Yes:
                                btnNewProfile_Click(null, null);
                                break;
                        }
                    }
                    break;

                default:
                    break;
            }
        }
Пример #2
0
        private void frmProfileManager_Load(object sender, EventArgs e)
        {
            if (_loaded)
            {
                return;
            }

            switch (lstProfiles.Items.Count)
            {
            case 0:
                using (frmWelcome frm = new frmWelcome(_localAppData))
                {
                    DialogResult result = frm.ShowDialog(this);

                    switch (result)
                    {
                    case System.Windows.Forms.DialogResult.OK:
                        _profile         = frm.Profile;
                        _profileFilePath = frm.ProfileFilePath;

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                        break;

                    case System.Windows.Forms.DialogResult.Ignore:
                        btnImportProfile_Click(null, null);
                        break;

                    default:
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                        this.Close();
                        break;
                    }
                }
                break;

            case 1:
                _profileFilePath = Path.Combine(_localAppData, (lstProfiles.Items[0] as string) + ".profile");

                using (frmPassword frm = new frmPassword(_profileFilePath))
                {
                    switch (frm.ShowDialog(this))
                    {
                    case System.Windows.Forms.DialogResult.OK:
                        _profile = frm.Profile;

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                        break;

                    case System.Windows.Forms.DialogResult.Yes:
                        btnNewProfile_Click(null, null);
                        break;
                    }
                }
                break;

            default:
                break;
            }
        }