コード例 #1
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_atConfig != null); if (m_atConfig == null)
            {
                throw new InvalidOperationException();
            }
            Debug.Assert(m_vStringDict != null); if (m_vStringDict == null)
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            m_ctxKeySeq.Attach(m_rbKeySeq, this);
            m_ctxKeyCodes.Attach(m_rtbPlaceholders, this);

            if (!m_bEditSequenceOnly)
            {
                BannerFactory.CreateBannerEx(this, m_bannerImage,
                                             Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureAutoTypeItem,
                                             KPRes.ConfigureAutoTypeItemDesc);
            }
            else             // Edit keystrokes only
            {
                BannerFactory.CreateBannerEx(this, m_bannerImage,
                                             Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureKeystrokeSeq,
                                             KPRes.ConfigureKeystrokeSeqDesc);
            }

            this.Icon = Properties.Resources.KeePass;

            // FontUtil.AssignDefaultBold(m_lblTargetWindow);
            // FontUtil.AssignDefaultBold(m_rbSeqDefault);
            // FontUtil.AssignDefaultBold(m_rbSeqCustom);

            UIUtil.EnableAutoCompletion(m_cmbWindow, false);

            // m_clrOriginalForeground = m_lblOpenHint.ForeColor;
            // m_clrOriginalBackground = m_cmbWindow.BackColor;
            // m_strOriginalWindowHint = m_lblTargetWindowInfo.Text;

            InitPlaceholdersBox();

            string strInitSeq = m_atConfig.DefaultSequence;

            if (m_iAssocIndex >= 0)
            {
                AutoTypeAssociation asInit = m_atConfig.GetAt(m_iAssocIndex);
                m_cmbWindow.Text = asInit.WindowName;

                if (!m_bEditSequenceOnly)
                {
                    strInitSeq = asInit.Sequence;
                }
            }
            else if (m_bEditSequenceOnly)
            {
                m_cmbWindow.Text = "(" + KPRes.Default + ")";
            }
            else
            {
                strInitSeq = string.Empty;
            }

            bool bSetDefault = false;

            m_bBlockUpdates = true;
            if (strInitSeq.Length > 0)
            {
                m_rbSeqCustom.Checked = true;
            }
            else
            {
                m_rbSeqDefault.Checked = true;
                bSetDefault            = true;
            }
            m_bBlockUpdates = false;

            if (bSetDefault)
            {
                m_rbKeySeq.Text = m_strDefaultSeq;
            }
            else
            {
                m_rbKeySeq.Text = strInitSeq;
            }

            try
            {
                if (NativeLib.IsUnix())
                {
                    PopulateWindowsListUnix();
                }
                else
                {
                    PopulateWindowsListWin();
                }
            }
            catch (Exception) { Debug.Assert(false); }

            EnableControlsEx();
        }
コード例 #2
0
ファイル: CsvImportForm.cs プロジェクト: sinelaw/keepass
        private void OnFormLoad(object sender, EventArgs e)
        {
            if ((m_pbData == null) || (m_pwDatabase == null))
            {
                throw new InvalidOperationException();
            }

            m_bInitializing = true;

            GlobalWindowManager.AddWindow(this);

            this.Icon = Properties.Resources.KeePass;
            this.Text = KPRes.GenericCsvImporter + " - " + PwDefs.ShortProductName;

            // FontUtil.AssignDefaultBold(m_grpSyntax);
            // FontUtil.AssignDefaultBold(m_grpSem);

            UIUtil.SetExplorerTheme(m_lvFields, false);
            UIUtil.SetExplorerTheme(m_lvImportPreview, false);

            foreach (StrEncodingInfo seiEnum in StrUtil.Encodings)
            {
                m_cmbEnc.Items.Add(seiEnum.Name);
            }

            StrEncodingInfo seiGuess = BinaryDataClassifier.GetStringEncoding(
                m_pbData, out m_uStartOffset);

            int iSel = 0;

            if (seiGuess != null)
            {
                iSel = Math.Max(m_cmbEnc.FindStringExact(seiGuess.Name), 0);
            }
            m_cmbEnc.SelectedIndex = iSel;

            string[] vChars = new string[] { ",", ";", ".", ":", "\"", @"'",
                                             StrCharTab, StrCharNewLine };
            foreach (string strChar in vChars)
            {
                m_cmbFieldSep.Items.Add(strChar);
                m_cmbRecSep.Items.Add(strChar);
                m_cmbTextQual.Items.Add(strChar);
            }
            m_cmbFieldSep.SelectedIndex = 0;
            m_cmbRecSep.SelectedIndex   = 7;
            m_cmbTextQual.SelectedIndex = 4;

            m_lvFields.Columns.Add(KPRes.Field);

            AddCsvField(CsvFieldType.Title, null, null);
            AddCsvField(CsvFieldType.UserName, null, null);
            AddCsvField(CsvFieldType.Password, null, null);
            AddCsvField(CsvFieldType.Url, null, null);
            AddCsvField(CsvFieldType.Notes, null, null);

            for (int i = (int)CsvFieldType.First; i < (int)CsvFieldType.Count; ++i)
            {
                m_cmbFieldType.Items.Add(CsvFieldToString((CsvFieldType)i));
            }
            m_cmbFieldType.SelectedIndex = (int)CsvFieldType.Group;

            m_cmbFieldFormat.Text = string.Empty;

            m_bInitializing = false;

            UpdateTextPreview();
            UpdateImportPreview();
            GuessCsvStructure();

            ProcessResize();
            EnableControlsEx();

            UIUtil.SetFocus(m_btnTabNext, this);
        }
