/// <summary>
		/// Initializes a new instance of the <see cref="CloneDo.Mvvm.ViewModels.TodoListViewModel"/> class.
		/// </summary>
		public TodoListViewModel ()
		{
			
			// Initialize
			LoadTasks ();

			// Commands
			this.NewTaskCommand = new Command (() => {
				TaskItem newTask = new TaskItem();
				TaskItemViewModel vm = new TaskItemViewModel(newTask);
				Navigation.PushAsync(ViewFactory.CreatePage(vm));
			});

			this.ReloadCommand = new Command (() => {
				LoadTasks();
			});

			// Messages
			MessagingCenter.Subscribe<TaskItemViewModel, TaskItem> (this, "TaskAdded", (sender, task) => {
				LoadTasks();
			});

			MessagingCenter.Subscribe<TaskItemViewModel, TaskItem> (this, "TaskDeleted", (sender, task) => {
				LoadTasks();
			});

			MessagingCenter.Subscribe<TaskCellViewModel, TaskItem> (this, "TaskSetDone", (sender, task) => {
				System.Diagnostics.Debug.WriteLine("TodoListViewModel::Task set done.");
				LoadTasks();
			});

			MessagingCenter.Subscribe<TaskCellViewModel, TaskItem> (this, "TaskTapped", (sender, task) => {
				TaskTapped(task.ID);
			});

			MessagingCenter.Subscribe<TodoClient, TodoResponse> (this, "StatusMessage", (sender, response) => {
				System.Diagnostics.Debug.WriteLine("TodoListViewModel::Status dialog here");
				Navigation.DisplayAlert(response.Ok?"Success":"Error", response.Message, "Ok");
				Navigation.PopToRootAsync();
				
			});

			MessagingCenter.Subscribe<TodoClient, string> (this, "ErrMessage", (sender, message) => {

				Navigation.DisplayAlert("Error!", message, "Ok");
//				Navigation.PopAsync(); 
			});
		}
		private async void TaskTapped(int id) {
			// fetch task
			TaskItem fetchedTask = await App.Client.FetchTask(id);
			TaskItemViewModel viewModel = new TaskItemViewModel (fetchedTask);
			Navigation.PushAsync (ViewFactory.CreatePage (viewModel));
		}