コード例 #1
0
ファイル: PlannerForm.cs プロジェクト: marcelrienks/Planner
      /// <summary>
      /// Adds the notes item.
      /// </summary>
      private void AddNotesItem(){
        try {
          if (tbcMain.SelectedTab != tbNotes) {
            tbcMain.SelectedTab = tbNotes;
          }

          Notes noteItem          = new Notes();
          NotesItemForm frm       = new NotesItemForm(ref noteItem);
          frm.ShowDialog();

          if (noteItem.GUID != "") {
            _noteControl.Add(noteItem);
            PopulateNotes();
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Adding Note!", ex);
        }
      }
コード例 #2
0
ファイル: PlannerForm.cs プロジェクト: marcelrienks/Planner
      /// <summary>
      /// Edits the notes item.
      /// </summary>
      private void EditNotesItem(){
        bool status                 = false;

        try {
          if (tbcMain.SelectedTab != tbNotes) {
            tbcMain.SelectedTab = tbNotes;
          }

          if (tvNotes.SelectedNode != null) {
            Notes noteItem          = (Notes)tvNotes.SelectedNode.Tag;
            NotesItemForm frm       = new NotesItemForm(ref noteItem);
            frm.ShowDialog();

            if (noteItem.GUID != null) {
              status                = _noteControl.Edit(noteItem);

              if (status) {
                PopulateNotes();

              } else {
                throw new Exception();
              }
            }

          } else {
            MessageBox.Show("Please select the note you wish to edit.", "EDIT",
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Editing TimeSheet Item.", ex);
        }
      }