コード例 #3
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert((m_pwDatabaseInfo != null) || (m_pgRootInfo != null));
            if ((m_pwDatabaseInfo == null) && (m_pgRootInfo == null))
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            string strWndTitle = (m_bExport ? KPRes.ExportFileTitle : KPRes.ImportFileTitle);
            string strWndDesc  = (m_bExport ? KPRes.ExportFileDesc : KPRes.ImportFileDesc);
            Bitmap bmpBanner   = (m_bExport ? Properties.Resources.B48x48_Folder_Txt :
                                  Properties.Resources.B48x48_Folder_Download);

            m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width,
                                                             m_bannerImage.Height, BannerStyle.Default, bmpBanner, strWndTitle, strWndDesc);
            this.Icon = Properties.Resources.KeePass;

            this.Text = strWndTitle;

            if (m_bExport)
            {
                m_lblFile.Text     = KPRes.ExportToPrompt;
                m_btnSelFile.Image = KeePass.Properties.Resources.B16x16_FileSaveAs;

                m_lnkFileFormats.Enabled = false;
                m_lnkFileFormats.Visible = false;
            }
            else             // Import mode
            {
                m_lblFile.Text     = KPRes.ImportFilesPrompt;
                m_btnSelFile.Image = KeePass.Properties.Resources.B16x16_Folder_Yellow_Open;
            }

            m_lvFormats.ShowGroups = true;
            m_lvFormats.Columns.Add(string.Empty);
            m_lvFormats.Columns[0].Width = m_lvFormats.ClientRectangle.Width - 1;

            ImageList ilFormats = new ImageList();

            ilFormats.ColorDepth = ColorDepth.Depth32Bit;
            ilFormats.ImageSize  = new Size(16, 16);

            Dictionary <string, FormatGroupEx> dictGroups =
                new Dictionary <string, FormatGroupEx>();

            foreach (FileFormatProvider f in Program.FileFormatPool)
            {
                if (m_bExport && (f.SupportsExport == false))
                {
                    continue;
                }
                if ((m_bExport == false) && (f.SupportsImport == false))
                {
                    continue;
                }

                string strDisplayName = f.DisplayName;
                if ((strDisplayName == null) || (strDisplayName.Length == 0))
                {
                    continue;
                }

                string strAppGroup = f.ApplicationGroup;
                if ((strAppGroup == null) || (strAppGroup.Length == 0))
                {
                    strAppGroup = KPRes.General;
                }

                FormatGroupEx grp;
                if (!dictGroups.TryGetValue(strAppGroup, out grp))
                {
                    grp = new FormatGroupEx(strAppGroup);
                    dictGroups.Add(strAppGroup, grp);
                }

                ListViewItem lvi = new ListViewItem(strDisplayName);
                lvi.Group = grp.Group;
                lvi.Tag   = f;

                Image imgSmallIcon = f.SmallIcon;
                if (imgSmallIcon == null)
                {
                    imgSmallIcon = KeePass.Properties.Resources.B16x16_Folder_Inbox;
                }

                ilFormats.Images.Add(imgSmallIcon);
                lvi.ImageIndex = ilFormats.Images.Count - 1;

                grp.Items.Add(lvi);
            }

            foreach (FormatGroupEx formatGroup in dictGroups.Values)
            {
                m_lvFormats.Groups.Add(formatGroup.Group);
                foreach (ListViewItem lvi in formatGroup.Items)
                {
                    m_lvFormats.Items.Add(lvi);
                }
            }

            m_lvFormats.SmallImageList = ilFormats;

            CustomizeForScreenReader();
            UpdateUIState();
        }
コード例 #4
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            if (m_dStrings == null)
            {
                Debug.Assert(false); throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            string strTitle, strDesc;

            if (m_strInitName == null)
            {
                strTitle = KPRes.AddStringField;
                strDesc  = KPRes.AddStringFieldDesc;
            }
            else
            {
                strTitle = KPRes.EditStringField;
                strDesc  = KPRes.EditStringFieldDesc;
            }

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Font, strTitle, strDesc);
            this.Icon = AppIcons.Default;

            UIUtil.ConfigureToolTip(m_ttRect);

            UIUtil.EnableAutoCompletion(m_cmbName, true);

            UIUtil.PrepareStandardMultilineControl(m_rtbValue, true, true);
            m_ctxValue.Attach(m_rtbValue, this);

            GFunc <PwEntry> fGetContextEntry = delegate()
            {
                return(PwEntry.CreateVirtual(((m_pdContext != null) ? m_pdContext.RootGroup :
                                              null) ?? new PwGroup(true, true), m_dStrings));
            };

            m_pgm = new PwGeneratorMenu(m_btnGenPw, m_ttRect, m_rtbValue,
                                        fGetContextEntry, m_pdContext, (m_mvec != null));

            if (m_strInitName != null)
            {
                m_cmbName.Text = m_strInitName;
            }
            if (m_psInitValue != null)
            {
                m_rtbValue.Text = StrUtil.NormalizeNewLines(
                    m_psInitValue.ReadString(), true);
                UIUtil.SetChecked(m_cbProtect, m_psInitValue.IsProtected);
            }

            ValidateStringNameUI();
            PopulateNamesComboBox();

            if (m_mvec != null)
            {
                m_cmbName.Enabled = false;
                MultipleValuesEx.ConfigureText(m_rtbValue, true);

                bool bMultiProt;
                m_mvec.MultiStringProt.TryGetValue(m_cmbName.Text, out bMultiProt);
                if (bMultiProt)
                {
                    MultipleValuesEx.ConfigureState(m_cbProtect, true);
                }
            }

            if (m_bReadOnly)
            {
                m_cmbName.Enabled   = false;
                m_rtbValue.ReadOnly = true;
                m_cbProtect.Enabled = false;
                m_btnGenPw.Enabled  = false;
                // m_btnOK.Enabled = false; // See ValidateStringNameUI
            }

            // UIUtil.SetFocus(..., this); // See PopulateNamesComboBox
        }
