コード例 #1
0
ファイル: FavoritesPlugin.cs プロジェクト: mo5h/omeo
        private void WeblinkOrFolderChanged(object sender, ResourcePropIndexEventArgs e)
        {
            IResource webLink = e.Resource;

            IPropertyChangeSet set = e.ChangeSet;
            int propLastModified   = Core.ResourceStore.PropTypes["LastModified"].Id;

            if (BookmarkService.DownloadMethod != 2 && webLink == _lastDisplayedWeblink &&
                ((set.IsPropertyChanged(propLastModified) && webLink.HasProp("Source")) ||
                 (set.IsPropertyChanged(Core.Props.LastError) && webLink.HasProp(Core.Props.LastError))))
            {
                // if the displayed web link has changed, redisplay it
                IResourceBrowser browser = Core.ResourceBrowser;
                if ((webLink == _favoritesTreePane.SelectedNode && Core.TabManager.CurrentTabId == "Web") ||
                    (browser.SelectedResources.Count == 1 && webLink == browser.SelectedResources[0]))
                {
                    Core.UserInterfaceAP.QueueJobAt(DateTime.Now.AddSeconds(1), "RedisplaySelectedResource", browser.RedisplaySelectedResource);
                }
            }

            string URL = webLink.GetPropText(_propURL);

            if (URL.Length > 0)
            {
                if (set.IsPropertyChanged(_propLastUpdated) || set.IsPropertyChanged(_propUpdateFreq))
                {
                    BookmarkService.QueueWeblink(webLink, URL, BookmarkService.BookmarkSynchronizationTime(webLink));
                }
                if (set.IsPropertyChanged(_propURL))
                {
                    BookmarkService.ImmediateQueueWeblink(webLink, URL);
                }
            }
            if (set.IsPropertyChanged(Core.PropIds.Name) || set.IsPropertyChanged(_propURL))
            {
                IBookmarkProfile profile = _bookmarkService.GetOwnerProfile(webLink);
                string           error;
                if (profile != null && profile.CanCreate(webLink, out error))
                {
                    profile.Create(webLink);
                }
            }
        }