[tasque/transition: 164/213] [SQLite] TaskNote: Adjust to new model. Provide change callback for task.



commit 0c255d5c3a1b30a96512adcf0ca0689a1c2f0c0f
Author: Antonius Riha <antoniusriha gmail com>
Date:   Sat Aug 18 21:37:14 2012 +0200

    [SQLite] TaskNote: Adjust to new model. Provide change callback for task.
    
    TaskNote receives change notification from base class. SQLiteNote is
    entirely handled by owning task. Therefore the task reacts to changes in
    the note. A callback "OnTextChangedAction" enables the task to do so.

 src/Addins/SqliteBackend/SqliteNote.cs |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/Addins/SqliteBackend/SqliteNote.cs b/src/Addins/SqliteBackend/SqliteNote.cs
index a590e50..4ffe6b8 100644
--- a/src/Addins/SqliteBackend/SqliteNote.cs
+++ b/src/Addins/SqliteBackend/SqliteNote.cs
@@ -3,27 +3,26 @@
 //
 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
 //
+using System;
 
 namespace Tasque.Backends.Sqlite
 {
 	public class SqliteNote : TaskNote
 	{
-		private int id;
-		private string text;
-
-		public SqliteNote (int id, string text)
+		public SqliteNote (int id, string text) : base (text)
 		{
-			this.id = id;
-			this.text = text;
-		}
-
-		public string Text {
-			get { return this.text; }
-			set { this.text = value; }
+			Id = id;
 		}
 
-		public int ID {
-			get { return this.id; }
+		public int Id { get; private set; }
+		
+		protected override void OnTextChanged ()
+		{
+			if (OnTextChangedAction != null)
+				OnTextChangedAction ();
+			base.OnTextChanged ();
 		}
+		
+		internal Action OnTextChangedAction { get; set; }
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]