private async void LoadContent() { ImageSource src = null; ImageSource src1 = null; AdminIcon ai = await DBActions.LoadAdminIcon(DBActions._p(binary.PRODUCT)); Images img = await DBActions.LoadProductImage(binary.PRODUCT); if (ai != null) { src = App.ByteToImage(ai.Image); } else { src = App.GetSource("icon-blank.png"); } if (img != null) { src1 = App.ByteToImage(img.Image); } else { src1 = App.GetSource("noproduct.jpg"); } icon.SetSRC(src); product_image.SetSRC(src1); content_loading.IsVisible = false; animation.Pause(); LOADING = false; }
private async void ButtonClicked(object s, EventArgs a) { if (loading) { return; } var x = loc.Text; var x1 = name.Text; var x2 = email.Text; var x3 = phone.Text; loading = true; if (file == null) { DisplayAlert("Fel", "Välj en ikon!", "Avbryt"); loading = false; return; } if (x != null && x1 != null && x2 != null && x3 != null) { an.IsVisible = true; an.Play(); var list = await App.GetPositions(x); if (list.Count == 1) { _a.Address = await App.GetAddress(list[0]); _a.SName = x1; _a.Email = x2; _a.Phone = x3; _a.Login = true; await DBActions.EditAdmin(_a); var aicon = new AdminIcon { ID = _a.ID, Image = App.ImageToByte(file) }; if (hadAdminIcon) { await DBActions.EditAdminIcon(aicon); } else { await DBActions.AddAdminIcon(aicon); } await App.ReloadPins(); an.IsVisible = false; an.Pause(); Navigation.PushAsync(new MapPage(_a)); App.RemovePage(this); return; } } an.IsVisible = false; an.Pause(); loading = false; await DisplayAlert("Fel", "Ange en giltig adress!", "Avbryt"); }