public async void button1_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).ToString(),/* textBox1.Text,*/ NAME = textBox2.Text, ADDRESS = textBox3.Text, AGE = textBox4.Text, }; SetResponse response = await client.SetTaskAsync("Information/" + data.ID, data); Data result = response.ResultAs <Data>(); MessageBox.Show("Data Inserted"); var obj = new Counter_class { cnt = data.ID }; SetResponse response1 = await client.SetTaskAsync("Counter/node", obj); }
public async void export() { dt.Rows.Clear(); int i = 0; FirebaseResponse resp1 = await client.GetTaskAsync("Counter/node"); Counter_class obj1 = resp1.ResultAs <Counter_class>(); int cnt = Convert.ToInt32(obj1.cnt); while (true) { if (i == cnt) { break; } i++; try { var response = await client.GetTaskAsync("Information"); /*Data obj2 = resp2.ResultAs<Data>(); * DataRow row = dt.NewRow();*/ var result = response.ResultAs <Dictionary <string, Data> >(); foreach (var item in result) { var value = item.Value; DataRow row = dt.NewRow(); row["ID"] = value.ID; row["NAME"] = value.NAME; row["ADDRESS"] = value.ADDRESS; row["AGE"] = value.AGE; dt.Rows.Add(row); } } catch { } } MessageBox.Show("DONE!"); }