示例#1
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            ScrollViewMeeting.ContentSize = new CoreGraphics.CGSize(0, View.Frame.Height + 100);
            buttonMeetingSend.AddTarget(ButtonEventHandler, UIControlEvent.TouchUpInside);
            this.View.AddGestureRecognizer(new UITapGestureRecognizer(tap =>
            {
                View.EndEditing(true);
            })
            {
                NumberOfTapsRequired = 1
            });
            IsInternetConnectionAvailable = SharedFunctions.CheckInternetConnection();
            if (IsInternetConnectionAvailable == true)
            {
                try
                {
                    var bounds = UIScreen.MainScreen.Bounds;
                    loadingIndicator = new LoadingIndicator(bounds, "Cargando contenido...");
                    View.Add(loadingIndicator);
                    await Task.Delay(10);

                    iOSFunctions.LoadUILabelText(UILabelMeetingTitle, "SOLICITAR CITA");
                    Constants        constants      = new Constants();
                    List <Proyectos> listaProyectos = service.HttpGet <List <Proyectos> >(constants.Url, constants.ProyectoController, constants.ProyectoMethod, string.Empty);
                    ServiceLines.Add("Seleccionar opción");
                    if (listaProyectos != null && listaProyectos.Count > 0)
                    {
                        foreach (var item in listaProyectos)
                        {
                            ServiceLines.Add(item.Nombre);
                        }
                    }
                    else
                    {
                        throw new Exception("No se encontraron registros.");
                    }
                    var picker = new UIPickerViewServiceLinesModel(ServiceLines);
                    pickerViewMeetingServiceLiness.Model = picker;
                    picker.ValueChanged += (sender, e) =>
                    {
                        BusinessLine = picker.SelectedValue.ToString();
                    };
                    loadingIndicator.Hide();
                }
                catch (Exception ex)
                {
                    ExceptionAlert("Alerta", ex.Message);
                }
            }
            else
            {
                var okCancelAlertController = UIAlertController.Create("Alerta", "Por favor verifique su conexión a internet e intenta nuevamente", UIAlertControllerStyle.Alert);
                okCancelAlertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, alert => Environment.Exit(0)));
                PresentViewController(okCancelAlertController, true, null);
            }
        }
示例#2
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();
            buttonContactSend.AddTarget(ButtonEventHandler, UIControlEvent.TouchUpInside);
            this.View.AddGestureRecognizer(new UITapGestureRecognizer(tap =>
            {
                View.EndEditing(true);
            })
            {
                NumberOfTapsRequired = 1
            });
            IsInternetConnectionAvailable = SharedFunctions.CheckInternetConnection();
            if (IsInternetConnectionAvailable == true)
            {
                try
                {
                    var bounds = UIScreen.MainScreen.Bounds;
                    loadingIndicator = new LoadingIndicator(bounds, "Cargando contenido...");
                    View.Add(loadingIndicator);
                    await Task.Delay(10);

                    LoadUILabelText(UILabelContactTitle, "ESCRÍBENOS " + SubBusinessLine);
                    if (BusinessLine != string.Empty)
                    {
                        pickerViewContactServiceLines.UserInteractionEnabled = false;
                    }
                    else
                    {
                        constants = new Constants();
                        List <Proyectos> listaProyectos = service.HttpGet <List <Proyectos> >(constants.Url, constants.ProyectoController, constants.ProyectoMethod, string.Empty);
                        if (listaProyectos != null && listaProyectos.Count > 0)
                        {
                            foreach (var item in listaProyectos)
                            {
                                ServiceLines.Add(item.Nombre);
                            }
                        }
                        else
                        {
                            throw new Exception("No se encontraron registros");
                        }
                        var picker = new UIPickerViewServiceLinesModel(ServiceLines);
                        pickerViewContactServiceLines.Model = picker;
                        picker.ValueChanged += (sender, e) =>
                        {
                            BusinessLine = picker.SelectedValue.ToString();
                        };
                    }

                    loadingIndicator.Hide();
                }
                catch (Exception)
                {
                    var okCancelAlertController = UIAlertController.Create("Alerta", "El servicio no está disponible en el momento, intente de nuevo más tarde", UIAlertControllerStyle.Alert);
                    okCancelAlertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, alert => Environment.Exit(0)));
                    PresentViewController(okCancelAlertController, true, null);
                }
            }
            else
            {
                var okCancelAlertController = UIAlertController.Create("Alerta", "Por favor verifique su conexión a internet e intenta nuevamente", UIAlertControllerStyle.Alert);
                okCancelAlertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, alert => Environment.Exit(0)));
                PresentViewController(okCancelAlertController, true, null);
            }
        }