コード例 #1
0
        public NotebookList()
        {
            InitializeComponent();

            NeedSaveSelectedNotebook = true;

            _notebookSource        = NotebookListCache.GetNotebookCollection();
            lbNotebook.ItemsSource = _notebookSource;
        }
コード例 #2
0
        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("额,保存笔记失败,请稍后再试!");
            }
        }
コード例 #3
0
 private static void clearNotebooks()
 {
     NotebookListCache.Clear();
     NotebookDao.Inst.Clear();
 }