private static void notebookCreated(NotebookEntity obj) { lock (SyncObj) { NotebookCollection.Add(obj); } }
private void getNoteCollectionAndPopulateListUsingTimer(NotebookEntity notebookEntity) { Debug.WriteLine("getNoteCollectionAndPopulateListUsingTimer tid:{0}", Thread.CurrentThread.ManagedThreadId); NoteListControl.ItemsSource.Clear(); var notes = NoteListCache.GetNoteCollection(notebookEntity.Path); populateListUsingTimer(notes); }
private void SetNotebookForeColor(NotebookEntity entity, Color foreColor) { if (null == entity) { return; } entity.ForeColor = foreColor; }
internal static void SaveLastSelectedNotebook(NotebookEntity notebookEntity) { if (System.ComponentModel.DesignerProperties.IsInDesignTool) { return; } IsolatedStorageSettings.ApplicationSettings[ConstantPool.LastSelectedNotebookKey] = notebookEntity; IsolatedStorageSettings.ApplicationSettings.Save(); }
void NotebookList_NotebookTapped() { _notebookPath = NotebookList.SelectedNotebook.Path; Notebook = NotebookList.SelectedNotebook; if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }
private void RestoreState() { if (State.ContainsKey("_notebookPath")) { _notebookPath = (string)State["_notebookPath"]; } if (State.ContainsKey("Notebook")) { Notebook = (NotebookEntity)State["Notebook"]; } }
public void UpdateBind(NotebookEntity notebookEntity) { Debug.WriteLine("UpdateBind occured,tid:{0}", Thread.CurrentThread.ManagedThreadId); if (null == notebookEntity) { Debug.WriteLine("NoteList.xaml.cs::UpdateBind notebookEntity 为空"); return; } _currentNotebookEntity = notebookEntity; bindNoteList(_currentNotebookEntity); }
private static void notebookModified(NotebookEntity obj) { lock (SyncObj) { var findNotebook = NotebookCollection.FirstOrDefault(nb => nb.Id == obj.Id); if (null == findNotebook) { return; } NotebookCollection.Remove(findNotebook); NotebookCollection.Add(obj); } }
static void NotebookListCache_NotebookCreated(NotebookEntity obj) { Debug.WriteLine("NotebookListCache::笔记本创建事件触发"); Debug.Assert(obj != null); if (!Deployment.Current.Dispatcher.CheckAccess()) { Deployment.Current.Dispatcher.BeginInvoke(() => { notebookCreated(obj); }); } else { notebookCreated(obj); } }
private void bindNoteList(NotebookEntity notebookEntity) { if (null == notebookEntity) { return; } if (!Deployment.Current.Dispatcher.CheckAccess()) { Deployment.Current.Dispatcher.BeginInvoke(() => { getNoteCollectionAndPopulateListUsingTimer(notebookEntity); }); } else { getNoteCollectionAndPopulateListUsingTimer(notebookEntity); } }
public void SetSelectedNotebook(NotebookEntity notebookEntity) { if (null == notebookEntity) { lbNotebook.SelectedItem = null; Debug.WriteLine("NotebookList.xaml.cs::SetSelectedNotebook notebookEntity 为空"); return; } var findNotebook = _notebookSource.FirstOrDefault(entity => entity.Path.Equals(notebookEntity.Path)); if (null == findNotebook) { LoggerFactory.GetLogger().Warn("NotebookList.xaml.cs::SetSelectedNotebook 未能找到笔记名称为:" + notebookEntity.Name + " 的笔记实例"); return; } lbNotebook.SelectedItem = findNotebook; //lbNotebook_SelectionChanged(null, null); }
public async Task <JsonResult> NewNotebookAsync(string notebookName) { if (String.IsNullOrEmpty(notebookName)) { throw new ArgumentNullException("[notebookName] is null or empty."); } var userId = userManager.GetUserId(this.User); var entity = new NotebookEntity() { Id = Guid.NewGuid(), UserId = new Guid(userId), Name = notebookName, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow }; var result = await notebookRepository.AddAsync(entity); return(Json(new { success = true, responseText = result.Id.ToString() })); }
private NotebookViewModel MapNotebookEntityToNotebookViewModel(NotebookEntity entity, Guid?selectedPage = null) { var pages = new List <PageViewModel>(); if (entity.Pages != null && entity.Pages.Count() > 0) { foreach (var pageEntity in entity.Pages) { pages.Add(MapPageEntityToPageViewModel(pageEntity)); } } var vm = new NotebookViewModel { Id = entity.Id, Name = entity.Name, Pages = pages, SelectedPage = selectedPage ?? pages.FirstOrDefault()?.Id }; return(vm); }
private void NotebookList_Loaded(object sender, RoutedEventArgs e) { Notebook = NotebookList.FindNotebookEntity(_notebookPath); NotebookList.SetSelectedNotebook(Notebook); }