Пример #1
0
        private void UpdateColumnPropInfo()
        {
            ListView.SelectedListViewItemCollection lvsic = m_lvColumns.SelectedItems;
            if ((lvsic == null) || (lvsic.Count != 1) || (lvsic[0] == null))
            {
                m_grpColumn.Text = KPRes.SelectedColumn + ": (" + KPRes.None + ")";
                m_cbHide.Checked = false;
                m_cbHide.Enabled = false;
            }
            else
            {
                ListViewItem lvi = lvsic[0];
                AceColumn    c   = (lvi.Tag as AceColumn);
                if (c == null)
                {
                    Debug.Assert(false); return;
                }

                m_grpColumn.Text = KPRes.SelectedColumn + ": " + c.GetDisplayName();
                m_cbHide.Enabled = true;

                m_bIgnoreHideCheckEvent = true;
                UIUtil.SetChecked(m_cbHide, c.HideWithAsterisks);
                m_bIgnoreHideCheckEvent = false;
            }
        }
Пример #2
0
        private void AddAceColumnTh(AceColumn c)
        {
            string strLvgName = KPRes.StandardFields;

            if (c.Type == AceColumnType.CustomString)
            {
                strLvgName = KPRes.CustomFields;
            }
            else if (c.Type == AceColumnType.PluginExt)
            {
                strLvgName = KPRes.PluginProvided;
            }
            else if ((int)c.Type > (int)AceColumnType.PluginExt)
            {
                strLvgName = KPRes.More;
            }

            ListViewGroup lvgContainer = null;

            foreach (ListViewGroup lvg in m_lvColumns.Groups)
            {
                if (lvg.Header == strLvgName)
                {
                    lvgContainer = lvg; break;
                }
            }
            if (lvgContainer == null)
            {
                lvgContainer = new ListViewGroup(strLvgName);
                m_lvColumns.Groups.Add(lvgContainer);
            }

            ListViewItem lvi = new ListViewItem(c.GetDisplayName());

            lvi.Tag = c;

            lvi.SubItems.Add(c.HideWithAsterisks ? KPRes.Yes : KPRes.No);

            if (c.Type == AceColumnType.Password)
            {
                lvi.SubItems.Add(KPRes.KeyboardKeyCtrl + "+H");
            }
            else if (c.Type == AceColumnType.UserName)
            {
                lvi.SubItems.Add(KPRes.KeyboardKeyCtrl + "+J");
            }
            else
            {
                lvi.SubItems.Add(string.Empty);
            }

            bool             bChecked = false;
            List <AceColumn> lCur     = Program.Config.MainWindow.EntryListColumns;

            foreach (AceColumn cCur in lCur)
            {
                if (cCur.Type != c.Type)
                {
                    continue;
                }

                if ((c.Type != AceColumnType.CustomString) &&
                    (c.Type != AceColumnType.PluginExt))
                {
                    bChecked = true;
                    break;
                }
                else if ((c.Type == AceColumnType.CustomString) &&
                         (cCur.CustomName == c.CustomName))
                {
                    bChecked = true;
                    break;
                }
                else if ((c.Type == AceColumnType.PluginExt) &&
                         (cCur.CustomName == c.CustomName))
                {
                    bChecked = true;
                    break;
                }
            }
            lvi.Checked = bChecked;

            lvi.Group = lvgContainer;
            m_lvColumns.Items.Add(lvi);
        }