// Load the list of lists and setup their events private Task RefreshAsync() { AppDelegate.AddActivity(); return this.db.Table<List>().ToListAsync().ContinueWith (t => { if (t.Exception != null) { BeginInvokeOnMainThread (ReloadComplete); AppDelegate.FinishActivity(); ShowError (t.Exception.Flatten().InnerException); return; } Section section = new Section(); section.AddAll (t.Result.Select (l => new StringElement (l.Name, () => { var tasks = new TasksViewController (this.db, l); NavigationController.PushViewController (tasks, true); }) ).Cast<Element>()); InvokeOnMainThread (() => { Root.Clear(); Root.Add (section); ReloadComplete(); AppDelegate.FinishActivity(); }); }); }
// Load the list of lists and setup their events private Task RefreshAsync() { AppDelegate.AddActivity(); return(this.db.Table <List>().ToListAsync().ContinueWith(t => { if (t.Exception != null) { BeginInvokeOnMainThread(ReloadComplete); AppDelegate.FinishActivity(); ShowError(t.Exception.Flatten().InnerException); return; } Section section = new Section(); section.AddAll(t.Result.Select(l => new StringElement(l.Name, () => { var tasks = new TasksViewController(this.db, l); NavigationController.PushViewController(tasks, true); }) ).Cast <Element>()); InvokeOnMainThread(() => { Root.Clear(); Root.Add(section); ReloadComplete(); AppDelegate.FinishActivity(); }); })); }
// 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); }); }
// 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); }); }