Example #1
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            if (m_pwGroup == null)
            {
                Debug.Assert(false); throw new InvalidOperationException();
            }
            if (m_pwDatabase == null)
            {
                Debug.Assert(false); 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 = AppIcons.Default;
            this.Text = strTitle;

            UIUtil.ConfigureToolTip(m_ttRect);
            UIUtil.SetToolTip(m_ttRect, m_btnIcon, KPRes.SelectIcon, true);
            UIUtil.SetToolTip(m_ttRect, m_btnAutoTypeEdit, KPRes.ConfigureKeystrokeSeq, true);

            UIUtil.AccSetName(m_dtExpires, m_cbExpires);
            UIUtil.AccSetName(m_tbDefaultAutoTypeSeq, m_rbAutoTypeOverride);

            m_tbName.Text = m_pwGroup.Name;

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

            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);
            }

            UIUtil.SetMultilineText(m_tbNotes, m_pwGroup.Notes);

            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);

            TagUtil.MakeInheritedTagsLink(m_linkTagsInh, m_pwGroup.ParentGroup, this);
            m_tbTags.Text = StrUtil.TagsToString(m_pwGroup.Tags, true);
            TagUtil.MakeTagsButton(m_btnTags, m_tbTags, m_ttRect, m_pwGroup.ParentGroup,
                                   ((m_pwDatabase != null) ? m_pwDatabase.RootGroup : null));

            m_tbUuid.Text = m_pwGroup.Uuid.ToHexString() + ", " +
                            Convert.ToBase64String(m_pwGroup.Uuid.UuidBytes);

            PwGroup pgParent = m_pwGroup.ParentGroup;

            bool bParentSearching = ((pgParent != null) ?
                                     pgParent.GetSearchingEnabledInherited() :
                                     PwGroup.DefaultSearchingEnabled);

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

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

            UIUtil.MakeInheritableBoolComboBox(m_cmbEnableAutoType,
                                               m_pwGroup.EnableAutoType, bParentAutoType);

            m_tbDefaultAutoTypeSeq.Text = m_pwGroup.GetAutoTypeSequenceInherited();

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

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

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

            EnableControlsEx();

            ThreadPool.QueueUserWorkItem(delegate(object state)
            {
                try
                {
                    string[] vSeq = m_pwDatabase.RootGroup.GetAutoTypeSequences(true);
                    // Do not append, because long suggestions hide the start
                    UIUtil.EnableAutoCompletion(m_tbDefaultAutoTypeSeq,
                                                false, vSeq); // Invokes
                }
                catch (Exception) { Debug.Assert(false); }
            });

            UIUtil.SetFocus(m_tbName, this);

            switch (m_gftInit)
            {
            case GroupFormTab.Properties:
                m_tabMain.SelectedTab = m_tabProperties; break;

            case GroupFormTab.AutoType:
                m_tabMain.SelectedTab = m_tabAutoType; break;

            case GroupFormTab.CustomData:
                m_tabMain.SelectedTab = m_tabCustomData; break;

            default: break;
            }
        }
Example #2
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);

            m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width,
                                                             m_bannerImage.Height, BannerStyle.Default,
                                                             Properties.Resources.B48x48_Folder_Txt, KPRes.EditGroup,
                                                             KPRes.EditGroupDesc);
            this.Icon = Properties.Resources.KeePass;

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

            m_dtExpires.CustomFormat = DateTimeFormatInfo.CurrentInfo.ShortDatePattern +
                                       " " + DateTimeFormatInfo.CurrentInfo.LongTimePattern;

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

            m_tbName.Text  = m_pwGroup.Name;
            m_tbNotes.Text = m_pwGroup.Notes;

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

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

            UIUtil.MakeInheritableBoolComboBox(m_cmbEnableAutoType,
                                               m_pwGroup.EnableAutoType, m_pwGroup.GetAutoTypeEnabledInherited());
            UIUtil.MakeInheritableBoolComboBox(m_cmbEnableSearching,
                                               m_pwGroup.EnableSearching, m_pwGroup.GetSearchingEnabledInherited());

            m_tbDefaultAutoTypeSeq.Text = m_pwGroup.GetAutoTypeSequenceInherited();

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

            CustomizeForScreenReader();
            EnableControlsEx();
        }
Example #3
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, m_pwDatabase.GetCustomIcon(
                                          m_pwCustomIconID), true);
            }
            else
            {
                UIUtil.SetButtonImage(m_btnIcon, m_ilClientIcons.Images[
                                          (int)m_pwIconIndex], true);
            }

            if (m_pwGroup.Expires)
            {
                m_dtExpires.Value   = m_pwGroup.ExpiryTime;
                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;
            }

            CustomizeForScreenReader();
            EnableControlsEx();
            UIUtil.SetFocus(m_tbName, this);
        }