private void inicializarReativarButton() { _reativarButton = new MenuItem { CommandParameter = "{Binding .}", Text = "Reativar", IsDestructive = true }; _reativarButton.Clicked += (object sender, EventArgs e) => { RadarBLL regraRadar = RadarFactory.create(); RadarInfo radar = (RadarInfo)((MenuItem)sender).BindingContext; radar.Ativo = true; regraRadar.gravar(radar); var radarListView = (ListView)this.Parent; var contentPagina = (ContentPage)radarListView.Parent; var pagina = (RadarListaPage)contentPagina.Parent; pagina.atualizarRadar(); }; ContextActions.Add(_reativarButton); }
protected virtual void inicializarComponente() { _GPSSentidoLabel = new Label { Text = "0º", FontSize = 16, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center }; AbsoluteLayout.SetLayoutBounds(_GPSSentidoLabel, new Rectangle(0.9, 0.12, 0.15, 0.15)); //AbsoluteLayout.SetLayoutBounds(_PrecisaoLabel, new Rectangle(0.11, 0.12, 0.15, 0.15)); AbsoluteLayout.SetLayoutFlags(_GPSSentidoLabel, AbsoluteLayoutFlags.All); _VelocidadeRadarLabel = new Label { Text = "Velocidade", FontSize = 16, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center }; if (Device.OS == TargetPlatform.iOS) { } AbsoluteLayout.SetLayoutBounds(_VelocidadeRadarLabel, new Rectangle(1, 0.950, 1, 0.1)); AbsoluteLayout.SetLayoutFlags(_VelocidadeRadarLabel, AbsoluteLayoutFlags.All); _DistanciaRadarLabel = new Label { Text = "0 m", FontSize = 16, //HorizontalTextAlignment = TextAlignment.Center, //VerticalTextAlignment = TextAlignment.Center }; //AbsoluteLayout.SetLayoutBounds(_DistanciaRadarLabel, new Rectangle(1, 0.975, 1, 0.1)); //AbsoluteLayout.SetLayoutFlags(_DistanciaRadarLabel, AbsoluteLayoutFlags.All); if (PreferenciaUtils.ExibirBotaoRemover) { _RemoverRadarButton = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("menos.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_RemoverRadarButton, new Rectangle(0.93, 0.975, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_RemoverRadarButton, AbsoluteLayoutFlags.All); _RemoverRadarButton.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { //var regraAviso = new AvisoSonoroBLL(); //regraAviso.play(RadarTipoEnum.RadarFixo, 40, 300); //AudioUtils.play(AudioEnum.Alarm001); //MensagemUtils.avisar("teste"); //var downloader = new DownloaderAtualizacao(); //downloader.download(); if (InternetUtils.estarConectado()) { LocalizacaoInfo local = GPSUtils.UltimaLocalizacao; float latitude = (float)local.Latitude; float longitude = (float)local.Longitude; GeocoderUtils.pegarAsync(latitude, longitude, (sender, e) => { var endereco = e.Endereco; ClubManagement.Utils.MensagemUtils.avisar(endereco.Logradouro); }); } try { LocalizacaoInfo local = GPSUtils.UltimaLocalizacao; if (local != null) { RadarBLL regraRadar = RadarFactory.create(); regraRadar.gravar(local, false); MensagemUtils.avisar("Radar incluído com sucesso."); } else { MensagemUtils.avisar("Nenhum movimento registrado pelo GPS."); } } catch (Exception e) { MensagemUtils.avisar(e.Message); } } ) }); } if (PreferenciaUtils.ExibirBotaoAdicionar) { _AdicionarRadarButton = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("mais.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_AdicionarRadarButton, new Rectangle(0.93, 0.975, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_AdicionarRadarButton, AbsoluteLayoutFlags.All); if (TelaUtils.Orientacao == "Landscape") { AbsoluteLayout.SetLayoutBounds(_AdicionarRadarButton, new Rectangle(1, 0.5, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_AdicionarRadarButton, AbsoluteLayoutFlags.All); } _AdicionarRadarButton.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { //var regraAviso = new AvisoSonoroBLL(); //regraAviso.play(RadarTipoEnum.RadarFixo, 40, 300); //AudioUtils.play(AudioEnum.Alarm001); //MensagemUtils.avisar("teste"); //var downloader = new DownloaderAtualizacao(); //downloader.download(); if (InternetUtils.estarConectado()) { LocalizacaoInfo local = GPSUtils.UltimaLocalizacao; float latitude = (float)local.Latitude; float longitude = (float)local.Longitude; GeocoderUtils.pegarAsync(latitude, longitude, (sender, e) => { var endereco = e.Endereco; ClubManagement.Utils.MensagemUtils.avisar(endereco.Logradouro); }); } try { LocalizacaoInfo local = GPSUtils.UltimaLocalizacao; if (local != null) { RadarBLL regraRadar = RadarFactory.create(); regraRadar.gravar(local, false); MensagemUtils.avisar("Radar incluído com sucesso."); } else { MensagemUtils.avisar("Nenhum movimento registrado pelo GPS."); } } catch (Exception e) { MensagemUtils.avisar(e.Message); } } ) }); } _BussolaFundo = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("bussolacorpo.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_BussolaFundo, new Rectangle(0.93, 0, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_BussolaFundo, AbsoluteLayoutFlags.All); _BussolaAgulha = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("bussolaagulha.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_BussolaAgulha, new Rectangle(0.93, 0, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_BussolaAgulha, AbsoluteLayoutFlags.All); _PrecisaoFundoImage = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("bussolacorpo.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_PrecisaoFundoImage, new Rectangle(0.07, 0, 0.2, 0.2)); AbsoluteLayout.SetLayoutFlags(_PrecisaoFundoImage, AbsoluteLayoutFlags.All); _PrecisaoImage = new Image { Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("sat04.png"), WidthRequest = 180, HeightRequest = 180 }; AbsoluteLayout.SetLayoutBounds(_PrecisaoImage, new Rectangle(0.11, 0.04, 0.15, 0.15)); AbsoluteLayout.SetLayoutFlags(_PrecisaoImage, AbsoluteLayoutFlags.All); _PrecisaoLabel = new Label { Text = "0 m", FontSize = 16, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center }; //AbsoluteLayout.SetLayoutBounds(_PrecisaoLabel, new Rectangle(0.1, 0.025, 0.1, 0.1)); AbsoluteLayout.SetLayoutBounds(_PrecisaoLabel, new Rectangle(0.11, 0.12, 0.15, 0.15)); AbsoluteLayout.SetLayoutFlags(_PrecisaoLabel, AbsoluteLayoutFlags.All); }