public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create bookmarks Bookmarks bookmarks = new Bookmarks(); Bookmark childBookmark1 = new Bookmark(); childBookmark1.PageNumber = 1; childBookmark1.Title = "First Child"; Bookmark childBookmark2 = new Bookmark(); childBookmark2.PageNumber = 2; childBookmark2.Title = "Second Child"; bookmarks.Add(childBookmark1); bookmarks.Add(childBookmark2); Bookmark bookmark = new Bookmark(); bookmark.Action = "GoTo"; bookmark.PageNumber = 1; bookmark.Title = "Parent"; bookmark.ChildItems = bookmarks; //create PdfBookmarkEditor class PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor(); //bind PDF document bookmarkEditor.BindPdf(dataDir+ "input.pdf"); //create bookmarks bookmarkEditor.CreateBookmarks(bookmark); //save updated document bookmarkEditor.Save(dataDir+ "output.pdf"); }
private void ConfirmButton_Click(object sender, RoutedEventArgs e) { if (NameText == null) { return; } var bookmark = new BookmarkNode { IsFolder = false, Name = NameText, URL = AppCore.CurrentURL, Children = new ObservableCollection <BookmarkNode>() }; var parent = Tree.SelectedItem; if (parent == null) { Bookmarks.Add(bookmark); } else { ((BookmarkNode)parent).Children.Add(bookmark); } WriteBookmarks(); }
protected Guid InternalGetBookmark() { Guid result = Guid.NewGuid(); _bookmarks.Add(result, _sourceTable.GetBookmark()); return(result); }
public BookmarksViewModel() { _storage = new BookmarksStorage(); foreach (var bookmark in _storage.Bookmarks) { var viewModel = new BookmarkViewModel(bookmark); viewModel.Deleting += OnBookmarkDeleting; viewModel.Editing += OnBookmarkEditing; Bookmarks.Add(viewModel); } AddBookmarkCommand = new RelayCommand(arg => { var bookmarkViewModel = (BookmarkViewModel)arg; bookmarkViewModel.Deleting += OnBookmarkDeleting; bookmarkViewModel.Editing += OnBookmarkEditing; _storage.Add(bookmarkViewModel.Bookmark); Bookmarks.Add(bookmarkViewModel); }); }
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)); }
/// <summary> /// Creates a new instance of <see cref="BookmarkManagerMemento" /> /// </summary> public BookmarkManagerMemento(XmlElement element) { foreach (XmlElement el in element.ChildNodes) { Bookmarks.Add(int.Parse(el.Attributes["line"].InnerText)); } }
private void Bookmark() { if (SelectedCity != null) { bool removed = false; foreach (Bookmark b in Bookmarks) { if (b.City.id == SelectedCity.id) { Bookmarks.Remove(b); OnPropertyChanged("Bookmarks"); removed = true; CheckBookmarkIcon(); break; } } if (!removed) { Bookmarks.Add(new Bookmark(SelectedCity)); CheckBookmarkIcon(); OnPropertyChanged("Bookmarks"); } } }
private void AddBookmark() { if (Bookmarks == null) { Bookmarks = new ObservableCollection <Bookmark>(); } Bookmarks.Add(new Bookmark(InFolder)); OnPropertyChanged("Bookmarks"); MessageBox.Show("New Bookmark at path = " + Path); }
internal void AddBookmark(ulong address, ClrType clrType) { if (dicoBookmarks != null && !dicoBookmarks.ContainsKey(address)) { var bookmark = new Bookmark(address, clrType.Name); dicoBookmarks[address] = bookmark; Bookmarks.Add(bookmark); Save(); } }
private async Task LoadBookmarkList() { Bookmarks.Clear(); var lastPage = SettingsUtils.Get <int>(Constants.PREF_LAST_PAGE); if (lastPage > 0) { var lastPageItem = new ItemViewModel(); lastPageItem.Title = QuranUtils.GetSurahNameFromPage(lastPage, true); lastPageItem.Details = string.Format("{0} {1}, {2} {3}", Resources.quran_page, lastPage, QuranUtils.GetJuzTitle(), QuranUtils.GetJuzFromPage(lastPage)); lastPageItem.PageNumber = lastPage; lastPageItem.Image = new BitmapImage(new Uri("ms-appx:///Assets/Images/favorite.png")); lastPageItem.ItemType = ItemViewModelType.Bookmark; lastPageItem.Group = Resources.bookmarks_current_page; lastPageItem.Id = lastPageItem.Group; Bookmarks.Add(lastPageItem); } using (var bookmarksAdapter = new BookmarksDatabaseHandler()) { try { var bookmarks = bookmarksAdapter.GetBookmarks(true, BoomarkSortOrder.Location); if (bookmarks.Count > 0) { //Load untagged first foreach (var bookmark in bookmarks) { if (bookmark.Tags == null) { Bookmarks.Add(await CreateBookmarkModel(bookmark)); } } //Load tagged foreach (var bookmark in bookmarks) { if (bookmark.Tags != null) { Bookmarks.Add(await CreateBookmarkModel(bookmark)); } } } } catch (Exception ex) { telemetry.TrackException(ex, new Dictionary <string, string> { { "Scenario", "LoadingBookmarks" } }); QuranApp.NativeProvider.Log("failed to load bookmarks: " + ex.Message); } } }
public void AddBookmark(string id, int bookmarkStyleIndex) { if (Bookmarks.ContainsKey(id)) { Bookmarks.Remove(id); } Bookmarks.Add(id, bookmarkStyleIndex); NotifyOfPropertyChange("BookmarksAvailable"); }
private void LoadBookmarks(Book selectedBook) { _dbService.LoadBookmarks(selectedBook); // update filterable collection view source Bookmarks.Clear(); foreach (var bookmark in selectedBook.Bookmarks) { Bookmarks.Add(bookmark); } }
private void LoadBookmarks(Book selectedBook) { _dbService.LoadBookmarks(selectedBook); // update filterable collection view source Bookmarks.Clear(); foreach (var bookmark in selectedBook.Bookmarks) { Bookmarks.Add(bookmark); } _logger.Info($"{selectedBook.Title}: Loaded {selectedBook.Bookmarks.Count} bookmarks"); }
public AddBookmarkStatus AddBookmark(Bookmark bookmark) { if (!IsBookmarked(bookmark.SeriesUri)) { Bookmarks.Add(bookmark); return(AddBookmarkStatus.Success); } else { return(AddBookmarkStatus.Duplicate); } }
public TemplateDocumentIssuingIndividualPaymentOrder(string wordSaveAs, string firstName, string lastName, string jik, string price, string Date, bool alsoCreatePdf, string pdfSaveDocumentAsFullPath) : base() { //napravljen je prazan template dokument objekat //ovde sada treba da se definisu podaci kao sto su putanja dokumenta, na osnovu kog template-a je napravljen, lista bukmarka FullName = wordSaveAs; Template.FullName = pdfSaveDocumentAsFullPath; Bookmarks.Add(new Bookmark(@"Payer", firstName + " " + lastName)); Bookmarks.Add(new Bookmark(@"Date", Date)); Bookmarks.Add(new Bookmark(@"RequestNo", jik)); Bookmarks.Add(new Bookmark(@"Price", price)); Bookmarks.Add(new Bookmark(@"RequestNo1", jik)); }
public async Task ApplyFilters() { Bookmarks.Clear(); var filtered = _bookmarksSource .Where(FilterByLastActive) .Where(FilterByName); foreach (var b in filtered) { await Task.Delay(10).ConfigureAwait(false); Bookmarks.Add(b); } }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create bookmarks Bookmarks bookmarks = new Bookmarks(); Bookmark childBookmark1 = new Bookmark(); childBookmark1.PageNumber = 1; childBookmark1.Title = "First Child"; Bookmark childBookmark2 = new Bookmark(); childBookmark2.PageNumber = 2; childBookmark2.Title = "Second Child"; bookmarks.Add(childBookmark1); bookmarks.Add(childBookmark2); Bookmark bookmark = new Bookmark(); bookmark.Action = "GoTo"; bookmark.PageNumber = 1; bookmark.Title = "Parent"; bookmark.ChildItems = bookmarks; //create PdfBookmarkEditor class PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor(); //bind PDF document bookmarkEditor.BindPdf(dataDir + "input.pdf"); //create bookmarks bookmarkEditor.CreateBookmarks(bookmark); //save updated document bookmarkEditor.Save(dataDir + "output.pdf"); }
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)); }
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)); }
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)); }
private async void CreateNewFolder() { var dialog = new TextInputDialog(LocalizationHelper.Localize("Folder name")); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { var bookmark = new BookmarkNode { IsFolder = true, Name = dialog.Text, Children = new ObservableCollection <BookmarkNode>() }; Bookmarks.Add(bookmark); WriteBookmarks(); } }
/// <summary> /// Builds bookmark object. /// </summary> public void Build() { if (_mainComponent.PDFiumBridge == null || !_mainComponent.PDFiumDocument.IsValid) { return; } var childBookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetFirstChild(_mainComponent.PDFiumDocument, _bookmarkHandle); while (childBookmarkHandle.IsValid) { var newBookmark = new PDFBookmark(_mainComponent, childBookmarkHandle); newBookmark.Build(); Bookmarks.Add(newBookmark); childBookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetNextSibling(_mainComponent.PDFiumDocument, childBookmarkHandle); } }
public BookmarksStorage() { if (!File.Exists(Path)) { return; } var content = File.ReadAllText(Path); var bookmarks = JsonConvert.DeserializeObject <Bookmark[]>(content) ?? new Bookmark[0]; foreach (var bookmark in bookmarks) { Bookmarks.Add(bookmark); } }
public async Task BookmarksSearch(string filter) { IsBusy = true; IEnumerable <Bookmark> bookmarks = await bookmarkService.Search(filter); while (Bookmarks.Any()) { Bookmarks.RemoveAt(Bookmarks.Count - 1); } foreach (Bookmark f in bookmarks) { Bookmarks.Add(f); } IsBusy = false; OnPropertyChanged("SelectedMenuItem"); OnPropertyChanged("Bookmarks"); }
public TemplateDocumentIssuingIndividual(string wordSaveAs, string firstName, string lastName, string jmbg, string jik, string email, string street, string streetNo, string postNo, string place, string phone, bool alsoCreatePdf, string pdfSaveDocumentAsFullPath) : base() { //napravljen je prazan template dokument objekat //ovde sada treba da se definisu podaci kao sto su putanja dokumenta, na osnovu kog template-a je napravljen, lista bukmarka FullName = wordSaveAs; Template.FullName = pdfSaveDocumentAsFullPath; Bookmarks.Add(new Bookmark(@"FirstName", firstName)); Bookmarks.Add(new Bookmark(@"LastName", lastName)); Bookmarks.Add(new Bookmark(@"Jmbg", jmbg)); Bookmarks.Add(new Bookmark(@"Jik", jik)); Bookmarks.Add(new Bookmark(@"Email", email)); Bookmarks.Add(new Bookmark(@"Street", street)); Bookmarks.Add(new Bookmark(@"StreetNo", streetNo)); Bookmarks.Add(new Bookmark(@"PostNo", postNo)); Bookmarks.Add(new Bookmark(@"Place", place)); Bookmarks.Add(new Bookmark(@"Phone", phone)); }
/// <summary> /// <inheritdoc/> /// </summary> public void DocumentOpened(string file) { if (_mainComponent.PDFiumBridge == null || !_mainComponent.PDFiumDocument.IsValid) { return; } var bookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetFirstChild(_mainComponent.PDFiumDocument, FPDF_BOOKMARK.InvalidHandle); while (bookmarkHandle.IsValid) { var newBookmark = new PDFBookmark(_mainComponent, bookmarkHandle); newBookmark.Build(); Bookmarks.Add(newBookmark); bookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetNextSibling(_mainComponent.PDFiumDocument, bookmarkHandle); } InvokePropertyChangedEvent(nameof(Bookmarks)); }
private async Task Populate(bool global) { List <Bookmark> bookmarks = new List <Bookmark>(); BookmarkRepo repo = new BookmarkRepo(); if (global) { await Task.Run(() => { // 3. Populate global bookmarks foreach (Bookmark bookmark in (new BookmarkRepo()).LoadGlobalBookmarks()) { //bookmark.PopulateArticles(User); bookmark.GetArticleCount(User); bookmarks.Add(bookmark); } }); foreach (Bookmark bookmark in bookmarks) { GlobalBookmarks.Add(bookmark); } } else { await Task.Run(() => { // 2. Populate local bookmarks foreach (Bookmark bookmark in repo.LoadBookmarks(User)) { // Populate articles colletion for each bookmark //bookmark.PopulateArticles(User); bookmark.GetArticleCount(User); bookmarks.Add(bookmark); } }); foreach (Bookmark bookmark in bookmarks) { Bookmarks.Add(bookmark); } } }
public void Insert(ref string word, Bookmark bookmark) { if (word.Length < 2) { Bookmarks.Add(bookmark); return; } word = word.Substring(1); foreach (TrieNode n in Children) { if (n.Match(word)) { n.Insert(ref word, bookmark); return; } } Children.Add(new TrieNode(this, ref word, bookmark)); }
public void AddBookmark(int line, int key) { // Если уже есть на текущей линнии с таким же ключлм, то удаляем совсем и выходим if (Bookmarks.RemoveAll(b => b.Line == line && b.Key == key) > 0) { } else { // Если уже есть на текущей линни, удалим его Bookmarks.RemoveAll(b => b.Line == line); // Удалим все с текущим ключом Bookmarks.RemoveAll(b => b.Key == key); Bookmark bookmark = new Bookmark(this, line, key, ""); Bookmarks.Add(bookmark); } IsChanged = true; OnBookmarksChanged(); }
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)); }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { PropertyDescriptor property = context.DataContext.GetProperties()[WordCreate.GetWordAppTag]; Application wordApp = property.GetValue(context.DataContext) as Application; try { string linkName = LinkName.Get(context); string linkMark = LinkMark.Get(context); string linkAddr = LinkAddr.Get(context); string bookMark = BookMark.Get(context); string pic = Pic.Get(context); if (linkName != null) { Hyperlinks links = wordApp.Selection.Hyperlinks; links.Add(wordApp.Selection.Range, linkAddr, linkMark, "", linkName, linkMark); } if (bookMark != null) { Bookmarks bookmarks = wordApp.Selection.Bookmarks; bookmarks.Add(bookMark); } if (pic != null) { InlineShapes lineshapes = wordApp.Selection.InlineShapes; InlineShape lineshape = lineshapes.AddPicture(pic); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "Word执行过程出错", e.Message); CommonVariable.realaseProcessExit(wordApp); } m_Delegate = new runDelegate(Run); return(m_Delegate.BeginInvoke(callback, state)); }
private static Bookmarks CreateBookmarks(string bookmarkDescription, string url, string keyword) { var bookmarks = new Bookmarks(); if (!string.IsNullOrEmpty(bookmarkDescription)) bookmarks.Add(new Bookmark(bookmarkDescription, url, icon)); if (!string.IsNullOrEmpty(keyword)) bookmarks.Add(new Bookmark(keyword, url, icon)); return bookmarks; }