コード例 #5
0
ファイル: FoundCodeForm.cs プロジェクト: ownbe/ReClass.NET
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);

            GlobalWindowManager.RemoveWindow(this);
        }
コード例 #6
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            // Can be invoked by tray command; don't use CenterParent
            Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen);

            ++m_uBlockUIUpdate;

            GlobalWindowManager.AddWindow(this);

            m_strAdvControlText = m_tabAdvanced.Text;

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Gen, KPRes.PasswordOptions,
                                         KPRes.PasswordOptionsDesc);
            this.Icon = AppIcons.Default;

            UIUtil.SetButtonImage(m_btnProfileAdd,
                                  Properties.Resources.B16x16_FileSaveAs, false);
            UIUtil.SetButtonImage(m_btnProfileRemove,
                                  Properties.Resources.B16x16_EditDelete, true);

            FontUtil.AssignDefaultBold(m_rbStandardCharSet);
            FontUtil.AssignDefaultBold(m_rbPattern);
            FontUtil.AssignDefaultBold(m_rbCustom);
            FontUtil.AssignDefaultMono(m_tbPreview, true);

            UIUtil.ConfigureToolTip(m_ttMain);
            UIUtil.SetToolTip(m_ttMain, m_btnProfileAdd, KPRes.ProfileSaveDesc, false);
            UIUtil.SetToolTip(m_ttMain, m_btnProfileRemove, KPRes.ProfileDeleteDesc, false);
            UIUtil.SetToolTip(m_ttMain, m_btnCustomOpt, KPRes.Options, true);

            UIUtil.AccSetName(m_btnProfileAdd, KPRes.ProfileSave);
            UIUtil.AccSetName(m_btnProfileRemove, KPRes.ProfileDelete);

            using (RtlAwareResizeScope r = new RtlAwareResizeScope(
                       m_cbUpperCase, m_cbLowerCase, m_cbDigits, m_cbMinus,
                       m_cbUnderline, m_cbSpace, m_cbSpecial, m_cbBrackets,
                       m_cbLatin1S, m_cbNoRepeat, m_cbExcludeLookAlike,
                       m_lblExcludeChars, m_lblSecRedInfo))
            {
                m_cbUpperCase.Text        += " (A, B, C, ...)";
                m_cbLowerCase.Text        += " (a, b, c, ...)";
                m_cbDigits.Text           += " (0, 1, 2, ...)";
                m_cbMinus.Text            += " (-)";
                m_cbUnderline.Text        += " (_)";
                m_cbSpace.Text            += " ( )";
                m_cbSpecial.Text          += @" (!, $, %, &&, ...)";
                m_cbBrackets.Text         += @" ([, ], {, }, (, ), <, >)";
                m_cbLatin1S.Text          += " (\u00C4, \u00B5, \u00B6, ...)";
                m_cbNoRepeat.Text         += " *";
                m_cbExcludeLookAlike.Text += " (l|1I, O0) *";
                m_lblExcludeChars.Text    += " *";
                m_lblSecRedInfo.Text       = "* " + m_lblSecRedInfo.Text;
            }

            SetCharSetTT(m_cbUpperCase, PwCharSet.UpperCase, 2);
            SetCharSetTT(m_cbLowerCase, PwCharSet.LowerCase, 2);
            SetCharSetTT(m_cbDigits, PwCharSet.Digits, 2);
            SetCharSetTT(m_cbSpecial, PwCharSet.Special, 2);
            SetCharSetTT(m_cbLatin1S, PwCharSet.Latin1S, 4);

            m_cmbCustomAlgo.Items.Add(NoCustomAlgo);
            foreach (CustomPwGenerator pwg in Program.PwGeneratorPool)
            {
                m_cmbCustomAlgo.Items.Add(pwg.Name);
            }
            SelectCustomGenerator((m_optInitial != null) ?
                                  m_optInitial.CustomAlgorithmUuid : null, null);
            if (m_optInitial != null)
            {
                CustomPwGenerator pwg = GetPwGenerator();
                if (pwg != null)
                {
                    m_dictCustomOptions[pwg] = m_optInitial.CustomAlgorithmOptions;
                }
            }

            m_cmbProfiles.Items.Add(CustomMeta);

            if (m_optInitial != null)
            {
                m_cmbProfiles.Items.Add(DeriveFromPrevious);
                SetGenerationOptions(m_optInitial);
            }

            m_rbStandardCharSet.CheckedChanged   += this.UpdateUIProc;
            m_rbPattern.CheckedChanged           += this.UpdateUIProc;
            m_rbCustom.CheckedChanged            += this.UpdateUIProc;
            m_numGenChars.ValueChanged           += this.UpdateUIProc;
            m_cbUpperCase.CheckedChanged         += this.UpdateUIProc;
            m_cbLowerCase.CheckedChanged         += this.UpdateUIProc;
            m_cbDigits.CheckedChanged            += this.UpdateUIProc;
            m_cbMinus.CheckedChanged             += this.UpdateUIProc;
            m_cbUnderline.CheckedChanged         += this.UpdateUIProc;
            m_cbSpace.CheckedChanged             += this.UpdateUIProc;
            m_cbSpecial.CheckedChanged           += this.UpdateUIProc;
            m_cbBrackets.CheckedChanged          += this.UpdateUIProc;
            m_cbLatin1S.CheckedChanged           += this.UpdateUIProc;
            m_tbCustomChars.TextChanged          += this.UpdateUIProc;
            m_tbPattern.TextChanged              += this.UpdateUIProc;
            m_cbPatternPermute.CheckedChanged    += this.UpdateUIProc;
            m_cmbCustomAlgo.SelectedIndexChanged += this.UpdateUIProc;
            m_cbEntropy.CheckedChanged           += this.UpdateUIProc;
            m_cbNoRepeat.CheckedChanged          += this.UpdateUIProc;
            m_cbExcludeLookAlike.CheckedChanged  += this.UpdateUIProc;
            m_tbExcludeChars.TextChanged         += this.UpdateUIProc;

            m_cmbProfiles.Items.Add(AutoGeneratedMeta);

            m_cmbProfiles.SelectedIndex = ((m_optInitial == null) ? 0 : 1);

            foreach (PwProfile ppw in PwGeneratorUtil.GetAllProfiles(true))
            {
                m_cmbProfiles.Items.Add(ppw.Name);

                if ((ppw.GeneratorType == PasswordGeneratorType.Custom) &&
                    !string.IsNullOrEmpty(ppw.CustomAlgorithmUuid))
                {
                    CustomPwGenerator pwg = Program.PwGeneratorPool.Find(new
                                                                         PwUuid(Convert.FromBase64String(ppw.CustomAlgorithmUuid)));
                    if (pwg != null)
                    {
                        m_dictCustomOptions[pwg] = ppw.CustomAlgorithmOptions;
                    }
                }
            }

            if (m_optInitial == null)
            {
                // int nIndex = m_cmbProfiles.FindString(Program.Config.PasswordGenerator.LastUsedProfile.Name);
                // if(nIndex >= 0) m_cmbProfiles.SelectedIndex = nIndex;
                SetGenerationOptions(Program.Config.PasswordGenerator.LastUsedProfile);
            }

            if (!m_bCanAccept)
            {
                m_btnOK.Visible  = false;
                m_btnCancel.Text = KPRes.Close;

                m_tabPreview.Text    = KPRes.Generate;
                m_lblPreview.Visible = false;
                UIUtil.SetChecked(m_cbEntropy, false);
                m_cbEntropy.Enabled = false;
            }

            // Debug.Assert(!this.ShowInTaskbar);
            // if(m_bForceInTaskbar) this.ShowInTaskbar = true;

            --m_uBlockUIUpdate;
            EnableControlsEx(false);
        }
