Exemplo n.º 1
0
        private async void CheckBoxRemove_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox  cb   = (CheckBox)sender;
            DemoColor item = cb.DataContext as DemoColor;

            await UpdateCheckedDemoColorItem(item);
        }
Exemplo n.º 2
0
        private async void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            var demoColor = new DemoColor {
                Name = TextInput.Text
            };

            await InsertDemoColor(demoColor);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }