예제 #1
0
        public void CopyBookmark(string sourcePath, string targetPath)
        {
            if (sourcePath.Equals(targetPath, StringComparison.InvariantCulture))
            {
                return;
            }

            BookmarkNode sourceBookmark;

            if (!Bookmarks.TryGetValue(sourcePath, out sourceBookmark))
            {
                return;
            }

            RegisterPath(targetPath);

            string       value    = sourceBookmark.Value;
            string       fullPath = string.IsNullOrEmpty(targetPath) ? value : string.Format(CultureInfo.InvariantCulture, "{0}/{1}", targetPath, value);
            BookmarkNode bookmark = new BookmarkNode();

            bookmark.Path  = fullPath;
            bookmark.Value = sourceBookmark.Value;
            bookmark.Text  = sourceBookmark.Text;

            Bookmarks.Add(fullPath, bookmark);

            OnItemAdded(new BookmarkItemChangeEventArgs(fullPath, bookmark));
        }
예제 #2
0
        public void AddLibraryBookmark(int pageIndex, string path)
        {
            RegisterPath(path);

            string       value    = string.Format(CultureInfo.InvariantCulture, "library:{0}", pageIndex);
            string       fullPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", path, value);
            BookmarkNode bookmark = new BookmarkNode();

            bookmark.Path  = fullPath;
            bookmark.Value = value;
            bookmark.Text  = BookmarkFormatter.GetLibraryText(pageIndex);

            Bookmarks.Add(fullPath, bookmark);

            OnItemAdded(new BookmarkItemChangeEventArgs(fullPath, bookmark));
        }
예제 #3
0
        public void AddQueryBookmark(string query, int pageIndex, string path)
        {
            RegisterPath(path);

            string       value    = string.Format(CultureInfo.InvariantCulture, "search:{0}:{1}", query, pageIndex);
            string       fullPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", path, value);
            BookmarkNode bookmark = new BookmarkNode();

            bookmark.Path  = fullPath;
            bookmark.Value = value;
            bookmark.Text  = BookmarkFormatter.GetQuerySearchText(query, pageIndex);

            Bookmarks.Add(fullPath, bookmark);

            OnItemAdded(new BookmarkItemChangeEventArgs(fullPath, bookmark));
        }
예제 #4
0
        public void AddTaggedBookmark(int tagId, int pageIndex, string path)
        {
            RegisterPath(path);

            string       value    = string.Format(CultureInfo.InvariantCulture, "tag:{0}:{1}", tagId, pageIndex);
            string       fullPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", path, value);
            BookmarkNode bookmark = new BookmarkNode();

            bookmark.Path  = fullPath;
            bookmark.Value = value;
            bookmark.Text  = BookmarkFormatter.GetTaggedSearchText(tagId, pageIndex);

            Bookmarks.Add(fullPath, bookmark);

            OnItemAdded(new BookmarkItemChangeEventArgs(fullPath, bookmark));
        }
예제 #5
0
        public void AddDownloadBookmark(Metadata metadata, string path)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException("metadata");
            }

            RegisterPath(path);

            string       value    = string.Format(CultureInfo.InvariantCulture, "download:{0}", metadata.Id);
            string       fullPath = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", path, value);
            BookmarkNode bookmark = new BookmarkNode();

            bookmark.Path  = fullPath;
            bookmark.Value = value;
            bookmark.Text  = BookmarkFormatter.GetDownloadText(metadata);

            Bookmarks.Add(fullPath, bookmark);

            OnItemAdded(new BookmarkItemChangeEventArgs(fullPath, bookmark));
        }
예제 #6
0
 public AddBookmarkItemTask(string path, BookmarkNode item)
 {
     Path = path;
     Item = item;
 }
예제 #7
0
 public BookmarkItemChangeEventArgs(string path, BookmarkNode value)
 {
     Path  = path;
     Value = value;
 }