Example #1
0
        private async void LinkLb_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FirebaseResponse responseI = await client.GetAsync("/Indexes/");

            IndexesClass indexes = responseI.ResultAs <IndexesClass>();

            int index = indexes.LDR;

            graph.ldrIndex = index;

            for (int i = 1; i <= index; i++)
            {
                FirebaseResponse responseD = await client.GetAsync("/Sensores/LDR/" + i.ToString());

                DataClass data = responseD.ResultAs <DataClass>();

                graph.setldrValue(i, data.Valor);
            }

            index          = indexes.Pot;
            graph.potIndex = index;

            for (int i = 1; i <= index; i++)
            {
                FirebaseResponse responseD = await client.GetAsync("/Sensores/Pot/" + i.ToString());

                DataClass data = responseD.ResultAs <DataClass>();

                graph.setpotValue(i, data.Valor);
            }

            gf.ShowDialog();
        }
Example #2
0
        private async void Timer1_Tick(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetAsync("/Respostas");

            RespostaClass resposta = response.ResultAs <RespostaClass>();

            FirebaseResponse responseI = await client.GetAsync("/Indexes/");

            IndexesClass indexes = responseI.ResultAs <IndexesClass>();

            if (resposta.Pot)
            {
                string index = (indexes.Pot).ToString();

                FirebaseResponse responseP = await client.GetAsync("/Sensores/Pot/" + index);

                DataClass data = responseP.ResultAs <DataClass>();

                lbDataPot.Text  = data.Data;
                lbHoraPot.Text  = data.Hora;
                lbValorPot.Text = data.Valor;

                resposta.LDR = false;
                resposta.Pot = false;

                FirebaseResponse resposeRR = await client.SetAsync("/Respostas", resposta);
            }
            if (resposta.LDR)
            {
                string index = (indexes.LDR).ToString();

                FirebaseResponse responseD = await client.GetAsync("/Sensores/LDR/" + index);

                DataClass data = responseD.ResultAs <DataClass>();

                lbDataLdr.Text  = data.Data;
                lbHoraLdr.Text  = data.Hora;
                lbValorLdr.Text = data.Valor;

                resposta.LDR = false;
                resposta.Pot = false;

                FirebaseResponse resposeRR = await client.SetAsync("/Respostas", resposta);
            }
        }