public EstatisticasTempoRealData GetEstatisticasTempoReal()
        {
            List <string> categorias = new List <string>();

            try
            {
                NetworkStream stream  = client.GetStream();
                StreamReader  sr      = new StreamReader(stream);
                StreamWriter  sw      = new StreamWriter(stream);
                int           result  = 0;
                string        request = "getEstatisticasTempoReal/" + this.servico.get_id() + "/";
                sw.WriteLine(request);
                sw.Flush();
                string recebido = sr.ReadLine();
                Console.WriteLine("recebido " + recebido);
                string[] resultado = recebido.Split('/');

                return(EstatisticasTempoRealData.stringToEstatisticaData(recebido));
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public EstatisticasTempoReal(EstatisticasTempoRealData estatistica, TcpClient client)
        {
            InitializeComponent();
            EstatisticasTempoRealView view = new EstatisticasTempoRealView(estatistica);

            this.client = client;
            label1.Text = view.CongestaoAtual;
            label2.Text = view.TempoAtendimento;
            label3.Text = view.TempoEspera;
        }
 public EstatisticasTempoRealView(EstatisticasTempoRealData estatistica)
 {
     CongestaoAtual   = "Congestão Atual - " + estatistica.CongestaoAtual;
     TempoAtendimento = "Ticket com acesso ao sistema - " + estatistica.TempoAtendimento;
     TempoEspera      = "Tempo espera ótimo - " + estatistica.TempoEspera + " minutos";
 }
        async void  Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
            {
                return;
            }

            try
            {
                var item = e.SelectedItem as MenuItems;
                switch (item.OptionName)
                {
                case "Estatisticas em tempo real":
                {
                    EstatisticasTempoRealData estatistica = GetEstatisticasTempoReal();
                    await Navigation.PushAsync(new EstatisticasTempoReal(estatistica, this.client));        //mudar para Estatisticas
                }
                break;

                case "Histórico":
                {
                    await Navigation.PushAsync(new HistoricoDiario(this.servico, this.client));        //mudar para histórico
                }
                break;

                case "Retirar Ticket":
                {
                    await Navigation.PushAsync(new RetirarTicket(this.servico, this.client, this.latitude, this.longitude));      //mudar para retirarticket
                }
                break;

                case "Informações":
                {
                    await Navigation.PushAsync(new Contactos(this.servico));         //mudar para contactar
                }
                break;

                case "Adicionar aos Favoritos":
                {
                    addFavorito();
                    await Navigation.PopAsync();
                }
                break;

                case "Remover dos Favoritos":
                {
                    removeFavorito();
                    await Navigation.PopAsync();
                }
                break;
                }
            }

            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                listView.SelectedItem = null;
            }
        }