Exemple #1
0
 private void UpdateCompleted(DonationAndPickup selected, DateTime time)
 {
     try
     {
         //first removes handler so that this event can only be subscribed to once
         App.service.UpdateCompletedDonationPickupCompleted -= Service_UpdateCompletedDonationPickupCompleted;
         App.service.UpdateCompletedDonationPickupCompleted += Service_UpdateCompletedDonationPickupCompleted;
         App.service.UpdateCompletedDonationPickupAsync(selected.Donation, selected.Pickup, time);
     }
     catch (Exception ex)
     {
         DependencyService.Get <IToast>().LongAlert("Error, unable to access server.");
         btnEnter.IsEnabled = true;
         Debug.WriteLine(ex);
     }
 }
Exemple #2
0
        private void btnCompleted_Clicked(object sender, EventArgs e)
        {
            var thisButton = (Button)sender;
            DonationPickupListItem selectedItem = (DonationPickupListItem)thisButton.BindingContext;

            int      donationID;
            DateTime currentTime;

            selectedItem = selectedItem;
            donationID   = selectedItem.DonationID;

            selected = donationsAndPickups.First(item => item.Donation.Donation_ID == donationID);

            currentTime = DateTime.Now;

            this.IsEnabled = false;
            UpdateCompleted(selected, currentTime);
            this.IsEnabled = true;
        }
Exemple #3
0
        private void Service_GetDonationAndPickupFromIDCompleted(object sender, GetDonationAndPickupFromIDCompletedEventArgs e)
        {
            bool              success = false;
            string            message = "";
            DonationAndPickup result  = new DonationAndPickup();

            if (e.Error == null)
            {
                result = e.Result;

                if (result.Donation != null)
                {
                    donationsAndPickups.Add(result);
                    success = true;
                    message = "Donation pickup added";
                }
                else
                {
                    success = false;
                    message = "Donation was not found";
                }
            }
            else
            {
                success = false;
                message = "Error retrieving donation information.";
                Debug.WriteLine(e.Error);
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                DependencyService.Get <IToast>().ShortAlert(message);

                btnEnter.IsEnabled = true;

                if (success)
                {
                    RefreshPickupsList();
                }
            });
        }