public NotebookList() { InitializeComponent(); NeedSaveSelectedNotebook = true; _notebookSource = NotebookListCache.GetNotebookCollection(); lbNotebook.ItemsSource = _notebookSource; }
private void appbarBtnSave_Click(object sender, EventArgs e) { try { buildNoteEntity(); Task.Factory.StartNew(() => { try { NoteDao.Inst.AddIfNotExist(_noteEntity); ViewNoteView.NoteEntity = _noteEntity; Dispatcher.BeginInvoke(() => { var notebookEntity = NotebookListCache.Find(_noteEntity.NotebookPath); if (null != notebookEntity) { Util.SaveLastSelectedNotebook(notebookEntity); Debug.WriteLine("已保存选中的笔记本:" + notebookEntity.Name); } NavigationService.Navigate(new Uri("/Views/ViewNoteView.xaml?from=NewNotePage", UriKind.Relative)); }); } catch (Exception ex1) { LoggerFactory.GetLogger().Error("保存笔记失败", ex1); Toast.Prompt("额,保存笔记失败,请稍后重试!"); } }); } catch (Exception ex) { LoggerFactory.GetLogger().Error("保存笔记失败", ex); Toast.Prompt("额,保存笔记失败,请稍后再试!"); } }
private static void clearNotebooks() { NotebookListCache.Clear(); NotebookDao.Inst.Clear(); }