Пример #1
0
        private async void DisplayInMap()
        {
            var subscription = await FirestoreHelper.ReadSubscription();

            foreach (var item in subscription)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(item.Lat, item.Lng);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = item.VenueName,
                        Address  = item.Address
                    };
                    locationmaps.Pins.Add(pin);
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Message", ex.Message, "Okay");
                }
            }
        }
Пример #2
0
 private void Save(object parameter)
 {
     if (SelectedVenue != null)
     {
         bool result = FirestoreHelper.InsertSubscription(new Subscription
         {
             UserId         = Auth.GetUserId(),
             Name           = Name,
             IsActive       = IsActive,
             SubscribedDate = DateTime.Now,
             VenueName      = Name1,
             Address        = Address,
             Distance       = Distance,
             CategoryId     = CategoryId,
             CategoryName   = CategoryName,
             Lat            = Latitutde,
             Lng            = Longitude
         });
         if (result)
         {
             App.Current.MainPage.Navigation.PopAsync();
         }
         else
         {
             App.Current.MainPage.DisplayAlert("Error", "Something went wrong, please try again", "Okay");
         }
     }
     else
     {
         App.Current.MainPage.DisplayAlert("Error", "Please select any place", "Okay");
     }
 }
        public async void ReadCollection()
        {
            var subscription = await FirestoreHelper.ReadSubscription();

            Subscriptions.Clear();
            foreach (var s in subscription)
            {
                Subscriptions.Add(s);
            }
        }
Пример #4
0
        private void Update(object parameter)
        {
            bool result = FirestoreHelper.UpdateSubscription(Subscription1);

            if (result)
            {
                App.Current.MainPage.Navigation.PopAsync();
            }
            else
            {
                App.Current.MainPage.DisplayAlert("Error", "Something went wrong, please try again", "Okay");
            }
        }