예제 #1
0
        public void OpenSettingsPage(ContentPage pageCaller)
        {
            if (popupLayout == null)
            {
                FrontEndElements.BuildSettingsPasswordPopup(ref popupLayout, ref rootLayout, pageCaller);
            }
            else
            {
                popupLayout.DismissPopup();
            }

            popupLayout.ShowPopup(rootLayout);
        }
예제 #2
0
        protected void AtribuiEventoAbrirTipoOcorrencia()
        {
            try
            {
//				//cria um novo controlador de reconhecimento de toque
                var tapGestureRecognizer = new TapGestureRecognizer();
//
//				//cria o evento
                tapGestureRecognizer.Tapped += (object s, EventArgs ev) => {
                    //AbreListaTipoOcorrencia ();

                    XLabs.Forms.Controls.PopupLayout _PopUpLayout = new XLabs.Forms.Controls.PopupLayout();

                    ListView lstOcorrencias = new ListView();
                    lstOcorrencias.Style          = (Style)Application.Current.Resources ["list_view"];
                    lstOcorrencias.ItemsSource    = Sessao.Ocorrencias;
                    lstOcorrencias.ItemTemplate   = new DataTemplate(typeof(ListViewCell));
                    lstOcorrencias.SeparatorColor = Color.FromHex(theme.COLOR_GREY_LIGHT);
                    lstOcorrencias.HasUnevenRows  = true;
                    lstOcorrencias.ItemSelected  += (object sender, SelectedItemChangedEventArgs e) =>
                    {
                        Sessao.OcorrenciaAtiva.TipoOcorrencia = ((TipoOcorrencia)e.SelectedItem);
                        Application.Current.MainPage          = new NavigationPage(new frmMain());

                        if (_PopUpLayout.IsPopupActive)
                        {
                            _PopUpLayout.DismissPopup();
                        }

                        ctrlPopup.IsVisible   = false;
                        btnPublicar.IsVisible = true;
                        controls.IsVisible    = true;
                    };


                    StackLayout header = new StackLayout();
                    header.Style       = (Style)Application.Current.Resources ["dynamic_toolbar"];
                    header.Padding     = 10;
                    header.Spacing     = 10;
                    header.Orientation = StackOrientation.Horizontal;
                    header.Children.Add(new Image()
                    {
                        Style = (Style)Application.Current.Resources ["toolbar_icon"]
                    });
                    header.Children.Add(new Label()
                    {
                        Style = (Style)Application.Current.Resources ["toolbar_text"], Text = "Tipos de Ocorrência"
                    });

                    StackLayout PopUp = new StackLayout
                    {
                        WidthRequest    = this.Width,                      // Important, the Popup hast to have a size to be showed
                        HeightRequest   = this.Height,
                        BackgroundColor = Color.White,                     // for Android and WP
                        Orientation     = StackOrientation.Vertical,
                        Padding         = 0,
                        Spacing         = 10,
                        Children        =
                        {
                            header,                             // my Label on top
                            lstOcorrencias                      // The Listview (all Cities/Zip-Codes in the Datasurce -> List)
                        }
                    };

                    ctrlPopup.Children.Add(PopUp);
                    ctrlPopup.IsVisible   = true;
                    btnPublicar.IsVisible = false;
                    controls.IsVisible    = false;

                    _PopUpLayout.Content = ctrlPopup;
                    _PopUpLayout.ShowPopup(PopUp);
                };

                //adiciona o evento ao controle de interface grafica
                btSeletor.GestureRecognizers.Add(tapGestureRecognizer);
                clickArea.GestureRecognizers.Add(tapGestureRecognizer);
            }
            catch (Exception ex)
            {
                DisplayLog(string.Format("{0} : {1}", "AtribuiEventoAbrirTipoOcorrencia", ex.Message));
            }
        }
