コード例 #1
0
        /// <summary>
        /// Creates the master password print pop-up.
        /// </summary>
        private void CreatePrintPopUp()
        {
            MasterPasswordPrintPopUp printPopUp;

            if (passwordOptionsDarkThemeEnabled)
            {
                printPopUp = new MasterPasswordPrintPopUp(PassEntry1.Text, Color.White, Color.DarkGray, Color.DarkSlateGray, passwordOptionsDarkThemeEnabled);
            }
            else
            {
                printPopUp = new MasterPasswordPrintPopUp(PassEntry1.Text, SystemColors.ControlText, SystemColors.Window, SystemColors.Control, passwordOptionsDarkThemeEnabled);
            }

            // Adding all the printPopUp components to the list of components in the master from.
            // This is done to apply the same theme and text size to all of the forms
            MasterForm controlForm = new MasterForm();

            controlForm.labels.AddRange(printPopUp.printPopUpLabels);
            controlForm.buttons.AddRange(printPopUp.printPopUpButtons);
            controlForm.forms.Add(printPopUp);

            // Changing text size of printPopUp
            if (passwordOptionsDefaultTextSizeEnabled)
            {
                controlForm.ChangeFontSize(8.0f);
                printPopUp.printPopUpDefaultTextSizeEnabled = true;
                printPopUp.printPopUpSmallTextSizeEnabled   = false;
                printPopUp.printPopUpLargeTextSizeEnabled   = false;
            }

            else if (passwordOptionsSmallTextSizeEnabled)
            {
                controlForm.ChangeFontSize(6.0f);
                printPopUp.printPopUpDefaultTextSizeEnabled = false;
                printPopUp.printPopUpSmallTextSizeEnabled   = true;
                printPopUp.printPopUpLargeTextSizeEnabled   = false;
            }

            else if (passwordOptionsLargeTextSizeEnabled)
            {
                controlForm.ChangeFontSize(10.0f);
                printPopUp.printPopUpDefaultTextSizeEnabled = false;
                printPopUp.printPopUpSmallTextSizeEnabled   = false;
                printPopUp.printPopUpLargeTextSizeEnabled   = true;
            }

            printPopUp.ShowDialog();
            TheParent.PerformRefresh(true);
            success = true;
            this.Close();
        }
コード例 #2
0
        private void entryPasswordRandomizeButton_Click(object sender, EventArgs e) {
            MasterPasswordGenForm randomPasswordForm = new MasterPasswordGenForm(this);

            MasterForm controlForm = new MasterForm();

            // Adding all the enterPasswordForFile components to the list of components in the master from.
            // This is done to apply the same theme and text size to all of the forms
            controlForm.labels.AddRange(randomPasswordForm.passwordGenLabels);
            controlForm.buttons.AddRange(randomPasswordForm.passwordGenButtons);
            controlForm.forms.Add(randomPasswordForm);

            // Changing theme of MasterPasswordGenForm
            if (entryPasswordDarkThemeEnabled) {
                controlForm.ChangeTheme(System.Drawing.Color.White, System.Drawing.Color.DarkGray, System.Drawing.Color.DarkSlateGray);
                randomPasswordForm.passwordGenDarkThemeEnabled = true;
            }
            else {
                controlForm.ChangeTheme(System.Drawing.SystemColors.ControlText, System.Drawing.SystemColors.Window, System.Drawing.SystemColors.Control);
                randomPasswordForm.passwordGenDarkThemeEnabled = false;
            }

            // Changing text size of MasterPasswordGenForm
            if (entryPasswordDefaultTextSizeEnabled) {
                controlForm.ChangeFontSize(8.0f);
                randomPasswordForm.passwordGenDefaultTextSizeEnabled = true;
                randomPasswordForm.passwordGenSmallTextSizeEnabled = false;
                randomPasswordForm.passwordGenLargeTextSizeEnabled = false;
            }

            else if (entryPasswordSmallTextSizeEnabled) {
                controlForm.ChangeFontSize(6.0f);
                randomPasswordForm.passwordGenDefaultTextSizeEnabled = false;
                randomPasswordForm.passwordGenSmallTextSizeEnabled = true;
                randomPasswordForm.passwordGenLargeTextSizeEnabled = false;
            }

            else if (entryPasswordLargeTextSizeEnabled) {
                controlForm.ChangeFontSize(10.0f);
                randomPasswordForm.passwordGenDefaultTextSizeEnabled = false;
                randomPasswordForm.passwordGenSmallTextSizeEnabled = false;
                randomPasswordForm.passwordGenLargeTextSizeEnabled = true;
            }

            randomPasswordForm.ShowDialog();
        }