コード例 #1
0
 void FormMain_NoteDateChanged(object sender, NoteDateChangedEventArgs e)
 {
     try
     {
         var note = sender as PNote;
         if (note == null) return;
         switch (e.Type)
         {
             case NoteDateType.Creation:
                 _Notes.Add(new Result
                 {
                     Name = note.Name,
                     Id = note.ID,
                     Created = note.DateCreated,
                     Saved = note.DateSaved
                 });
                 break;
             case NoteDateType.Saving:
             case NoteDateType.Sending:
             case NoteDateType.Receiving:
             case NoteDateType.Deletion:
                 changeNoteDate(note, e.Type);
                 break;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
コード例 #2
0
ファイル: WndMain.xaml.cs プロジェクト: hyrmedia/PNotes.NET
 private void note_NoteDateChanged(object sender, NoteDateChangedEventArgs e)
 {
     if (NoteDateChanged != null)
     {
         NoteDateChanged(sender, e);
     }
 }
コード例 #3
0
ファイル: WndCP.xaml.cs プロジェクト: hyrmedia/PNotes.NET
 private void FormMain_NoteDateChanged(object sender, NoteDateChangedEventArgs e)
 {
     try
     {
         var note = sender as PNote;
         if (note == null) return;
         var group = getSelectedGroup();
         if (group == null) return;
         var cpn = _Notes.FirstOrDefault(n => n.Id == note.ID);
         if (cpn == null) return;
         switch (e.Type)
         {
             case NoteDateType.Creation:
                 {
                     cpn.Created = e.NewDate;
                     var selectedNote = getSelectedNote();
                     if (selectedNote != null && selectedNote.ID == cpn.Id)
                     {
                         loadNotePreview(selectedNote);
                     }
                 }
                 break;
             case NoteDateType.Deletion:
                 cpn.Deleted = e.NewDate;
                 var view = (CollectionView)CollectionViewSource.GetDefaultView(grdNotes.ItemsSource);
                 view.Refresh();
                 break;
             case NoteDateType.Receiving:
                 cpn.ReceivedAt = e.NewDate;
                 cpn.ReceivedFrom = note.ReceivedFrom;
                 cpn.SentReceived = note.SentReceived;
                 changeSpecialNodeText((int)SpecialGroups.Incoming);
                 break;
             case NoteDateType.Saving:
                 cpn.Saved = e.NewDate;
                 cpn.Content = getNoteContent(note);
                 if (group.ID == (int)SpecialGroups.Backup)
                 {
                     loadBackUpNotes();
                 }
                 else
                 {
                     var selectedNote = getSelectedNote();
                     if (selectedNote != null && selectedNote.ID == cpn.Id)
                     {
                         loadNotePreview(selectedNote);
                     }
                 }
                 if (PNStatic.Settings.Protection.BackupBeforeSaving)
                 {
                     changeSpecialNodeText((int)SpecialGroups.Backup);
                 }
                 break;
             case NoteDateType.Sending:
                 cpn.SentAt = e.NewDate;
                 cpn.SentTo = note.SentTo;
                 cpn.SentReceived = note.SentReceived;
                 break;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }