void OnNoteTextChanged(object sender, EventArgs args) { NoteWidget nWidget = sender as NoteWidget; // if null, add a note, else, modify it if (nWidget.Note == null) { try { INote note = task.CreateNote(nWidget.Text); nWidget.Note = note; } catch (Exception e) { Logger.Debug("Unable to create a note"); Logger.Debug(e.ToString()); } } else { try { task.SaveNote(nWidget.Note); } catch (Exception e) { Logger.Debug("Unable to save note"); Logger.Debug(e.ToString()); } } }