public static void SaveImgManu(string manu, string tex) { SQLiteConnection conn = new SQLiteConnection(App.DBPath); var item = conn.Table <LocalManu>().Count(); if (item > 11) { conn.DeleteAll <LocalManu>(); conn.CreateTable <LocalManu>(); } else { conn.CreateTable <LocalManu>(); LocalManu manuAdd = new LocalManu() { ImgManu = manu, TexManu = tex }; conn.Insert(manuAdd); conn.Close(); } }
private void manu12(object sender, EventArgs e) { LocalManu.Delete(); Navigation.PushAsync(new ChooseMenuPage()); }
private void SetMenu(string imgName, string text, int imageIndex) { SQLiteConnection conn = new SQLiteConnection(App.DBPath); SelectManu = conn.Table <LocalManu>().ToList(); var item = SelectManu.Where(x => x.TexManu.Contains(text)).ToList(); var oldItem = conn.Table <LocalManu>().ToList(); if (oldItem.Count == 11) { LocalManu.Delete(); } if (item.Count > 0) { //DisplayAlert("Failed!", "คุณเลือกเมนูซ้ำ", "OK"); //To delete item return; } count += 1; if (count == 11) { btnDone.IsEnabled = true; } LocalManu.SaveImgManu(imgName, text); //save Manu And img if (count > 0) { labelShow.IsVisible = false; } if (count <= 11) { switch (count) { case 1: Menu1Img = imgName; Menu1Text = text; break; case 2: Menu2Img = imgName; Menu2Text = text; break; case 3: Menu3Img = imgName; Menu3Text = text; break; case 4: Menu4Img = imgName; Menu4Text = text; break; case 5: Menu5Img = imgName; Menu5Text = text; break; case 6: Menu6Img = imgName; Menu6Text = text; break; case 7: Menu7Img = imgName; Menu7Text = text; break; case 8: Menu8Img = imgName; Menu8Text = text; break; case 9: Menu9Img = imgName; Menu9Text = text; break; case 10: Menu10Img = imgName; Menu10Text = text; break; case 11: Menu11Img = imgName; Menu11Text = text; break; } SetCheckedIcon(imageIndex); } }