예제 #1
0
        private void gravarPercurso()
        {
            PercursoBLL regraPercurso = PercursoFactory.create();

            if (regraPercurso.iniciarGravacao())
            {
                _RootLayout.Children.Remove(_GravarButton);
                _RootLayout.Children.Add(_PararButton);
            }
            else
            {
                MensagemUtils.avisar("Não foi possível iniciar a gravação!");
            }
        }
        void gravarPercurso(object sender, EventArgs e)
        {
            //Label gravarButton = (Label)sender;
            PercursoBLL regraPercurso = PercursoFactory.create();

            if (PercursoBLL.Gravando)
            {
                if (regraPercurso.pararGravacao())
                {
                    gravarLabel.Text = "Gravar Percurso!";
                    infoLabel.Text   = "Toque aqui para iniciar a gravação";
                    stackDescricaoGravando.Children.Add(gravarLabel);
                    stackDescricaoGravando.Children.Add(infoLabel);
                    stackDescricaoGravando.Children.Remove(desc);

                    icoPlay.Source = ImageSource.FromFile("Play.png");
                    Emagine.Utils.MensagemUtils.avisar("Gravação finalizada!");
                    Emagine.Utils.MensagemUtils.pararNotificaoPermanente(PercursoBLL.NOTIFICACAO_GRAVAR_PERCURSO_ID);

                    var percursos = regraPercurso.listar();
                    percursoListView.BindingContext = percursos;
                    percursoListView.ItemTemplate   = new DataTemplate(typeof(PercursoPageCell));
                    percursoListView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
                }
                else
                {
                    Emagine.Utils.MensagemUtils.avisar("Não foi possível parar a gravação!");
                }
            }
            else
            {
                if (regraPercurso.iniciarGravacao((s2, e2) =>
                {
                    tempoCorrendo.Text = e2.Ponto.TempoGravacao.ToString();
                    tempoParado.Text = e2.Ponto.TempoParadoStr;

                    paradas.Text = e2.Ponto.QuantidadeParadaStr;

                    velocidadeMedia.Text = e2.Ponto.VelocidadeMediaStr;

                    velocidadeMaxima.Text = e2.Ponto.VelocidadeMaximaStr;

                    radares.Text = e2.Ponto.QuantidadeRadarStr;
                }))
                {
                    stackDescricaoGravando.Children.Remove(gravarLabel);
                    stackDescricaoGravando.Children.Remove(infoLabel);
                    stackDescricaoGravando.Children.Add(desc);

                    /*
                     * //PercursoInfo percursoInfo = new PercursoInfo();
                     *
                     * tempoCorrendo.Text = percursoInfo.TempoGravacaoStr ;
                     *
                     * tempoParado.Text = percursoInfo.TempoParadoStr;
                     *
                     * paradas.Text = percursoInfo.QuantidadeParadaStr;
                     *
                     * velocidadeMedia.Text = percursoInfo.VelocidadeMediaStr;
                     *
                     * velocidadeMaxima.Text = percursoInfo.VelocidadeMaximaStr;
                     *
                     * radares.Text = percursoInfo.QuantidadeRadarStr;
                     */

                    icoPlay.Source = ImageSource.FromFile("Stop.png");
                    Emagine.Utils.MensagemUtils.avisar("Iniciando gravação do percurso!");
                    Emagine.Utils.MensagemUtils.notificarPermanente(
                        PercursoBLL.NOTIFICACAO_GRAVAR_PERCURSO_ID,
                        "Gravando Percurso...", "",
                        PercursoBLL.NOTIFICACAO_PARAR_PERCURSO_ID,
                        "Parar", PercursoBLL.ACAO_PARAR_GRAVACAO
                        );
                }
                else
                {
                    Emagine.Utils.MensagemUtils.avisar("Não foi possível iniciar a gravação!");
                }
            }
        }