예제 #3
0
        protected void ShowMegaLog()
        {
            XLabs.Forms.Controls.PopupLayout _PopUpLayoutCEP = new XLabs.Forms.Controls.PopupLayout();

            var oGeolocator = Resolver.Resolve <IGeolocator> ();

            List <Label> items = new List <Label>();

            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"],
                Text  = string.Format("Rede OK? >> {0} ", Sessao.onLine)
            });

            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("GPS? >> {0} ", oGeolocator.IsGeolocationAvailable)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Ocorrencia: {0} - {1}", Sessao.OcorrenciaAtiva.TipoOcorrencia.Id, Sessao.OcorrenciaAtiva.TipoOcorrencia.Descricao)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Descrição: {0} ", Sessao.OcorrenciaAtiva.Descricao)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Endereço: {0} ", Sessao.OcorrenciaAtiva.EnderecoFormatado)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Cidade: {0} ", Sessao.OcorrenciaAtiva.Cidade)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("CEP: {0} ", Sessao.OcorrenciaAtiva.Cep)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("CEP corrigido: {0} ", Sessao.OcorrenciaAtiva.CepCorrigido)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Imagem: {0} ", Sessao.OcorrenciaAtiva.NomeImagem)
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Latitude: {0} ", Sessao.OcorrenciaAtiva.Latitude.ToString())
            });
            items.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["regular_text"], Text = string.Format("Longitude: {0} ", Sessao.OcorrenciaAtiva.Longitude.ToString())
            });

            if (Sessao.GeoReturn != null)
            {
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Registros: {0}", Sessao.GeoReturn.results.Length.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg Lat: {0}", Sessao.GeoReturn.results [0].geometry.location.lat.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg Lng: {0}", Sessao.GeoReturn.results [0].geometry.location.lng.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg bds ne lat: {0}", Sessao.GeoReturn.results [0].geometry.bounds.northeast.lat.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg bds ne lng: {0}", Sessao.GeoReturn.results [0].geometry.bounds.northeast.lng.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg bds sw lat: {0}", Sessao.GeoReturn.results [0].geometry.bounds.southwest.lat.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg bds sw lng: {0}", Sessao.GeoReturn.results [0].geometry.bounds.southwest.lng.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg view ne lat: {0}", Sessao.GeoReturn.results [0].geometry.viewport.northeast.lat.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg view ne lng: {0}", Sessao.GeoReturn.results [0].geometry.viewport.northeast.lng.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg view sw lat: {0}", Sessao.GeoReturn.results [0].geometry.viewport.southwest.lat.ToString())
                });
                items.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["regular_text"],
                    Text  = string.Format("Reg view sw lng: {0}", Sessao.GeoReturn.results [0].geometry.viewport.southwest.lng.ToString())
                });
            }

            StackLayout header = new StackLayout();

            header.Style       = (Style)Application.Current.Resources ["dynamic_toolbar"];
            header.Padding     = 10;
            header.Spacing     = 10;
            header.Orientation = StackOrientation.Horizontal;
            header.Children.Add(new Image()
            {
                Style = (Style)Application.Current.Resources ["toolbar_icon"]
            });
            header.Children.Add(new Label()
            {
                Style = (Style)Application.Current.Resources ["toolbar_text"],
                Text  = "MEGA-HIPER-DARTH-VADER-LOG"
            });

            StackLayout subPop = new StackLayout {
                WidthRequest    = this.Width,              // Important, the Popup hast to have a size to be showed
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,             // for Android and WP
                Orientation     = StackOrientation.Vertical,
                Padding         = 20,
                Spacing         = 10
            };


            foreach (Label l in items)
            {
                if (!string.IsNullOrEmpty(l.Text))
                {
                    subPop.Children.Add(l);
                }
            }

            ScrollView s = new ScrollView {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            s.Content = subPop;


            StackLayout PopUp = new StackLayout {
                WidthRequest    = this.Width,              // Important, the Popup hast to have a size to be showed
                HeightRequest   = this.Height,
                BackgroundColor = Color.White,             // for Android and WP
                Orientation     = StackOrientation.Vertical,
                Padding         = 0,
                Spacing         = 20,
                Children        =
                {
                    header,
                    s
                }
            };



            ctrlPopup.Children.Add(s);
            ctrlPopup.IsVisible   = true;
            btnPublicar.IsVisible = false;
            controls.IsVisible    = false;

            _PopUpLayoutCEP.Content = ctrlPopup;
            _PopUpLayoutCEP.ShowPopup(PopUp);
        }
