private void btnInsertclicked2(object sender, EventArgs e) { var db = MoneyItemDatabase.getDatabase(); MoneyItem m = new MoneyItem() { ID = 20, Name = "HELLO", Done = false }; db.SaveItemAsync(m); DisplayAlert("SQLite", "追加されたよ", "OK"); }
public static MoneyItemDatabase getDatabase() { if (db == null) { db = new MoneyItemDatabase(DependencyService.Get <IFileHelper>().GetLocalFilePath("MoneyItemSQLite.db3")); } return(db); }
private async void btnListClicked(object sender, EventArgs e) { var db = MoneyItemDatabase.getDatabase(); List <MoneyItem> itemList; // itemList = await db.GetItemsNotDoneAsync(); itemList = await db.GetItemsAsync(); int size = itemList.Count; await DisplayAlert("SQLite", size + "件のデータ", "OK"); }