private void appbarBtnSave_Click(object sender, EventArgs e)
        {
            Debug.Assert(null != NoteEntity);

            using (new WaitPopup("正在保存笔记", this))
            {
                try
                {
                    NoteEntity.Title      = tbTitle.Text;
                    NoteEntity.ModifyTime = DateUtils.ConvertFromLocalDateTimeToSeconds(DateTime.Now);
                    NoteEntity.Content    = rtbContent.GetHtml();
                    if (NoteEntity.NoteStatus != NoteStatus.Added)
                    {
                        NoteEntity.NoteStatus = NoteStatus.Modified;
                    }

                    NoteDao.Inst.ModifyIfExist(NoteEntity);

                    Toast.Prompt("保存笔记成功");

                    gotoViewNotePage();
                }
                catch (Exception ex)
                {
                    LoggerFactory.GetLogger().Error("保存笔记失败", ex);
                    Toast.Prompt("额,保存笔记失败,请稍后重试!");
                }
            }
        }
Beispiel #2
0
        private void buildNoteEntity()
        {
            var title = tbTitle.Text.Trim();
            var text  = rtbContent.GetText();

            if (string.IsNullOrEmpty(title) || title == EmptyNoteTitle)
            {
                if (text.Length <= 100)
                {
                    title = text;
                }
                else
                {
                    title = text.Substring(0, 100);
                }
            }
            _noteEntity.Title   = title;
            _noteEntity.Content = rtbContent.GetHtml();
            //_noteEntity.NotebookName = NotebookSelectView.Notebook.Name;
            //_noteEntity.NotebookPath = NotebookSelectView.Notebook.Path;
            _noteEntity.CreateTime = DateUtils.ConvertFromLocalDateTimeToSeconds(DateTime.Now);
            _noteEntity.ModifyTime = DateUtils.ConvertFromLocalDateTimeToSeconds(DateTime.Now);
            _noteEntity.NoteStatus = NoteStatus.Added;
        }