示例#1
0
 public async void ShowPopup(Rg.Plugins.Popup.Pages.PopupPage p,
                             [System.Runtime.CompilerServices.CallerMemberName] string memberName    = "",
                             [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath  = "",
                             [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
 {
     try
     {
         await PopupNavigation.Instance.PushAsync(p, true);
     }
     catch (Exception ex)
     {
         // ignored
     }
 }
示例#2
0
 public async void ClosePopup(Rg.Plugins.Popup.Pages.PopupPage p,
                              [System.Runtime.CompilerServices.CallerMemberName] string memberName    = "",
                              [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath  = "",
                              [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
 {
     try
     {
         Debug.WriteLine($"ClosePopup() <= {memberName} {sourceFilePath} ({sourceLineNumber})");
         await PopupNavigation.Instance.RemovePageAsync(p, true);
     }
     catch (Exception ex)
     {
         // ignored
     }
 }
        private async void OnClicked(object sender, EventArgs args)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", ":( No camera available.", "OK");

                return;
            }

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory          = "Photos",
                Name               = "thisphoto.jpg",
                CompressionQuality = 10
            });

            if (file != null)
            {
                var    stream      = file.GetStream();
                string base64Image = ImageConvertors.ImageToBase64(stream);
                loadingPage = new LoadingPage();
                await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(
                    loadingPage);

                int updateNo = await Communications.sendMyNewUpdate(task.taskid, base64Image);

                await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAsync();

                if (updateNo == -1)
                {
                    await DisplayAlert("Update failed due to server error", "Please try again", "ok");
                }
                else
                {
                    await DisplayAlert("+。:.゚ヽ(*´∀`) ノ゚.:。+゚", "Your progress has b een sent to your friends. Update number: "
                                       + updateNo, "ok");
                }
            }
        }
    public App()
    {
        InitializeComponent();

        MasterDetailPage mdpage = new MasterDetailPage();

        mdpage.Master = new ContentPage()
        {
            Title = "Master", BackgroundColor = Color.Red
        };
        ToolbarItem tbi = new ToolbarItem()
        {
            Text = "POPUP"
        };

        tbi.Clicked += async(object sender, System.EventArgs e) => {
            StackLayout sl = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.Pink, WidthRequest = 100, HeightRequest = 200
            };
            Rg.Plugins.Popup.Pages.PopupPage mypopup = new Rg.Plugins.Popup.Pages.PopupPage()
            {
                BackgroundColor = Color.Transparent
            };
            mypopup.Content = sl;
            await MainPage.Navigation.PushPopupAsync(mypopup);
        };
        ContentPage detail = new ContentPage()
        {
            Title = "Detail", BackgroundColor = Color.Green,
        };

        detail.ToolbarItems.Add(tbi);
        mdpage.Detail = new NavigationPage(detail);
        MainPage      = mdpage;
    }
        protected override async void OnAppearing()
        {
            String    IP_LEGAL  = App.Current.Properties["IpPublicado"].ToString();
            Documento documento = new Documento();

            //https://dzone.com/articles/mobile-alerts-in-xamarin
            if (estadoNom.Equals("POR APROBAR"))
            {
                String servicio = "";
                if (rol.Equals("1003") || rol.Equals("1004"))
                {
                    servicio = "DocumentoPorResponsableRevisionListarExternoJson";
                }
                else
                {
                    servicio = "DocumentoPorEspecialistaListarExternoJson";
                }

                //String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosPorControlStatusApp";
                String url     = IP_LEGAL + "/legal/Documento/" + servicio + "?estadoProcesoId=" + estadoId + "&usuarioId=" + usuarioId;
                var    service = new RestClient <Documento>();
                documento = await service.GetRestServicieDataAsync(url);

                ObservableCollection <Documento.Datum> docDatas = new ObservableCollection <Documento.Datum>(documento.data);
                DocumentosEnTramite_List.ItemsSource = docDatas;
            }
            else if (estadoNom.Equals("APROBADOS"))
            {
                var post = new
                {
                    empleadoId = empleadoId,
                    perfil     = rol
                };
                String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosAprobadosApp";
                //String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosPorControlStatusApp";
                var service = new RestClient <Documento>();
                documento = await service.GetRestServicieDataPostAsync(url, post);

                ObservableCollection <Documento.Datum> docDatas = new ObservableCollection <Documento.Datum>(documento.data);
                DocumentosEnTramite_List.ItemsSource = docDatas;
            }
            else if (estadoNom.Equals("RECHAZADOS"))
            {
                var post = new
                {
                    empleadoId = empleadoId,
                    perfil     = rol
                };
                String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosRechazadosApp";

                //String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosPorControlStatusApp";
                var service = new RestClient <Documento>();
                documento = await service.GetRestServicieDataPostAsync(url, post);

                ObservableCollection <Documento.Datum> docDatas = new ObservableCollection <Documento.Datum>(documento.data);
                DocumentosEnTramite_List.ItemsSource = docDatas;
            }
            else if (estadoNom.Equals("STATUS TRAMITE"))
            {
                var post = new
                {
                    empleadoId = empleadoId
                };
                String url     = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosPorControlStatusApp";
                var    service = new RestClient <Documento>();
                documento = await service.GetRestServicieDataPostAsync(url, post);

                docDatas = new ObservableCollection <Documento.Datum>(documento.data);
                DocumentosEnTramite_List.ItemsSource = docDatas;
            }

            else
            {
                String servicio = "";
                if (rol.Equals("1003") || rol.Equals("1004"))
                {
                    servicio = "DocumentoPorResponsableRevisionListarExternoJson";
                }
                else
                {
                    servicio = "DocumentoPorEspecialistaListarExternoJson";
                }

                //String url = IP_LEGAL + "/legal/RevisionDocumento/ListarDocumentosPorControlStatusApp";
                String url     = IP_LEGAL + "/legal/Documento/" + servicio + "?estadoProcesoId=" + estadoId + "&usuarioId=" + usuarioId;
                var    service = new RestClient <Documento>();

                documento = await service.GetRestServicieDataAsync(url);

                ObservableCollection <Documento.Datum> docDatas = new ObservableCollection <Documento.Datum>(documento.data);
                DocumentosEnTramite_List.ItemsSource = docDatas;
            }
            #region Listener click a un item de la lista
            if (counter == 0)
            {
                DocumentosEnTramite_List.ItemSelected += async(sender, e) =>
                {
                    if (e.SelectedItem != null)
                    {
                        //popupListView.IsVisible = true;
                        documentoSeleccionado = (Documento.Datum)e.SelectedItem;

                        //todo poup nuevo xmal
                        //var animationPopup = new PopupPageDoc(e.SelectedItem as Documento.Datum);
                        //fin todo poup nuevo xmal

                        Rg.Plugins.Popup.Pages.PopupPage animationPopup = new Rg.Plugins.Popup.Pages.PopupPage();

                        var scaleAnimation = new ScaleAnimation
                        {
                            PositionIn  = MoveAnimationOptions.Bottom,
                            PositionOut = MoveAnimationOptions.Bottom,
                            ScaleIn     = 1,
                            ScaleOut    = 1,
                            //DurationIn = 400,
                            //DurationOut = 800,
                            EasingIn = Easing.Linear,
                            //EasingOut = Easing.CubicOut,
                            HasBackgroundAnimation = true,
                        };

                        Label Status = new Label
                        {
                            Text              = "Status: " + documentoSeleccionado.Status,
                            FontSize          = 13,
                            HorizontalOptions = LayoutOptions.Center,
                            Margin            = 2,
                            FontAttributes    = FontAttributes.Bold
                        };
                        Label NombreArchivo = new Label
                        {
                            Text              = "Nemonico: " + documentoSeleccionado.NombreArchivo,
                            FontSize          = 14,
                            HorizontalOptions = LayoutOptions.Center,
                            Margin            = 2
                        };
                        Label Nemonico = new Label
                        {
                            Text              = documentoSeleccionado.Nemonico,
                            FontSize          = 14,
                            HorizontalOptions = LayoutOptions.Center,
                            Margin            = 2
                        };
                        Label SubTipoServicio = new Label
                        {
                            Text              = "Tipo Contrato: " + documentoSeleccionado.SubTipoServicio,
                            FontSize          = 14,
                            HorizontalOptions = LayoutOptions.Center,
                            Margin            = 2
                        };
                        Label Fecha = new Label
                        {
                            Text              = documentoSeleccionado.FechaRegistroString,
                            TextColor         = Color.Brown,
                            FontSize          = 13,
                            HorizontalOptions = LayoutOptions.Center,
                            Margin            = 2
                        };
                        Button btnAprobarDocumento = new Button
                        {
                            Text            = "APROBAR DOCUMENTO",
                            BackgroundColor = Color.DarkGoldenrod,
                            HeightRequest   = 35,
                            VerticalOptions = LayoutOptions.CenterAndExpand,
                            TextColor       = Color.White
                        };
                        btnAprobarDocumento.Clicked += BtnAprobarDocumento_ClickedAsync;
                        Button btnCancelarDocumento = new Button
                        {
                            Text            = "RECHAZAR DOCUMENTO",
                            BackgroundColor = Color.OrangeRed,
                            HeightRequest   = 35,
                            VerticalOptions = LayoutOptions.CenterAndExpand,
                            TextColor       = Color.White
                        };
                        btnCancelarDocumento.Clicked += BtnCancelarDocumento_Clicked;
                        if (!estadoNom.Equals("POR APROBAR"))
                        {
                            btnAprobarDocumento.IsVisible  = false;
                            btnCancelarDocumento.IsVisible = false;
                        }
                        animationPopup.Content = new StackLayout
                        {
                            VerticalOptions   = LayoutOptions.Center,
                            HorizontalOptions = LayoutOptions.Center,
                            Padding           = 0,
                            Margin            = 0,
                            Children          =
                            {
                                new Frame
                                {
                                    Padding       = 15,
                                    HeightRequest = 300,
                                    WidthRequest  = 270,
                                    Content       = new StackLayout
                                    {
                                        Children =
                                        {
                                            Status,              NombreArchivo, Nemonico, SubTipoServicio, Fecha,
                                            btnAprobarDocumento, btnCancelarDocumento
                                        }
                                    }
                                }
                            }
                        };
                        animationPopup.Animation = scaleAnimation;
                        //PopupNavigation.PushAsync(animationPopup);
                        await PopupNavigation.Instance.PushAsync(animationPopup);

                        DocumentosEnTramite_List.SelectedItem = null;
                    }
                };
                counter++;
            }
            #endregion fin Listener

            base.OnAppearing();
        }
        private async void BtnAprobarDocumento_ClickedAsync(object sender, EventArgs e)
        {
            bool displayFlag = false;

            if (rol.Equals("1003") || rol.Equals("1004"))
            {
                //Bundle bundle = new Bundle();
                RevisionDocumento docDatos = new RevisionDocumento
                {
                    usuarioId   = Int32.Parse(usuarioId),
                    documentoId = documentoSeleccionado.DocumentoId,
                    esRechazado = "No",
                    observacion = "",
                    perfil      = rol,
                    nombre      = documentoSeleccionado.NombreArchivo.ToString()
                };
                var documentosEnTramite = new AprobarDocSubirDocumento(docDatos as RevisionDocumento);

                //await rootPage.Navigation.PushAsync(documentosEnTramite);
                //await App.Current.MainPage .Navigation.PushAsync(documentosEnTramite);
                //App.Current.MainPage = new AprobarDocSubirDocumento(docDatos as object);

                await Navigation.PushAsync(documentosEnTramite);

                await Task.Delay(200);

                await PopupNavigation.Instance.PopAllAsync();
            }
            else
            {
                var answer = await DisplayAlert("Confirmar", "Seguro que desea aprobar documento ?", "Si", "No");

                if (!answer)
                {
                    return;
                }

                String IP_LEGAL = App.Current.Properties["IpPublicado"].ToString();
                String url      = IP_LEGAL + "/legal/RevisionDocumento/RevizarDocumentoJson";
                var    post     = new
                {
                    usuarioId       = usuarioId,
                    documentoId     = documentoSeleccionado.DocumentoId,
                    esRechazado     = "No",
                    observacion     = "",
                    perfil          = rol,
                    fileImagenOrPdf = "",
                    nombre          = "",
                    esImagen        = false,
                };
                var service = new RestClient <Documento>();
                documento = await service.GetRestServicieDataPostAsync(url, post);

                ObservableCollection <Documento.Datum> docDatas = new ObservableCollection <Documento.Datum>(documento.data);

                //await DisplayAlert("Documento: " + datum.DocumentoId, documento.mensaje, "OK");
                String message = documento.mensaje;

                //if (Device.OS == TargetPlatform.Android)
                //{
                //    DependencyService.Get<IMessage>().ShortAlert(message);
                //}
                //if (Device.OS == TargetPlatform.iOS)
                //{
                //    DependencyService.Get<IMessage>().ShortAlert(message);
                //}

                #region Utilizando la libreria popup
                Rg.Plugins.Popup.Pages.PopupPage popupPage = new Rg.Plugins.Popup.Pages.PopupPage();
                Label label = new Label();
                label.Text      = message;
                label.TextColor = Color.White;
                //label.BackgroundColor = Color.FromHex("#232323");
                label.VerticalTextAlignment = TextAlignment.Center;

                label.HeightRequest = 48;

                //label.Margin = new Thickness(16, 0, 0, 0);
                var scaleAnimation = new ScaleAnimation
                {
                    PositionIn  = MoveAnimationOptions.Bottom,
                    PositionOut = MoveAnimationOptions.Bottom,
                    ScaleIn     = 2,
                    ScaleOut    = 2,
                    //DurationIn = 400,
                    //DurationOut = 800,
                    EasingIn = Easing.Linear,
                    HasBackgroundAnimation = true,
                };

                popupPage.Animation = scaleAnimation;
                popupPage.Content   = new FlexLayout
                {
                    Direction       = FlexDirection.Column,
                    JustifyContent  = FlexJustify.End,
                    BackgroundColor = Color.Transparent,

                    Margin = 0,
                    //Padding = new Thickness(16, 0, 0, 0),

                    HeightRequest = 50,
                    WidthRequest  = 70,
                    Children      =
                    {
                        new StackLayout
                        {
                            BackgroundColor = Color.FromHex("#232323"),
                            Margin          = 0,
                            Padding         = new Thickness(16, 0),
                            Children        =
                            {
                                label
                            }
                        }
                    }
                };
                //popupPage.HeightRequest = 50;


                await PopupNavigation.Instance.PushAsync(popupPage);

                await Task.Delay(2000);

                await PopupNavigation.Instance.PopAllAsync();

                #endregion fin usando la liberia popup
            }
        }
示例#7
0
        private async void TlbIpPublicada_ClickedAsync(object sender, EventArgs e)
        {
            Rg.Plugins.Popup.Pages.PopupPage animationPopup = new Rg.Plugins.Popup.Pages.PopupPage();
            var scaleAnimation = new ScaleAnimation
            {
                PositionIn  = MoveAnimationOptions.Bottom,
                PositionOut = MoveAnimationOptions.Bottom,
                ScaleIn     = 1,
                ScaleOut    = 1,
                //DurationIn = 400,
                //DurationOut = 800,
                EasingIn = Easing.Linear,
                //EasingOut = Easing.CubicOut,
                HasBackgroundAnimation = true,
            };
            Label IpPublica = new Label
            {
                Text              = "IP PUBLICADA ",
                FontSize          = 13,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = 2
            };
            Label lblIp = new Label
            {
                Text              = "IP PUBLICADA",
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = 1
            };

            ingresarIP = new Entry
            {
                Placeholder = "Ingrese IP",
                Text        = App.Current.Properties["IpPublicado"].ToString()
            };
            StackLayout layoutIngresarIpPublica = new StackLayout
            {
                Children =
                {
                    lblIp, ingresarIP
                }
            };
            Button btnCambiarIpPublicada = new Button
            {
                Text            = "ACTUALIZAR IP",
                BackgroundColor = Color.DarkGoldenrod,
                HeightRequest   = 35,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = Color.White
            };

            btnCambiarIpPublicada.Clicked += BtnCambiarIpPublicada_ClickedAsync;

            animationPopup.Content = new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = 0,
                Margin            = 0,
                Children          =
                {
                    new Frame
                    {
                        Padding       = 10,
                        HeightRequest = 150,
                        WidthRequest  = 250,
                        Content       = new StackLayout
                        {
                            Children =
                            {
                                layoutIngresarIpPublica,
                                btnCambiarIpPublicada
                            }
                        }
                    }
                }
            };
            animationPopup.Animation = scaleAnimation;
            //PopupNavigation.PushAsync(animationPopup);
            await PopupNavigation.Instance.PushAsync(animationPopup);
        }
示例#8
0
        private async void mensajeEstaDentroZonaUsuarioAsync(string mensaje, bool existeUsuario, bool habilitarAcceso)
        {
            Color color;

            if (existeUsuario)
            {
                color = Color.DarkRed;
            }
            if (habilitarAcceso)
            {
                color = Color.DarkGreen;
            }
            else
            {
                color = Color.DarkRed;
            }
            Rg.Plugins.Popup.Pages.PopupPage popupPage = new Rg.Plugins.Popup.Pages.PopupPage();
            Label label = new Label();

            label.Text      = mensaje;
            label.TextColor = Color.White;
            //label.BackgroundColor = Color.FromHex("#232323");
            label.VerticalTextAlignment = TextAlignment.Center;

            label.HeightRequest = 48;

            //label.Margin = new Thickness(16, 13);
            var scaleAnimation = new ScaleAnimation
            {
                PositionIn  = MoveAnimationOptions.Bottom,
                PositionOut = MoveAnimationOptions.Bottom,
                ScaleIn     = 2,
                ScaleOut    = 2,
                //DurationIn = 400,
                //DurationOut = 800,
                EasingIn = Easing.Linear,
                HasBackgroundAnimation = true,
            };

            popupPage.Animation = scaleAnimation;

            popupPage.BackgroundColor = Color.Transparent;
            popupPage.Content         = new FlexLayout

            {
                Direction       = FlexDirection.Column,
                JustifyContent  = FlexJustify.End,
                BackgroundColor = Color.Transparent,
                Margin          = 0,
                //Padding = new Thickness(16, 0, 0, 0),
                HeightRequest = 50,
                WidthRequest  = 70,

                Children =
                {
                    new StackLayout
                    {
                        BackgroundColor = color,
                        Margin          = 0,
                        Padding         = new Thickness(16, 0),
                        Children        =
                        {
                            label
                        }
                    }
                }
            };
            //popupPage.HeightRequest = 50;


            await PopupNavigation.Instance.PushAsync(popupPage);

            await Task.Delay(2500);

            await PopupNavigation.Instance.PopAllAsync();
        }
        public BoardListPage() : base()
        {
            InitializeComponent();
            BindingContext = this;

            _scanningView = new Grid()
            {
                HorizontalOptions = LayoutOptions.End,
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition()
                    {
                        Width = new GridLength(26, GridUnitType.Absolute)
                    },
                },
                ColumnSpacing = 18,
            };
            _scanningView.BindingContext = App.Current.OWBLE;
            _scanningView.SetBinding(Grid.IsVisibleProperty, "IsScanning");

            var scanningLabel = new Label()
            {
                Text              = "Scanning...",
                TextColor         = Color.Black,
                FontFamily        = "SairaExtraCondensed-SemiBold",
                FontSize          = 24,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
            };

            var scanningActivityIndicator = new ActivityIndicator()
            {
                WidthRequest      = 26,
                HeightRequest     = 26,
                Color             = Color.Black,
                IsRunning         = true,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
            };

            Grid.SetColumn(scanningLabel, 0);
            Grid.SetColumn(scanningActivityIndicator, 1);

            _scanningView.Children.Add(scanningLabel);
            _scanningView.Children.Add(scanningActivityIndicator);

            var scanningToolbarItem = new CustomToolbarItem();

            scanningToolbarItem.Content = _scanningView;
            CustomToolbarItems.Add(scanningToolbarItem);

#if DEBUG
            var popupPage = new Rg.Plugins.Popup.Pages.PopupPage();

            // Secret debug menu.
            var debugToolbarItem = new CustomToolbarItem()
            {
                Position        = CustomToolbarItemPosition.Left,
                IconImageSource = "burger_menu",
                Command         = new Command(() =>
                {
                    var debugMenu = new Popup.DebugBoardListPageSettingPopup();

                    PopupNavigation.Instance.PushAsync(debugMenu);
                }),
            };
            CustomToolbarItems.Add(debugToolbarItem);
#endif

            /*
             #if DEBUG
             * var rand = new Random();
             * Boards.Add(new MockOWBoard($"ow{rand.Next(111111, 999999)}", OWBoardType.V1));
             * Boards.Add(new MockOWBoard($"ow{rand.Next(111111, 999999)}", OWBoardType.Plus));
             * Boards.Add(new MockOWBoard($"ow{rand.Next(111111, 999999)}", OWBoardType.XR));
             * Boards.Add(new MockOWBoard($"ow{rand.Next(111111, 999999)}", OWBoardType.Pint));
             * Boards.Add(new MockOWBoard($"ow{rand.Next(111111, 999999)}", OWBoardType.Unknown));
             #endif
             */
        }
示例#10
0
 private async Task PushPopup(Rg.Plugins.Popup.Pages.PopupPage page)
 {
     await PopupNavigation.Instance.PushAsync(page);
 }