コード例 #7
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this);

            this.Icon = AppIcons.Default;

            m_secPassword.Attach(m_tbPassword, null, true);

            ProxyServerType pst = Program.Config.Integration.ProxyType;

            if (pst == ProxyServerType.None)
            {
                m_rbNoProxy.Checked = true;
            }
            else if (pst == ProxyServerType.Manual)
            {
                m_rbManualProxy.Checked = true;
            }
            else
            {
                m_rbSystemProxy.Checked = true;
            }

            m_tbAddress.Text = Program.Config.Integration.ProxyAddress;
            m_tbPort.Text    = Program.Config.Integration.ProxyPort;

            string strUserName = Program.Config.Integration.ProxyUserName;
            string strPassword = Program.Config.Integration.ProxyPassword;

            ProxyAuthType pat = Program.Config.Integration.ProxyAuthType;

            if (pat == ProxyAuthType.Auto)
            {
                if ((strUserName.Length > 0) || (strPassword.Length > 0))
                {
                    pat = ProxyAuthType.Manual;
                }
                else
                {
                    pat = ProxyAuthType.Default;
                }
            }

            if (pat == ProxyAuthType.None)
            {
                m_rbAuthNone.Checked = true;
            }
            else if (pat == ProxyAuthType.Manual)
            {
                m_rbAuthManual.Checked = true;
            }
            else
            {
                m_rbAuthDefault.Checked = true;
            }

            m_tbUser.Text = strUserName;
            m_secPassword.SetPassword(StrUtil.Utf8.GetBytes(strPassword));

            EnableControlsEx();
        }
