private async void CheckBoxRemove_Checked(object sender, RoutedEventArgs e) { CheckBox cb = (CheckBox)sender; DemoColor item = cb.DataContext as DemoColor; await UpdateCheckedDemoColorItem(item); }
private async void ButtonSave_Click(object sender, RoutedEventArgs e) { var demoColor = new DemoColor { Name = TextInput.Text }; await InsertDemoColor(demoColor); }
private async Task UpdateCheckedDemoColorItem(DemoColor item) { // This code removes the DemoColor from the database. When the service // responds, the item is removed from the list. await demoTable.DeleteAsync(item); items.Remove(item); ListItems.Focus(FocusState.Unfocused); }
private async Task InsertDemoColor(DemoColor demoColor) { if (!string.IsNullOrWhiteSpace(demoColor.Name)) { // This code inserts a new DemoColor into the database. When the operation completes // and Mobile App backend has assigned an Id, the item is added to the CollectionView. await demoTable.InsertAsync(demoColor); items.Add(demoColor); } }