private void LoadBookmarks(Book selectedBook) { _dbService.LoadBookmarks(selectedBook); // update filterable collection view source Bookmarks.Clear(); foreach (var bookmark in selectedBook.Bookmarks) { Bookmarks.Add(bookmark); } }
public void InitBlank() { LastModified.Reset(); Locations.Clear(); Notes.Clear(); Tags.Clear(); TagMaps.Clear(); BlockRanges.Clear(); Bookmarks.Clear(); UserMarks.Clear(); }
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 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 bool moveBlockDown(bool figureIsMarked) { if (rangeOk && figureIsMarked) { string key = ""; if (type == xmlMarkerType.Figure) { key = xmlMarker.figureEnd; } else if (type == xmlMarkerType.Group) { key = xmlMarker.groupEnd; } int newPos = -1; if (key.Length > 1) { newPos = findDown(key, end + 1) + 1; // find next xmlEnd marker } if (newPos >= end) { if (gcode.loggerTrace) { Logger.Trace(" moveBlockDown Start {0} {1}", newPos, fCTB.Lines[newPos]); } Bookmarks tmp = new Bookmarks(fCTB); tmp.Clear(); fCTB.Copy(); Range oldSelection = fCTB.Selection.Clone(); Place selStart; selStart.iLine = newPos; selStart.iChar = 0; Range mySelection = new Range(fCTB); mySelection.Start = mySelection.End = selStart; fCTB.Selection = mySelection; fCTB.Paste(); // insert code at new position fCTB.InsertText("\r\n"); fCTB.Selection = oldSelection; fCTB.Cut(); List <int> remove = new List <int>(); remove.Add(start); fCTB.RemoveLines(remove); // remove empty line after cut return(true); } } return(false); }
public void ClearArticleAttributes(object input = null) { try { Article.Clear(); SelectedFile = null; Bookmarks.Clear(); References.Clear(); } catch (Exception e) { new BugTracker().Track("Data Entry", "Clear Article Attributes", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } }
/// <summary> /// Reset the view model to those options that are going to be presented for editing. /// </summary> /// <param name="settingData"></param> public override void ApplyOptionsFromModel(IEngine optionsEngine) { var group = optionsEngine.GetOptionGroup("Options"); Bookmarks.Clear(); EditBookmarksViewModel.LoadOptionsFromModel(group, Bookmarks); if (Bookmarks.Count > 0) { BookmarkSelected = Bookmarks[0]; } // Construct bookmark collection and folder browser viewmodels BookmarkedLocations = this.ConstructBookmarks(); DropDownBrowser = InitializeDropDownBrowser(BookmarkSelected); }
private void moveSelectedCodeBlockDownToolStripMenuItem_Click(object sender, EventArgs e) { int start = visuGCode.getLineOfFirstPointInFigure(); int end = visuGCode.getLineOfEndPointInFigure(start + 1); fCTBCode.UnbookmarkLine(fCTBCodeClickedLineLast); start = visuGCode.getLineOfFirstPointInFigure(end + 2); if (start <= 0) { return; } end = visuGCode.getLineOfEndPointInFigure(start + 1); if (start <= 0) { return; } if ((end > 0) && figureIsMarked) { fCTBBookmark = null; Bookmarks tmp = new Bookmarks(fCTBCode); tmp.Clear(); fCTBCode.Copy(); Range oldSelection = fCTBCode.Selection.Clone(); Place selStart, selEnd; selStart.iLine = end; selStart.iChar = 0; Range mySelection = fCTBCode.Range; mySelection.Start = selStart; selEnd.iLine = end; selEnd.iChar = 0; mySelection.End = selEnd; fCTBCode.Selection = mySelection; fCTBCode.Paste(); fCTBCode.Selection = oldSelection; fCTBCode.Cut(); transformEnd(); if (foldLevel > 0) { foldBlocks2ndToolStripMenuItem1_Click(sender, e); } newCodeEnd(); } setFigureIsMarked(false); }
public static bool moveBlockUp(bool figureIsMarked) { if (rangeOk && figureIsMarked) { string key = ""; if (type == xmlMarkerType.Figure) { key = xmlMarker.figureStart; } else if (type == xmlMarkerType.Group) { key = xmlMarker.groupStart; } int newPos = -1; if (key.Length > 1) { newPos = findUp(key, start - 1); // find previous xmlStart marker } if (newPos >= 0) { if (gcode.loggerTrace) { Logger.Trace("moveBlockUp Start {0} {1}", newPos, fCTB.Lines[newPos]); } Bookmarks tmp = new Bookmarks(fCTB); tmp.Clear(); fCTB.Cut(); List <int> remove = new List <int>(); remove.Add(start); fCTB.RemoveLines(remove); // remove empty line after cut Place selStart; selStart.iLine = newPos; selStart.iChar = 0; Range mySelection = new Range(fCTB); // fCTBCode.Range; mySelection.Start = mySelection.End = selStart; fCTB.Selection = mySelection; fCTB.Paste(); fCTB.InsertText("\r\n"); return(true); } } return(false); }
async Task ExecuteRefreshCommandAsync() { var result = await StoreManager.BookmarksService.GetBookmarksAsync(pageIndex, pageSize); if (result.Success) { var articles = JsonConvert.DeserializeObject <List <Bookmarks> >(result.Message.ToString()); if (articles.Count > 0) { if (pageIndex == 1 && Bookmarks.Count > 0) { Bookmarks.Clear(); } Bookmarks.AddRange(articles); pageIndex++; if (Bookmarks.Count >= pageSize) { LoadStatus = LoadMoreStatus.StausDefault; CanLoadMore = true; } else { LoadStatus = LoadMoreStatus.StausEnd; CanLoadMore = false; } } else { CanLoadMore = false; LoadStatus = pageIndex > 1 ? LoadMoreStatus.StausEnd : LoadMoreStatus.StausNodata; } } else { Crashes.TrackError(new Exception() { Source = result.Message }); LoadStatus = pageIndex > 1 ? LoadMoreStatus.StausEnd : LoadMoreStatus.StausNodata; } }
public async void SaveArticle(object input = null) { try { _workingStatus(true); await Task.Run(() => { ArticleRepo articleRepo = new ArticleRepo(); // Regex to switch multiple spaces into one (Restricts user to enter more than one space in Title textboxes) RegexOptions options = RegexOptions.None; Regex regex = new Regex("[ ]{2,}", options); // 1. Format title Article.Title = Article.Title.Trim(); Article.Title = regex.Replace(Article.Title, " "); // 2. Add article to database articleRepo.SaveArticle(Article, User); // 3. Copy selected file to root folder with the new ID-based name File.Copy(SelectedFile, Path.Combine(Environment.CurrentDirectory, "Files\\") + Article.FileName + ".pdf"); // 4.1 Retrieve id (in reality we retrieve whole article) of newly added article Article currently_added_article = articleRepo.GetArticleWithTitle(Article.Title); // 4.2 Add bookmarks foreach (Bookmark bookmark in Bookmarks) { new BookmarkRepo().AddArticleToBookmark(bookmark, currently_added_article); } // 4.3 Add references foreach (Reference reference in References) { new ReferenceRepo().AddArticleToReference(reference, currently_added_article); } // 4.4 Tracking ArticleInfo info = new ArticleInfo(User, Article.Title, Bookmarks, References); Tracker tracker = new Tracker(User); tracker.TrackCreate <ArticleInfo>(info); File.Copy(SelectedFile, tracker.GetFilesPath() + "\\" + Article.FileName + ".pdf"); // 6. Move the selected file into "Done" subfolder string done_path = Path.GetDirectoryName(SelectedFile) + "\\Done\\"; Directory.CreateDirectory(Path.GetDirectoryName(SelectedFile) + "\\Done"); File.Move(SelectedFile, done_path + System.IO.Path.GetFileName(SelectedFile)); }); // 5. Clear article attributes ClearArticleAttributesCommand.Execute(null); Bookmarks.Clear(); References.Clear(); _workingStatus(false); } catch (Exception e) { new BugTracker().Track("Data Entry", "Add article", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } finally { _workingStatus(false); } }
public void Delete() { Bookmarks.Clear(); }
/// <summary> /// <inheritdoc/> /// </summary> public void DocumentClosing() { Bookmarks.Clear(); InvokePropertyChangedEvent(nameof(Bookmarks)); }
/// <summary> /// <inheritdoc/> /// </summary> public void DocumentOpening(string file) { Bookmarks.Clear(); InvokePropertyChangedEvent(nameof(Bookmarks)); }