コード例 #8
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_pwGroup != null); if (m_pwGroup == null)
            {
                throw new InvalidOperationException();
            }
            Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null)
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            string strTitle = (m_bCreatingNew ? KPRes.AddGroup : KPRes.EditGroup);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Folder_Txt, strTitle,
                                         (m_bCreatingNew ? KPRes.AddGroupDesc : KPRes.EditGroupDesc));
            this.Icon = Properties.Resources.KeePass;
            this.Text = strTitle;

            UIUtil.SetButtonImage(m_btnAutoTypeEdit,
                                  Properties.Resources.B16x16_Wizard, true);

            m_pwIconIndex    = m_pwGroup.IconId;
            m_pwCustomIconID = m_pwGroup.CustomIconUuid;

            m_tbName.Text = m_pwGroup.Name;
            UIUtil.SetMultilineText(m_tbNotes, m_pwGroup.Notes);

            if (!m_pwCustomIconID.Equals(PwUuid.Zero))
            {
                UIUtil.SetButtonImage(m_btnIcon, DpiUtil.GetIcon(
                                          m_pwDatabase, m_pwCustomIconID), true);
            }
            else
            {
                UIUtil.SetButtonImage(m_btnIcon, m_ilClientIcons.Images[
                                          (int)m_pwIconIndex], true);
            }

            if (m_pwGroup.Expires)
            {
                m_dtExpires.Value   = TimeUtil.ToLocal(m_pwGroup.ExpiryTime, true);
                m_cbExpires.Checked = true;
            }
            else             // Does not expire
            {
                m_dtExpires.Value   = DateTime.Now.Date;
                m_cbExpires.Checked = false;
            }
            m_cgExpiry.Attach(m_cbExpires, m_dtExpires);

            PwGroup pgParent        = m_pwGroup.ParentGroup;
            bool    bParentAutoType = ((pgParent != null) ?
                                       pgParent.GetAutoTypeEnabledInherited() :
                                       PwGroup.DefaultAutoTypeEnabled);

            UIUtil.MakeInheritableBoolComboBox(m_cmbEnableAutoType,
                                               m_pwGroup.EnableAutoType, bParentAutoType);
            bool bParentSearching = ((pgParent != null) ?
                                     pgParent.GetSearchingEnabledInherited() :
                                     PwGroup.DefaultSearchingEnabled);

            UIUtil.MakeInheritableBoolComboBox(m_cmbEnableSearching,
                                               m_pwGroup.EnableSearching, bParentSearching);

            m_tbDefaultAutoTypeSeq.Text = m_pwGroup.GetAutoTypeSequenceInherited();

            if (m_pwGroup.DefaultAutoTypeSequence.Length == 0)
            {
                m_rbAutoTypeInherit.Checked = true;
            }
            else
            {
                m_rbAutoTypeOverride.Checked = true;
            }

            m_sdCustomData = m_pwGroup.CustomData.CloneDeep();
            UIUtil.StrDictListInit(m_lvCustomData);
            UIUtil.StrDictListUpdate(m_lvCustomData, m_sdCustomData);

            CustomizeForScreenReader();
            EnableControlsEx();
            UIUtil.SetFocus(m_tbName, this);
        }
コード例 #9
0
ファイル: LanguageForm.cs プロジェクト: gh-andre/KeePassFont
 public LanguageForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #10
0
        private void OnFormClosed(object sender, FormClosedEventArgs e)
        {
            m_secPassword.Detach();

            GlobalWindowManager.RemoveWindow(this);
        }
コード例 #11
0
 private void FormSettings_FormClosed(object sender, FormClosedEventArgs e)
 {
     GlobalWindowManager.RemoveWindow(this);
 }
コード例 #12
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null)
            {
                throw new InvalidOperationException();
            }
            Debug.Assert(m_pbInData != null); if (m_pbInData == null)
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this);

            this.Icon = Properties.Resources.KeePass;

            m_bBlockChangedEvent = true;

            AddFieldColumn(m_lvHeaderOrder, KPRes.Title, -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.UserName, -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Password, -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Url, -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Notes, -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Custom + " 1", -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Custom + " 2", -1);
            AddFieldColumn(m_lvHeaderOrder, KPRes.Custom + " 3", -1);
            AddFieldColumn(m_lvHeaderOrder, "(" + KPRes.Ignore + ")", -1);
            AddFieldColumn(m_lvHeaderOrder, "(" + KPRes.Ignore + ")", -1);
            AddFieldColumn(m_lvHeaderOrder, "(" + KPRes.Ignore + ")", -1);

            foreach (ColumnHeader chHdr in m_lvHeaderOrder.Columns)
            {
                chHdr.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            const int nPrevColSize = 120;

            AddFieldColumn(m_lvPreview, KPRes.Title, nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.UserName, nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Password, nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Url, nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Notes, nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Custom + " 1", nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Custom + " 2", nPrevColSize);
            AddFieldColumn(m_lvPreview, KPRes.Custom + " 3", nPrevColSize);

            m_cmbEncoding.Items.Add(KPRes.EncodingAnsi);
            m_cmbEncoding.Items.Add(StrEncAscii);
            m_cmbEncoding.Items.Add(StrEncUtf7);
            m_cmbEncoding.Items.Add(StrEncUtf8);
            m_cmbEncoding.Items.Add(StrEncUtf32);
            m_cmbEncoding.Items.Add(StrEncUnicode);
            m_cmbEncoding.Items.Add(StrEncBigUnicode);

            m_cmbEncoding.SelectedIndex     = 0;
            m_tbSepChar.Text                = ",";
            m_cbDoubleQuoteToSingle.Checked = true;

            m_bBlockChangedEvent = false;

            UpdateStringSource();
            UpdatePreview();
        }
