private async void BtnInsert_Click(object sender, EventArgs e) { FirebaseResponse resp = await client.GetTaskAsync("Counter/node"); Counter_Class get = resp.ResultAs <Counter_Class>(); MessageBox.Show(get.cnt); var data = new Data { ID = Convert.ToInt32(get.cnt) + 1, MicroName = txtMicroName.Text, Status = txtStatus.Text, Command = txtCommand.Text, Complement = txtComplement.Text }; SetResponse response = await client.SetTaskAsync("Micro/" + data.ID, data); Data result = response.ResultAs <Data>(); var obj = new Counter_Class { cnt = data.ID.ToString() }; SetResponse response1 = await client.SetTaskAsync("Counter/node", obj); MessageBox.Show("Inserido " + result.MicroName + " com sucesso!"); }
async void ExportData() { int i = 0; FirebaseResponse resp1 = await client.GetTaskAsync("Counter/node"); Counter_Class counter = resp1.ResultAs <Counter_Class>(); int cnt = Convert.ToInt32(counter.cnt); while (true) { if (i == cnt) { break; } i++; try { FirebaseResponse resp2 = await client.GetTaskAsync("Micro/" + i); Data obj = resp2.ResultAs <Data>(); DataRow row = dataTable.NewRow(); row["ID"] = obj.ID; row["Micro"] = obj.MicroName; row["Status"] = obj.Status; dataTable.Rows.Add(row); } catch (Exception) { throw; } } }