Пример #1
0
        private void SendEventToServer(Feature eventObj)
        {
            Task.Run(async() =>
            {
                try
                {
                    Feature featureCreated;

                    if (EditFeature == null)
                    {
                        // Create Event
                        featureCreated = await AysaClient.Instance.CreateFeature(eventObj);
                    }
                    else
                    {
                        // Update Event
                        featureCreated = await AysaClient.Instance.UpdateFeature(EditFeature.Id, eventObj);
                    }

                    InvokeOnMainThread(() =>
                    {
                        if (EditFeature != null)
                        {
                            // Send filter to EventsViewController to get events by filter
                            if (_delegate != null)
                            {
                                Delegate?.FeatureWasUpdated(featureCreated);
                            }
                        }

                        string successMsj = EditFeature == null ? "La novedad ha sido creado con éxito" : "La novedad ha sido modificado con éxito";
                        BTProgressHUD.ShowImage(UIImage.FromBundle("ok_icon"), successMsj, 2000);
                        PerformSelector(new Selector("PopViewController"), null, 2.0f);
                    });
                }
                catch (HttpUnauthorized)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowSessionExpiredError();
                    });
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowErrorAlert(ex.Message);

                        CountAttachmentsUploaded = 0;
                    });
                }
            });
        }
        private void SendObservationToServer(Observation observationObj)
        {
            //Show a HUD with a progress spinner and the text
            BTProgressHUD.Show("Cargando...", -1, ProgressHUD.MaskType.Black);

            Task.Run(async() =>
            {
                try
                {
                    Observation observation = await AysaClient.Instance.CreateObservation(observationObj);

                    InvokeOnMainThread(() =>
                    {
                        if (observation != null)
                        {
                            if (EventDetail.Observaciones != null)
                            {
                                // Clear TextField
                                ObservationTextView.Text = "";

                                // Add observetion in fist position to show it in first place
                                EventDetail.Observaciones.Insert(0, observation);
                                // Reload list of Observations
                                LoadObservationsOfEvent();
                            }
                        }

                        BTProgressHUD.ShowImage(UIImage.FromBundle("ok_icon"), "La observación ha sido creada con éxito", 2000);
                    });
                }
                catch (HttpUnauthorized)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowSessionExpiredError();
                    });
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowErrorAlert(ex.Message);
                    });
                }
            });
        }
Пример #3
0
        public void Show(HUDType type, string msg, int duaration)
        {
            switch (type)
            {
            case HUDType.Loading:
                BTProgressHUD.Show(msg, maskType: MaskType.Black);
                break;

            case HUDType.Success:
                BTProgressHUD.ShowImage(UIImage.FromBundle("IconSuccess"), msg, duaration);
                break;

            case HUDType.Fail:
                BTProgressHUD.ShowImage(UIImage.FromBundle("IconFail"), msg, duaration);
                break;
            }
        }
Пример #4
0
        private void RemoveFileFromServer(AttachmentFile file)
        {
            //Show a HUD with a progress spinner and the text
            BTProgressHUD.Show("Cargando...", -1, ProgressHUD.MaskType.Black);

            Task.Run(async() =>
            {
                try
                {
                    AttachmentFile response = await AysaClient.Instance.DeleteFile(file.Id);

                    InvokeOnMainThread(() =>
                    {
                        string successMsj = "El evento ha sido eliminado";
                        BTProgressHUD.ShowImage(UIImage.FromBundle("ok_icon"), successMsj, 2000);

                        // Remove file in view
                        RemoveFileFromView(file);
                    });
                }
                catch (HttpUnauthorized)
                {
                    InvokeOnMainThread(() =>
                    {
                        ShowErrorAlert("No tiene permisos para ejecutar esta acción");
                    });
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() =>
                    {
                        ShowErrorAlert(ex.Message);
                    });
                }
                finally
                {
                    BTProgressHUD.Dismiss();
                }
            });
        }
 public override void ShowSuccess(string message, int timeoutMillis)
 {
     //this.ShowWithOverlay(timeoutMillis, () => BTProgressHUD.ShowSuccessWithStatus(message, timeoutMillis));
     this.ShowWithOverlay(timeoutMillis, () => BTProgressHUD.ShowImage(ProgressHUD.Shared.SuccessImage, message, timeoutMillis));
 }
 public override void ShowImage(IBitmap image, string message, int timeoutMillis)
 {
     this.ShowWithOverlay(timeoutMillis, () => BTProgressHUD.ShowImage(image.ToNative(), message, timeoutMillis));
 }
Пример #7
0
 public override void ShowImage(IBitmap image, string message, int timeoutMillis)
 => BTProgressHUD.ShowImage(image.ToNative(), message, timeoutMillis);
 public override void ShowImage(IBitmap image, string message, int timeoutMillis)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(() =>
                                                        BTProgressHUD.ShowImage(image.ToNative(), message, timeoutMillis)
                                                        );
 }
Пример #9
0
        public void ShowSharedError(string errorString)
        {
            var image = UIImage.FromBundle("warning.png");

            BTProgressHUD.ShowImage(image, errorString, 3000);
        }
Пример #10
0
        public void ShowShareSuccess(string successString)
        {
            var image = UIImage.FromBundle("tick.png");

            BTProgressHUD.ShowImage(image, successString, 3000);
        }
Пример #11
0
 public override void ShowImage(object image, string message = null, MaskType mask = MaskType.None, TimeSpan?timeout = default(TimeSpan?), Action clickCallback = null, string cancelCaption = null, Action cancelCallback = null)
 {
     BTProgressHUD.ShowImage((UIKit.UIImage)image, message, timeout.HasValue ? timeout.Value.TotalMilliseconds : 1000);
 }
Пример #12
0
 public override void ShowSuccess(string message, int timeoutMillis)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(() =>
                                                        BTProgressHUD.ShowImage(ProgressHUD.Shared.SuccessImage, message, timeoutMillis)
                                                        );
 }
Пример #13
0
 public void ShowSuccessToast(string successText = "Gotowe!")
 {
     BTProgressHUD.ForceiOS6LookAndFeel = true;
     BTProgressHUD.ShowImage(UIImage.FromFile("checked.png"), successText);
 }
Пример #14
0
 public void ShowFailedToast(string failedText = "Coś poszło nie tak ;/")
 {
     BTProgressHUD.ShowImage(UIImage.FromFile("closewindow.png"), failedText);
 }
Пример #15
0
 public override void ShowError(string message, int timeoutSeconds)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(() =>
                                                        BTProgressHUD.ShowImage(ProgressHUD.Shared.ErrorImage, message, timeoutSeconds * 1000)
                                                        );
 }