Exemplo n.º 1
0
        private async void DeleteButton_Clicked(object sender, RoutedEventArgs e)
        {
            MessageDialog msg = new MessageDialog("Do you want to delete this item?");

            msg.Commands.Add(new UICommand("Yes", command =>
            {
                Frame.Navigate(typeof(MainPage), ViewModel);
            }));
            msg.Commands.Add(new UICommand("No", command =>
            {
            }));
            var msg1info = await msg.ShowAsync();

            if (ViewModel.SelectedItem != null)
            {
                var db = App.conn;
                using (var statement = db.Prepare("DELETE FROM Items WHERE id = ?"))
                {
                    statement.Bind(1, GetTodoitemId());
                    statement.Step();
                }
                ViewModel.RemoveTodoItem(ViewModel.SelectedItem.GetId());
            }

            ViewModel.SelectedItem = null;
        }
Exemplo n.º 2
0
        private async void DeleteButton_Clicked(object sender, RoutedEventArgs e)
        {
            MessageDialog msg = new MessageDialog("Do you want to delete this item?");

            msg.Commands.Add(new UICommand("Yes", command =>
            {
                Frame.Navigate(typeof(MainPage), ViewModel);
            }));
            msg.Commands.Add(new UICommand("No", command =>
            {
            }));
            var msg1info = await msg.ShowAsync();

            if (ViewModel.SelectedItem != null)
            {
                ViewModel.RemoveTodoItem(ViewModel.SelectedItem.GetId());
            }

            ViewModel.SelectedItem = null;
        }