Exemple #1
0
        private bool OpenAutoExecEntries(Database db)
        {
            string thisDevice = KeeAutoExecExt.ThisDeviceId;

            foreach (var autoOpenItem in KeeAutoExecExt.GetAutoExecItems(db.KpDatabase))
            {
                if (!autoOpenItem.Enabled)
                {
                    continue;
                }
                if (!KeeAutoExecExt.IsDeviceEnabled(autoOpenItem, thisDevice, out _))
                {
                    continue;
                }
                IOConnectionInfo dbIoc;
                if (KeeAutoExecExt.TryGetDatabaseIoc(autoOpenItem, out dbIoc) &&
                    App.Kp2a.TryGetDatabase(dbIoc) == null &&
                    App.Kp2a.AttemptedToOpenBefore(dbIoc) == false
                    )
                {
                    if (KeeAutoExecExt.AutoOpenEntry(this, autoOpenItem, false))
                    {
                        LaunchingOther = true;
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #2
0
 public void Update()
 {
     _displayedChildDatabases = KeeAutoExecExt.GetAutoExecItems(App.Kp2a.CurrentDb.KpDatabase)
                                .Where(e => App.Kp2a.TryFindDatabaseForElement(e.Entry) != null) //Update() can be called while we're adding entries to the database. They may be part of the group but without saving complete
                                .OrderBy(e => SprEngine.Compile(e.Entry.Strings.ReadSafe(PwDefs.TitleField), new SprContext(e.Entry, App.Kp2a.FindDatabaseForElement(e.Entry).KpDatabase, SprCompileFlags.All)))
                                .ThenByDescending(e => e.Entry.LastModificationTime)
                                .ToList();
 }
Exemple #3
0
            public void Update()
            {
                string thisDevice = KeeAutoExecExt.ThisDeviceId;

                _displayedDatabases = App.Kp2a.OpenDatabases.ToList();
                _autoExecItems      = App.Kp2a.OpenDatabases
                                      .SelectMany(db => KeeAutoExecExt.GetAutoExecItems(db.KpDatabase))
                                      .Where(item =>
                                             item.Visible
                                             &&
                                             KeeAutoExecExt.IsDeviceEnabled(item, thisDevice, out _)
                                             &&
                                             !_displayedDatabases.Any(displayedDb =>
                {
                    IOConnectionInfo itemIoc;
                    return(KeeAutoExecExt.TryGetDatabaseIoc(item, out itemIoc) &&
                           displayedDb.Ioc.IsSameFileAs(itemIoc));
                }))
                                      .ToList();
            }
        private bool OpenAutoExecEntries(Database db)
        {
            try
            {
                string thisDevice = KeeAutoExecExt.ThisDeviceId;
                foreach (var autoOpenItem in KeeAutoExecExt.GetAutoExecItems(db.KpDatabase))
                {
                    if (!autoOpenItem.Enabled)
                    {
                        continue;
                    }
                    if (!KeeAutoExecExt.IsDeviceEnabled(autoOpenItem, thisDevice, out _))
                    {
                        continue;
                    }
                    if (!IsValidIoc(autoOpenItem))
                    {
                        continue;
                    }

                    IOConnectionInfo dbIoc;
                    if (KeeAutoExecExt.TryGetDatabaseIoc(autoOpenItem, out dbIoc) &&
                        App.Kp2a.TryGetDatabase(dbIoc) == null &&
                        App.Kp2a.AttemptedToOpenBefore(dbIoc) == false
                        )
                    {
                        if (KeeAutoExecExt.AutoOpenEntry(this, autoOpenItem, false, new ActivityLaunchModeRequestCode(ReqCodeOpenNewDb)))
                        {
                            LaunchingOther = true;
                            return(true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Kp2aLog.LogUnexpectedError(e);
            }

            return(false);
        }