KeePass.Forms.EntryListForm.InitEx C# (CSharp) Method

InitEx() public method

public InitEx ( string strTitle, string strDescShort, string strDescLong, Image imgIcon, ImageList ilIcons, PwObjectList vEntries ) : void
strTitle string
strDescShort string
strDescLong string
imgIcon Image
ilIcons System.Windows.Forms.ImageList
vEntries PwObjectList
return void
        public void InitEx(string strTitle, string strDescShort,
            string strDescLong, Image imgIcon, ImageList ilIcons,
            PwObjectList<PwEntry> vEntries)
        {
            m_strTitle = strTitle;
            m_strDescShort = strDescShort;
            m_strDescLong = strDescLong;
            m_imgIcon = imgIcon;
            m_ilIcons = UIUtil.CloneImageList(ilIcons, true);
            m_vEntries = vEntries;
        }

Usage Example

コード例 #1
0
ファイル: AutoType.cs プロジェクト: elitak/keepass
        public static bool PerformGlobal(List<PwDatabase> vSources,
            ImageList ilIcons)
        {
            Debug.Assert(vSources != null); if(vSources == null) return false;

            if(KeePassLib.Native.NativeLib.IsUnix())
            {
                if(!NativeMethods.TryXDoTool(true))
                {
                    MessageService.ShowWarning(KPRes.AutoTypeXDoToolRequiredGlobalVer);
                    return false;
                }
            }

            IntPtr hWnd;
            string strWindow;
            try
            {
                // hWnd = NativeMethods.GetForegroundWindowHandle();
                // strWindow = NativeMethods.GetWindowText(hWnd);
                NativeMethods.GetForegroundWindowInfo(out hWnd, out strWindow, true);
            }
            catch(Exception) { Debug.Assert(false); hWnd = IntPtr.Zero; strWindow = null; }

            if(string.IsNullOrEmpty(strWindow)) return false;
            if(!IsValidAutoTypeWindow(hWnd, true)) return false;

            PwObjectList<PwEntry> vList = new PwObjectList<PwEntry>();
            DateTime dtNow = DateTime.Now;

            EntryHandler eh = delegate(PwEntry pe)
            {
                // Ignore expired entries
                if(pe.Expires && (pe.ExpiryTime < dtNow)) return true;

                if(GetSequenceForWindow(pe, strWindow, true) != null)
                    vList.Add(pe);

                return true;
            };

            foreach(PwDatabase pwSource in vSources)
            {
                if(pwSource.IsOpen == false) continue;
                pwSource.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh);
            }

            if(vList.UCount == 1)
                AutoType.PerformInternal(vList.GetAt(0), strWindow);
            else if(vList.UCount > 1)
            {
                EntryListForm elf = new EntryListForm();
                elf.InitEx(KPRes.AutoTypeEntrySelection, KPRes.AutoTypeEntrySelectionDescShort,
                    KPRes.AutoTypeEntrySelectionDescLong,
                    Properties.Resources.B48x48_KGPG_Key2, ilIcons, vList);
                elf.EnsureForeground = true;

                if(elf.ShowDialog() == DialogResult.OK)
                {
                    try { NativeMethods.EnsureForegroundWindow(hWnd); }
                    catch(Exception) { Debug.Assert(false); }

                    if(elf.SelectedEntry != null)
                        AutoType.PerformInternal(elf.SelectedEntry, strWindow);
                }
                UIUtil.DestroyForm(elf);
            }

            return true;
        }
All Usage Examples Of KeePass.Forms.EntryListForm::InitEx