Exemple #1
0
        public PwEntry Get(string text)
        {
            var unlocker = new Unlocker {
                Host = Host
            };

            unlocker.Unlock();

            var p = new SearchParameters
            {
                SearchInTitles = true,
                SearchString   = text
            };

            var databases = Host.MainWindow.DocumentManager.GetOpenDatabases();

            foreach (var database in databases)
            {
                var list = new PwObjectList <PwEntry>();
                database.RootGroup.SearchEntries(p, list);
                if (list.UCount > 0)
                {
                    var e     = list.GetAt(0);
                    var title = e.Strings.ReadSafe(PwDefs.TitleField);
                    ShowBalloonNotification($"Entry {title} was read.");
                    return(e);
                }
            }
            throw new Exception("No " + text + " entry found!");
        }
Exemple #2
0
        public PwEntry Get(string text)
        {
            var unlocker = new Unlocker {
                Host = Host
            };

            unlocker.Unlock();

            var p = new SearchParameters
            {
                SearchInTitles = true,
                SearchString   = text
            };

            var list = new PwObjectList <PwEntry>();

            Host.Database.RootGroup.SearchEntries(p, list);

            var e     = list.GetAt(0); // TODO(djherbis): might throw
            var title = e.Strings.ReadSafe(PwDefs.TitleField);

            ShowBalloonNotification($"Entry {title} was read.");
            return(e);
        }