예제 #4
0
        protected void SolicitarCEP()
        {
            try
            {
                XLabs.Forms.Controls.PopupLayout _PopUpLayoutCEP = new XLabs.Forms.Controls.PopupLayout();

                Label title = new Label();
                title.Text  = "Usuário, não foi possível localizar as coordenadas de sua posição pelo GPS de seu celular. Por favor informe abaixo o CEP da localização da ocorrẽncia e clique no botão abaixo.";
                title.Style = (Style)Application.Current.Resources ["regular_text"];

                Entry txtUserZipCode = new Entry();
                txtUserZipCode.Style       = (Style)Application.Current.Resources ["entry_default"];
                txtUserZipCode.Placeholder = "Digite aqui o CEP";

                Button btnSearch = new Button();
                btnSearch.Style    = (Style)Application.Current.Resources ["button"];
                btnSearch.Text     = "Localizar Endereço";
                btnSearch.Clicked += async(sender, e) =>
                {
                    try {
                        IsBusy = true;

                        if (string.IsNullOrEmpty(txtUserZipCode.Text))
                        {
                            await DisplayAlert("TáVazando", "Informe um CEP válido", "Fechar");
                        }
                        else
                        {
                            await ObtemEnderecoPorCEP(txtUserZipCode.Text);

                            Application.Current.MainPage = new NavigationPage(new frmMain());

                            if (_PopUpLayoutCEP.IsPopupActive)
                            {
                                _PopUpLayoutCEP.DismissPopup();
                                ctrlPopup.IsVisible   = false;
                                btnPublicar.IsVisible = true;
                                controls.IsVisible    = true;
                            }
                        }
                    }
                    finally
                    {
                        IsBusy = false;
                    }
                };

                StackLayout header = new StackLayout();
                header.Style       = (Style)Application.Current.Resources ["dynamic_toolbar"];
                header.Padding     = 10;
                header.Spacing     = 10;
                header.Orientation = StackOrientation.Horizontal;
                header.Children.Add(new Image()
                {
                    Style = (Style)Application.Current.Resources ["toolbar_icon"]
                });
                header.Children.Add(new Label()
                {
                    Style = (Style)Application.Current.Resources ["toolbar_text"],
                    Text  = "Localização da Ocorrência"
                });

                StackLayout subPop = new StackLayout {
                    WidthRequest    = this.Width,                  // Important, the Popup hast to have a size to be showed
                    HeightRequest   = 300D,
                    BackgroundColor = Color.White,                 // for Android and WP
                    Orientation     = StackOrientation.Vertical,
                    Padding         = 20,
                    Spacing         = 10,
                    Children        =
                    {
                        title,
                        txtUserZipCode,
                        btnSearch
                    }
                };


                StackLayout PopUp = new StackLayout {
                    WidthRequest    = this.Width,                  // Important, the Popup hast to have a size to be showed
                    HeightRequest   = this.Height,
                    BackgroundColor = Color.White,                 // for Android and WP
                    Orientation     = StackOrientation.Vertical,
                    Padding         = 0,
                    Spacing         = 20,
                    Children        =
                    {
                        header,
                        subPop
                    }
                };

                ctrlPopup.Children.Add(PopUp);
                ctrlPopup.IsVisible   = true;
                btnPublicar.IsVisible = false;
                controls.IsVisible    = false;

                _PopUpLayoutCEP.Content = ctrlPopup;
                _PopUpLayoutCEP.ShowPopup(PopUp);
            } catch (Exception ex) {
                DisplayLog(string.Format("SolicitarCEP {0}", ex.Message));
            }finally{
                IsBusy = false;
            }
        }