private async void MesajGeldiginde(object sender, ValueAddedEventArgs args, object context) { try { FirebaseClient client = new FirebaseClient(config); string[] split = args.Data.Split(' '); for (int i = 0; i < split.Length; i++) { if (split[i] != null) { FirebaseResponse firebase = await client.GetAsync("Chat/" + Username.ToLower() + "/" + split[i]); Mesajlar2 mesajlar = firebase.ResultAs <Mesajlar2>(); if (mesajlar.Mesajimiz != null) { dataGridView1.Invoke((MethodInvoker) delegate { int rowcount = dataGridView1.Rows.Count; if (dataGridView1.Rows[rowcount - 1].Cells[0].Value.ToString() != mesajlar.Mesajimiz) { dataGridView1.Rows.Add(mesajlar.Mesajimiz, ""); } }); FirebaseResponse response2 = await client.GetAsync("Chat/" + Username.ToLower() + "/" + GidicekMesaj.ToLower() + "/RandomNumbers/"); Mesajlar mesajlar2 = response2.ResultAs <Mesajlar>(); string yenideger = mesajlar2.RandomNumbers.Replace(split[i], ""); var sifirla = new Mesajlar { RandomNumbers = yenideger }; SetResponse set = await client.SetAsync("Chat/" + Username.ToLower() + "/" + GidicekMesaj.ToLower() + "/RandomNumbers/", sifirla); Mesajlar mesajlar1 = set.ResultAs <Mesajlar>(); FirebaseResponse response = await client.DeleteAsync("Chat/" + Username.ToLower() + "/" + split[i]); } } } Array.Clear(split, 0, split.Length); } catch (Exception) { } }
public async void MesajKontrol() { try { FirebaseClient client = new FirebaseClient(config); EventStreamResponse eventStream = await client.OnAsync("Chat/" + Username.ToLower() + "/" + GidicekMesaj.ToLower() + "/RandomNumbers/", MesajGeldiginde); } catch { } }