コード例 #13
0
ファイル: OptionsForm.cs プロジェクト: sukria/KeeFox
 private void OnFormLoad(object sender, EventArgs e)
 {
     GlobalWindowManager.AddWindow(this);
 }
コード例 #14
0
ファイル: AutoType.cs プロジェクト: eberzosa/KeePass
 internal static bool IsOwnWindow(IntPtr hWindow)
 {
     return((hWindow == Program.GetSafeMainWindowHandle()) ||
            GlobalWindowManager.HasWindow(hWindow));
 }
コード例 #15
0
 public UrlOverrideForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #16
0
 private void OnFormClosing(object sender, FormClosingEventArgs e)
 {
     GlobalWindowManager.RemoveWindow(this);
 }
コード例 #17
0
ファイル: AutoType.cs プロジェクト: ArtjomP/KeePass2.x
 internal static bool IsOwnWindow(IntPtr hWindow)
 {
     return((hWindow == Program.MainForm.Handle) ||
            GlobalWindowManager.HasWindow(hWindow));
 }
コード例 #18
0
ファイル: FoundCodeForm.cs プロジェクト: ownbe/ReClass.NET
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GlobalWindowManager.AddWindow(this);
        }
コード例 #19
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey,
                                         m_ioInfo.GetDisplayName());
            this.Icon = AppIcons.Default;
            this.Text = KPRes.CreateMasterKey;

            FontUtil.SetDefaultFont(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbKeyFile);
            FontUtil.AssignDefaultBold(m_cbUserAccount);

            using (Bitmap bmp = SystemIcons.Warning.ToBitmap())
            {
                m_imgAccWarning = GfxUtil.ScaleImage(bmp, DpiUtil.ScaleIntX(16),
                                                     DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon);
                m_imgKeyFileWarning = (Image)m_imgAccWarning.Clone();
            }
            m_picKeyFileWarning.Image = m_imgKeyFileWarning;
            m_picAccWarning.Image     = m_imgAccWarning;

            UIUtil.ConfigureToolTip(m_ttRect);
            // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks);
            m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate);
            m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting);
            m_ttRect.SetToolTip(m_tbRepeatPassword, KPRes.PasswordRepeatHint);

            Debug.Assert(!m_lblIntro.AutoSize);             // For RTL support
            if (!m_bCreatingNew)
            {
                m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort;
            }

            m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblRepeatPassword,
                                 m_tbRepeatPassword, m_lblEstimatedQuality, m_pbPasswordQuality,
                                 m_lblQualityInfo, m_ttRect, this, true, false);

            m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta);
            foreach (KeyProvider prov in Program.KeyProviderPool)
            {
                m_cmbKeyFile.Items.Add(prov.Name);
            }

            m_cmbKeyFile.SelectedIndex = 0;

            m_cbPassword.Checked = true;
            UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags,
                                   m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword);

            if (WinUtil.IsWindows9x || NativeLib.IsUnix())
            {
                UIUtil.SetChecked(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc2, false);
            }

            CustomizeForScreenReader();
            EnableUserControls();
            // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown
        }
コード例 #20
0
 public PwGeneratorForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #21
0
 public KeyFileCreationForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #22
0
 public FileBrowserForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #23
0
ファイル: LanguageForm.cs プロジェクト: t00/KeePassCore
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this, this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Keyboard_Layout,
                                         KPRes.SelectLanguage, KPRes.SelectLanguageDesc);
            this.Icon = AppIcons.Default;
            this.Text = KPRes.SelectLanguage;

            UIUtil.SetExplorerTheme(m_lvLanguages, true);

            List <Image> lImg = new List <Image>();

            lImg.Add(Properties.Resources.B16x16_Browser);

            m_ilIcons = UIUtil.BuildImageListUnscaled(lImg,
                                                      DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16));
            m_lvLanguages.SmallImageList = m_ilIcons;

            m_lvLanguages.Columns.Add(KPRes.InstalledLanguages);
            m_lvLanguages.Columns.Add(KPRes.Version);
            m_lvLanguages.Columns.Add(KPRes.Author);
            m_lvLanguages.Columns.Add(KPRes.Contact);
            m_lvLanguages.Columns.Add(KPRes.File);

            KPTranslation trlEng = new KPTranslation();

            trlEng.Properties.NameEnglish        = "English";
            trlEng.Properties.NameNative         = "English";
            trlEng.Properties.ApplicationVersion = PwDefs.VersionString;
            trlEng.Properties.AuthorName         = AppDefs.DefaultTrlAuthor;
            trlEng.Properties.AuthorContact      = AppDefs.DefaultTrlContact;

            string strDirA    = AceApplication.GetLanguagesDir(AceDir.App, false);
            string strDirASep = UrlUtil.EnsureTerminatingSeparator(strDirA, false);
            string strDirU    = AceApplication.GetLanguagesDir(AceDir.User, false);

            List <KeyValuePair <string, KPTranslation> > lTrls =
                new List <KeyValuePair <string, KPTranslation> >();

            lTrls.Add(new KeyValuePair <string, KPTranslation>(string.Empty, trlEng));
            AddTranslations(strDirA, lTrls);
            if (WinUtil.IsAppX)
            {
                AddTranslations(strDirU, lTrls);
            }
            lTrls.Sort(LanguageForm.CompareTrlItems);

            foreach (KeyValuePair <string, KPTranslation> kvp in lTrls)
            {
                KPTranslationProperties p = kvp.Value.Properties;
                string strName            = p.NameEnglish + " (" + p.NameNative + ")";
                string strVer             = PwDefs.GetTranslationDisplayVersion(p.ApplicationVersion);
                bool   bBuiltIn           = ((kvp.Key.Length == 0) || (WinUtil.IsAppX &&
                                                                       kvp.Key.StartsWith(strDirASep, StrUtil.CaseIgnoreCmp)));

                ListViewItem lvi = m_lvLanguages.Items.Add(strName, 0);
                lvi.SubItems.Add(strVer);
                lvi.SubItems.Add(p.AuthorName);
                lvi.SubItems.Add(p.AuthorContact);
                lvi.SubItems.Add(bBuiltIn ? KPRes.BuiltInU : kvp.Key);
                lvi.Tag = kvp.Key;

                // try
                // {
                //	string nl = MessageService.NewLine;
                //	lvi.ToolTipText = strName + " " + strVer + nl + p.AuthorName +
                //		nl + p.AuthorContact + nl + nl + kvp.Key;
                // }
                // catch(Exception) { Debug.Assert(false); } // Too long?

                // if(kvp.Key.Equals(Program.Config.Application.GetLanguageFilePath(),
                //	StrUtil.CaseIgnoreCmp))
                //	UIUtil.SetFocusedItem(m_lvLanguages, lvi, true);
            }

            UIUtil.ResizeColumns(m_lvLanguages, new int[] { 5, 2, 5, 5, 3 }, true);
            UIUtil.SetFocus(m_lvLanguages, this);
        }
