/// <summary> /// 点击设置按钮触发的函数 /// </summary> private void Setting_Clicked(object sender, RoutedEventArgs e) { var data = (sender as FrameworkElement).DataContext; var item = ItemListView.ContainerFromItem(data) as ListViewItem; Item = item.Content as Models.ListItem; }
/// <summary> /// 点击Item触发的跳转函数 /// </summary> private void ListItem_ItemClicked(object sender, ItemClickEventArgs e) { Item = (Models.ListItem)e.ClickedItem; App.item = Item; Frame root = Window.Current.Content as Frame; root.Navigate(typeof(NewPage)); }
private void DeleteAppBarButton_Click(object sender, RoutedEventArgs e) { if (Item != null) { var db = App.conn; string date = "%" + Item.date.Date.Year.ToString() + "/" + Item.date.Date.Month.ToString() + "/" + Item.date.Date.Day.ToString() + "%"; string sql = @"DELETE FROM Items WHERE Date like ?"; try { using (var res = db.Prepare(sql)) { res.Bind(1, date); res.Step(); } } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } Frame.Navigate(typeof(MainPage)); } Item = null; }