public TasksViewController (SQLiteAsyncConnection connection, List list)
			: base (UITableViewStyle.Plain, null, true)
		{
			if (connection == null)
				throw new ArgumentNullException ("connection");
			if (list == null)
				throw new ArgumentNullException ("list");

			this.db = connection;
			this.list = list;

			var addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, OnAddItem);
			var refreshButton = new UIBarButtonItem (UIBarButtonSystemItem.Refresh, delegate { Refresh(); });

			// attach a pull-to-refresh
			//RefreshRequested += (s, e) => Refresh();
			// add a refresh button
			NavigationItem.RightBarButtonItems = new []{ addButton, refreshButton };

			Root = new RootElement (list.Name) {
				new Section()
			};

			Refresh();
		}
		// Create a new list and then navigate to it
		private void CreateList (string name)
		{
			if (String.IsNullOrWhiteSpace (name))
				return;

			AppDelegate.AddActivity();

			var list = new List { Name = name };
			this.db.InsertAsync (list).ContinueWith (t => {
				AppDelegate.FinishActivity();

				RefreshAsync().ContinueWith (rt => {
					var tasks = new TasksViewController (this.db, list);
					NavigationController.PushViewController (tasks, animated: true);
				}, uiScheduler);
			});
		}
		public TasksViewController (SQLiteAsyncConnection connection, List list)
			: base (UITableViewStyle.Plain, null, true)
		{
			if (connection == null)
				throw new ArgumentNullException ("connection");
			if (list == null)
				throw new ArgumentNullException ("list");

			this.db = connection;
			this.list = list;

			NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Add, OnAddItem);

			Root = new RootElement (list.Name) {
				new Section()
			};

			RefreshRequested += (s, e) => Refresh();
			Refresh();
		}