コード例 #24
0
 public EcasEventForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #25
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            // Must work without a parent window
            Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen);

            InitAdvancedTab();             // After translation, before resize

            GlobalWindowManager.AddWindow(this);

            string strTitle = (m_bSave ? KPRes.UrlSaveTitle : KPRes.UrlOpenTitle);
            string strDesc  = (m_bSave ? KPRes.UrlSaveDesc : KPRes.UrlOpenDesc);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc);
            this.Icon = Properties.Resources.KeePass;
            this.Text = strTitle;

            FontUtil.AssignDefaultBold(m_lblUrl);
            FontUtil.AssignDefaultBold(m_lblUserName);
            FontUtil.AssignDefaultBold(m_lblPassword);
            FontUtil.AssignDefaultBold(m_lblRemember);

            m_tbUrl.Text      = (m_ioc.IsLocalFile() ? string.Empty : m_ioc.Path);
            m_tbUserName.Text = m_ioc.UserName;
            m_tbPassword.Text = m_ioc.Password;

            m_cmbCredSaveMode.Items.Add(KPRes.CredSaveNone);
            m_cmbCredSaveMode.Items.Add(KPRes.CredSaveUserOnly);
            m_cmbCredSaveMode.Items.Add(KPRes.CredSaveAll);

            if (m_ioc.CredSaveMode == IOCredSaveMode.UserNameOnly)
            {
                m_cmbCredSaveMode.SelectedIndex = 1;
            }
            else if (m_ioc.CredSaveMode == IOCredSaveMode.SaveCred)
            {
                m_cmbCredSaveMode.SelectedIndex = 2;
            }
            else
            {
                m_cmbCredSaveMode.SelectedIndex = 0;
            }

            if (!m_bCanRememberCred)
            {
                m_cmbCredSaveMode.SelectedIndex = 0;
                m_cmbCredSaveMode.Enabled       = false;
            }

            if ((m_tbUrl.TextLength > 0) && (m_tbUserName.TextLength > 0))
            {
                UIUtil.SetFocus(m_tbPassword, this);
            }
            else if (m_tbUrl.TextLength > 0)
            {
                UIUtil.SetFocus(m_tbUserName, this);
            }
            else
            {
                UIUtil.SetFocus(m_tbUrl, this);
            }
        }
コード例 #26
0
 public EditStringForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }
