async void DeleteClicked(Object sender, EventArgs e) { Kakeibo eItem = (Kakeibo)BindingContext; await App.Database.DeleteItemAsync(eItem); await Navigation.PopAsync(); }
public EditPage(Kakeibo wItem) { InitializeComponent(); BindingContext = wItem; kind.ItemsSource = Kind.list; kind.SelectedIndex = wItem.HimokuPicker; }
public MainPageViewModel() { SelectDelLetter = "選択削除"; Add = new Command(async() => { var item = new Kakeibo { Date = this.Date, Himoku = (string)this.SelectedItem, HimokuPicker = this.Index, Memo = this.Text, Price = this.Price, }; await App.Database.SaveItemAsync(item); this.Kakeibos = await App.Database.GetItemsAsync(); this.SelectedItem = null; this.Text = ""; this.Price = 0; await SumSet(); }); AllDel = new Command(async() => { await App.Database.DeleteAllItemsAsync(); Kakeibos = await App.Database.GetItemsAsync(); await SumSet(); }); EditMode = new Command(() => { this.IsEditMode = !this.IsEditMode; if (this.IsEditMode) { foreach (var item in Kakeibos) { item.IsEditMode = this.IsEditMode; } SelectDelLetter = "戻る"; } else { foreach (var item in Kakeibos) { item.IsEditMode = this.IsEditMode; item.IsChecked = false; } SelectDelLetter = "選択削除"; } }); Date = DateTime.Now; }
public Task <int> SaveItemAsync(Kakeibo kakeibo) { if (kakeibo.Id != 0) { return(database.UpdateAsync(kakeibo)); } else { return(database.InsertAsync(kakeibo)); } }
public static void Main() { Kakeibo k = new Kakeibo(); k.gettotal(); k.nyukin(1000); k.gettotal(); k.nyukin(2000); k.gettotal(); k.shishutsu(500); k.gettotal(); k.shishutsu(10000); k.gettotal(); }
public Task <int> DeleteItemAsync(Kakeibo kakeibo) { return(database.DeleteAsync(kakeibo)); }