Ejemplo n.º 1
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            activity.IsRunning = true;
            activity.IsVisible = true;
            try {
                lp.imgs = new List <Imgs>();
                string childof = "lp" + lp.Brand.Trim() + lp.Name.Trim();
                foreach (var media in file)
                {
                    string filename     = "image" + file.IndexOf(media) + ".jpeg";
                    var    stroageImage = await new FirebaseStorage("pccamdz.appspot.com")
                                          .Child(childof)
                                          .Child(filename)
                                          .PutAsync(media.GetStream());
                    string imgurl = stroageImage;
                    lp.imgs.Add(new Imgs()
                    {
                        folder = childof, imgname = filename, imgurl = imgurl
                    });
                }
                lp.date    = DateTime.Now;
                lp.mainimg = lp.imgs.FirstOrDefault().imgurl;
                await helper.AddLaptop(lp);


                await PopupNavigation.Instance.RemovePageAsync(this);

                await PopupNavigation.Instance.PushAsync(new Step5(lp));
            }
            catch
            {
                await DisplayAlert("There Has Been An Error", "Check Your Internet Connection", "OK");
            }

            activity.IsRunning = false;
            activity.IsVisible = false;
        }