Ejemplo n.º 1
0
 private void OnBodyRemoveed(NoteDetail noteDetail)
 {
     noteDetail.Parent = null;
 }
 public bool Save()
 {
     try
     {
         if (string.IsNullOrEmpty(this.Note.Title) || string.IsNullOrWhiteSpace(this.Note.Title))
         {
             MessageBox.Show("请填写标题");
             return false;
         }
         this.Note.Color = this.ListColor[this.IndexColor].Value;
         this.Note.Body.Clear();
         foreach (ViewModelNewBase base2 in this.ListViewModels)
         {
             NoteDetail dett = new NoteDetail
             {
                 Parent = this.Note
             };
             this.Note.Body.Add(dett);
             if (base2 is TextViewModel)
             {
                 dett.Text = (base2 as TextViewModel).CurrentText;
             }
             else if (base2 is DrawViewModel)
             {
                 dett.ListPageDraw = (base2 as DrawViewModel).CurrentList;
                 dett.SerializeListDraw();
             }
         }
         if (this.StateModel == StateModel.New)
         {
             this.db.Notes.InsertOnSubmit(this.Note);
         }
         this.db.SubmitChanges();
         return true;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return false;
     }
 }
Ejemplo n.º 3
0
 private void OnBodyAdded(NoteDetail noteDetail)
 {
     noteDetail.Parent = this;
 }