コード例 #27
0
ファイル: PwGeneratorForm.cs プロジェクト: matt2005/keepass2
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this);

            m_strAdvControlText = m_tabAdvanced.Text;

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Gen, KPRes.PasswordOptions,
                                         KPRes.PasswordOptionsDesc);
            this.Icon = Properties.Resources.KeePass;

            UIUtil.SetButtonImage(m_btnProfileAdd,
                                  Properties.Resources.B16x16_FileSaveAs, false);
            UIUtil.SetButtonImage(m_btnProfileRemove,
                                  Properties.Resources.B16x16_EditDelete, true);

            FontUtil.AssignDefaultBold(m_rbStandardCharSet);
            FontUtil.AssignDefaultBold(m_rbPattern);
            FontUtil.AssignDefaultBold(m_rbCustom);
            FontUtil.AssignDefaultMono(m_tbPreview, true);

            m_ttMain.SetToolTip(m_btnProfileAdd, KPRes.GenProfileSaveDesc);
            m_ttMain.SetToolTip(m_btnProfileRemove, KPRes.GenProfileRemoveDesc);

            m_bBlockUIUpdate = true;

            m_cbUpperCase.Text        += @" (A, B, C, ...)";
            m_cbLowerCase.Text        += @" (a, b, c, ...)";
            m_cbDigits.Text           += @" (0, 1, 2, ...)";
            m_cbMinus.Text            += @" (-)";
            m_cbUnderline.Text        += @" (_)";
            m_cbSpace.Text            += @" ( )";
            m_cbSpecial.Text          += @" (!, $, %, &&, ...)";
            m_cbBrackets.Text         += @" ([, ], {, }, (, ), <, >)";
            m_cbNoRepeat.Text         += @" *";
            m_cbExcludeLookAlike.Text += @" (l|1I, O0) *";
            m_lblExcludeChars.Text    += @" *";
            m_lblSecRedInfo.Text       = @"* " + m_lblSecRedInfo.Text;

            m_cmbCustomAlgo.Items.Add(NoCustomAlgo);
            foreach (CustomPwGenerator pwg in Program.PwGeneratorPool)
            {
                m_cmbCustomAlgo.Items.Add(pwg.Name);
            }
            SelectCustomGenerator((m_optInitial != null) ?
                                  m_optInitial.CustomAlgorithmUuid : null, null);
            if (m_optInitial != null)
            {
                CustomPwGenerator pwg = GetPwGenerator();
                if (pwg != null)
                {
                    m_dictCustomOptions[pwg] = m_optInitial.CustomAlgorithmOptions;
                }
            }

            m_cmbProfiles.Items.Add(CustomMeta);

            if (m_optInitial != null)
            {
                m_cmbProfiles.Items.Add(DeriveFromPrevious);
                SetGenerationOptions(m_optInitial);
            }

            m_rbStandardCharSet.CheckedChanged   += this.UpdateUIProc;
            m_rbPattern.CheckedChanged           += this.UpdateUIProc;
            m_rbCustom.CheckedChanged            += this.UpdateUIProc;
            m_numGenChars.ValueChanged           += this.UpdateUIProc;
            m_cbUpperCase.CheckedChanged         += this.UpdateUIProc;
            m_cbLowerCase.CheckedChanged         += this.UpdateUIProc;
            m_cbDigits.CheckedChanged            += this.UpdateUIProc;
            m_cbMinus.CheckedChanged             += this.UpdateUIProc;
            m_cbUnderline.CheckedChanged         += this.UpdateUIProc;
            m_cbSpace.CheckedChanged             += this.UpdateUIProc;
            m_cbSpecial.CheckedChanged           += this.UpdateUIProc;
            m_cbBrackets.CheckedChanged          += this.UpdateUIProc;
            m_cbHighAnsi.CheckedChanged          += this.UpdateUIProc;
            m_tbCustomChars.TextChanged          += this.UpdateUIProc;
            m_tbPattern.TextChanged              += this.UpdateUIProc;
            m_cbPatternPermute.CheckedChanged    += this.UpdateUIProc;
            m_cbNoRepeat.CheckedChanged          += this.UpdateUIProc;
            m_cbExcludeLookAlike.CheckedChanged  += this.UpdateUIProc;
            m_tbExcludeChars.TextChanged         += this.UpdateUIProc;
            m_cmbCustomAlgo.SelectedIndexChanged += this.UpdateUIProc;

            m_cmbProfiles.Items.Add(AutoGeneratedMeta);

            m_cmbProfiles.SelectedIndex = ((m_optInitial == null) ? 0 : 1);

            foreach (PwProfile ppw in PwGeneratorUtil.GetAllProfiles(true))
            {
                m_cmbProfiles.Items.Add(ppw.Name);

                if (ppw.GeneratorType == PasswordGeneratorType.Custom)
                {
                    CustomPwGenerator pwg = Program.PwGeneratorPool.Find(new
                                                                         PwUuid(Convert.FromBase64String(ppw.CustomAlgorithmUuid)));
                    if (pwg != null)
                    {
                        m_dictCustomOptions[pwg] = ppw.CustomAlgorithmOptions;
                    }
                }
            }

            if (m_optInitial == null)
            {
                // int nIndex = m_cmbProfiles.FindString(Program.Config.PasswordGenerator.LastUsedProfile.Name);
                // if(nIndex >= 0) m_cmbProfiles.SelectedIndex = nIndex;
                SetGenerationOptions(Program.Config.PasswordGenerator.LastUsedProfile);
            }

            if (m_bCanAccept == false)
            {
                m_btnOK.Visible  = false;
                m_btnCancel.Text = KPRes.CloseButton;

                m_tabPreview.Text    = KPRes.Generate;
                m_lblPreview.Visible = false;
                UIUtil.SetChecked(m_cbEntropy, false);
                m_cbEntropy.Enabled = false;
            }

            Debug.Assert(this.ShowInTaskbar == false);
            if (m_bForceInTaskbar)
            {
                this.ShowInTaskbar = true;
            }

            CustomizeForScreenReader();

            m_bBlockUIUpdate = false;
            EnableControlsEx(false);
        }
コード例 #28
0
 private void OnFormClosed(object sender, FormClosedEventArgs e)
 {
     CleanUpEx();
     GlobalWindowManager.RemoveWindow(this);
 }
コード例 #29
0
 public AutoTypeCtxForm()
 {
     InitializeComponent();
     GlobalWindowManager.InitializeForm(this);
 }