コード例 #1
0
        private void addNewProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmInputBox inputBox = new frmInputBox())
            {
                common.getMainForm().loadedTheme.themeForm(inputBox);
                inputBox.Text            = "Add Profile";
                inputBox.lblMessage.Text = "Enter new profile name:";

                inputBox.ShowDialog();

                if (inputBox.DialogResult == DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(inputBox.result) &&
                        !isNewProfileNameDuplicate(this.loadedAccount.profiles, inputBox.result))
                    {
                        common.addProfileToAccount(common.getMainForm().loadedAccount, new fundingProfile(common.getNextProfileId(), inputBox.result));
                        common.getMainForm().refreshDataForAllMdiChildren();
                    }
                    else
                    {
                        using (frmMessageBox messageBox = new frmMessageBox())
                        {
                            common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                            common.getMainForm().loadedTheme.themeForm(messageBox);
                            messageBox.show("You cannot have more than one profile with the same name",
                                            "Duplicate Profile Name", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void renameSelectedProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (getSelectedProfile() == null)
            {
                using (frmMessageBox messageBox = new frmMessageBox())
                {
                    common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                    common.getMainForm().loadedTheme.themeForm(messageBox);
                    messageBox.show("No Profile Selected.", "No Profile Selected", MessageBoxButtons.OK);
                }
            }
            else
            {
                using (frmInputBox inputBox = new frmInputBox())
                {
                    common.setFormFontSize(inputBox, common.getMainForm().loadedFontSize);
                    common.getMainForm().loadedTheme.themeForm(inputBox);
                    inputBox.Text            = "Rename Profile: [" + getSelectedProfile().name + "]";
                    inputBox.lblMessage.Text = "Enter new profile name:";
                    inputBox.txtInput.Text   = getSelectedProfile().name;

                    inputBox.ShowDialog();

                    /* i.e. only process if the user said OK */
                    if (inputBox.DialogResult == DialogResult.OK)
                    {
                        if (!string.IsNullOrEmpty(inputBox.result) &&
                            !isRenameProfileNameDuplicate(this.loadedAccount.profiles, inputBox.result))
                        {
                            //rename profile
                            fundingProfile renamedProfile = new fundingProfile(getSelectedProfile().id, inputBox.result, getSelectedProfile().cashFlows);

                            common.updateProfileOnAccount(common.getMainForm().loadedAccount, getSelectedProfile(), renamedProfile);
                            common.getMainForm().refreshDataForAllMdiChildren();
                        }
                        else
                        {
                            using (frmMessageBox messageBox = new frmMessageBox())
                            {
                                common.setFormFontSize(messageBox, common.getMainForm().loadedFontSize);
                                common.getMainForm().loadedTheme.themeForm(messageBox);
                                messageBox.show("You cannot have more than one profile with the same name",
                                                "Duplicate Profile Name", MessageBoxButtons.OK);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void addNewProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmInputBox inputBox = new frmInputBox())
            {
                common.setFormFontSize(inputBox, common.getMainForm().loadedFontSize);
                common.getMainForm().loadedTheme.themeForm(inputBox);
                inputBox.Text            = "Add Profile";
                inputBox.lblMessage.Text = "Enter new profile name:";

                inputBox.ShowDialog();

                if (!string.IsNullOrEmpty(inputBox.result))
                {
                    common.addProfileToAccount(common.getMainForm().loadedAccount, new fundingProfile(common.getNextProfileId(), inputBox.result));
                    common.getMainForm().refreshDataForAllMdiChildren();
                }
            }
        }