public WebListener()
        {
            FirebaseConfig config = new FirebaseConfig {
                BasePath = "https://splatmap.firebase.com/clouds"
            }
            cloudsClient = new FirebaseClient(config);

            // start listening
            await cloudsClient.OnAsync("push", (sender, args) => {
                   System.Console.WriteLine(args.Data);
            });
        }
Ejemplo n.º 2
2
        private async void MainPage_OnLoaded(object sender, RoutedEventArgs e)
        {

            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = FirebaseSecret,
                BasePath = BasePath
            };

            _client = new FirebaseClient(config);

            await _client.OnAsync("chat",
                added: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox1.Text = args.Data + " -> 1(ADDED)";
                    });
                },
                changed: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox2.Text = string.Format("Data :{0}, Path: {1} -> 1(CHANGED)", args.Data, args.Path);
                    });
                },
                removed: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox3.Text = args.Path + " -> 1(REMOVED)";
                    });
                });

            await _client.OnAsync("chat",
                added: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox4.Text = args.Data + " -> 2(ADDED)";
                    });
                },
                changed: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox5.Text = string.Format("Data :{0}, Path: {1} -> 2(CHANGED)", args.Data, args.Path);
                    });
                },
                removed: (s, args) =>
                {
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        TextBox6.Text = args.Path + " -> 2(REMOVED)";
                    });
                });
        }
Ejemplo n.º 3
1
        private async void ListenToStream()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "a9UxW4ZVfdJRGHHQ8NusZmTZ0c3NRZgSlrakVXXM",
                BasePath   = "https://myxamarintest.firebaseio.com//"
            };
            IFirebaseClient client;

            client = new FirebaseClient(config);

            await client.OnAsync("MyClass", (sender, args, d) =>
            {
                //Gets the Unique ID and deletes the any other string attached to it
                string dataFromFB = args.Data;
                string paths      = args.Path;

                /* string key = RemoveNameSubstring(paths);
                 * string uniqueKey = key.Split('/').Last();
                 * if (keyHolder.ContainsKey(uniqueKey))
                 * {
                 *   keyHolder[uniqueKey] = dataFromFB;
                 *   AddToListView(dataFromFB);
                 * }
                 * else
                 * {
                 *   keyHolder.Add(uniqueKey, dataFromFB);
                 *   AddToListView(dataFromFB);
                 * }*/
            });
        }
Ejemplo n.º 4
0
        private static async void EventStreaming()
        {
            await _client.DeleteAsync("chat");

            await _client.OnAsync("chat",
                                  added : async(sender, args) =>
            {
                System.Console.WriteLine(args.Data + "-> 1\n");
                await _client.PushAsync("chat/", new
                {
                    name = "someone",
                    text = "Console 1:" + DateTime.Now.ToString("f")
                });
            },
                                  changed : (sender, args) => { System.Console.WriteLine(args.Data); },
                                  removed : (sender, args) => { System.Console.WriteLine(args.Path); });

            EventStreamResponse response = await _client.OnAsync("chat",
                                                                 added : (sender, args) => { System.Console.WriteLine(args.Data + " -> 2\n"); },
                                                                 changed : (sender, args) => { System.Console.WriteLine(args.Data); },
                                                                 removed : (sender, args) => { System.Console.WriteLine(args.Path); });

            //Call dispose to stop listening for events
            //response.Dispose();
        }
Ejemplo n.º 5
0
        private async void MainPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = FirebaseSecret,
                BasePath   = BasePath
            };

            _client = new FirebaseClient(config);

            await _client.OnAsync("chat",
                                  added : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox1.Text = args.Data + " -> 1(ADDED)";
                });
            },
                                  changed : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox2.Text = string.Format("Data :{0}, Path: {1} -> 1(CHANGED)", args.Data, args.Path);
                });
            },
                                  removed : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox3.Text = args.Path + " -> 1(REMOVED)";
                });
            });

            await _client.OnAsync("chat",
                                  added : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox4.Text = args.Data + " -> 2(ADDED)";
                });
            },
                                  changed : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox5.Text = string.Format("Data :{0}, Path: {1} -> 2(CHANGED)", args.Data, args.Path);
                });
            },
                                  removed : (s, args) =>
            {
                Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    TextBox6.Text = args.Path + " -> 2(REMOVED)";
                });
            });
        }
Ejemplo n.º 6
0
        private async void ContentPage_Appearing(object sender, EventArgs e)
        {
            if (Application.Current.Properties.ContainsKey("modo"))
            {
                var modo = Application.Current.Properties["modo"] as string;

                if (modo == "0")
                {
                    wvPrincipal.Source = new Uri("https://pepeizqdeals.com/classic/?app=true");
                }
                else
                {
                    wvPrincipal.Source = new Uri("https://pepeizqdeals.com/?app=true");
                }
            }
            else
            {
                wvPrincipal.Source = new Uri("https://pepeizqdeals.com/?app=true");
            }

            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "HtabeaAa9uFa0BN0uBQkBjy82MGcnhlVYVXjs1JM",
                BasePath   = "https://pepeizq-s-deals-android.firebaseio.com"
            };

            IFirebaseClient cliente = new FirebaseClient(config);

            EventStreamResponse response = await cliente.OnAsync("mensajes/", (s, args, context) => {
                CrossLocalNotifications.Current.Show(args.Data, "test");
            });
        }
Ejemplo n.º 7
0
 public async void ListenFirebase(DataGridView gridBook)
 {
     EventStreamResponse response = await client.OnAsync("books",
                                                         added : (sender, args, context) => { UpdateDataGridView(gridBook); },
                                                         changed : (sender, args, context) => { UpdateDataGridView(gridBook); },
                                                         removed : (sender, args, context) => { UpdateDataGridView(gridBook); });
 }
Ejemplo n.º 8
0
 public async void MesajKontrol()
 {
     try
     {
         FirebaseClient      client      = new FirebaseClient(config);
         EventStreamResponse eventStream = await client.OnAsync("Chat/" + Username.ToLower() + "/" + GidicekMesaj.ToLower() + "/RandomNumbers/", MesajGeldiginde);
     }
     catch
     {
     }
 }
Ejemplo n.º 9
0
        public async Task Listen()
        {
            IFirebaseClient client = new FirebaseClient(config);

            EventStreamResponse response = await client.OnAsync("chat", (sender, args, context) => {
                System.Console.WriteLine(args.Data);
            });

            //Call dispose to stop listening for events
            //response.Dispose();
        }
Ejemplo n.º 10
0
        private static async void EventStreaming()
        {
            await _client.DeleteAsync("chat");

            await _client.OnAsync("chat",
                                  added : async(sender, args) =>
            {
                System.Console.WriteLine(args.Data + "-> 1\n");
                await _client.PushAsync("chat/", new
                {
                    name = "someone",
                    text = "Console 1:" + DateTime.Now.ToString("f")
                });
            },
                                  changed : (sender, args) => { System.Console.WriteLine(args.Data); },
                                  removed : (sender, args) => { System.Console.WriteLine(args.Path); });

            await _client.OnAsync("chat",
                                  added : (sender, args) => { System.Console.WriteLine(args.Data + " -> 2\n"); },
                                  changed : (sender, args) => { System.Console.WriteLine(args.Data); },
                                  removed : (sender, args) => { System.Console.WriteLine(args.Path); });
        }
Ejemplo n.º 11
0
Archivo: FB.cs Proyecto: EdersF/sinp
        public async void Listener()            // exemplo de um listener
        {
            IFirebaseClient firebase = new FirebaseClient(config);

            await firebase.OnAsync("ruptura",
                                   //added
                                   (sender, args, context) =>
            {
                //MessageBox.Show(args.Data + " foi adicionado n/");
            },
                                   //changed
                                   (sender, args, context) =>
            {
                MessageBox.Show(args.Path + " foi alterado de " + args.OldData + " para " + args.Data);
            },
                                   // removed
                                   (sender, args, context) =>
            {
                //MessageBox.Show(args.Path + " foi deletado");
            });
        }
Ejemplo n.º 12
0
        private async void ListenToStream()
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "a9UxW4ZVfdJRGHHQ8NusZmTZ0c3NRZgSlrakVXXM",
                BasePath   = "https://myxamarintest.firebaseio.com//"
            };
            IFirebaseClient client;

            client = new FirebaseClient(config);

            await client.OnAsync("mensajes", added : (sender, args, d) =>
            {
                //Gets the Unique ID and deletes the any other string attached to it
                string dataFromFB = args.Data;
                string paths      = args.Path;


                valores.Add(paths, dataFromFB);
                if (valores.Count >= 5)
                {
                    Chat ct     = new Chat();
                    ChatVM ctVM = new ChatVM(ct);
                    for (int i = 0; i < valores.Count; i++)
                    {
                        if (valores.ElementAt(i).Key.EndsWith("MensajeChat"))
                        {
                            ct.MensajeChat = valores.ElementAt(i).Value;
                        }
                        else if (valores.ElementAt(i).Key.EndsWith("NombreChat"))
                        {
                            ct.NombreChat = valores.ElementAt(i).Value;
                        }
                    }


                    ListViewData.Insert(0, ctVM);
                    //ListViewData.Add();
                    //   if (listaChat.Count >= 20)
                    //   {



                    //  }
                    System.Diagnostics.Debug.WriteLine("Lista: " + ListViewData.Count.ToString());
                    // DisplayAlert("Alert", valores.ToString(), "OK");
                    valores.Clear();
                }
            }, changed : (sender, args, d) =>
            {
                //Gets the Unique ID and deletes the any other string attached to it
                string dataFromFB = args.Data;
                string paths      = args.Path;
            }
                                 , removed : (sender, args, d) =>
            {
                //Gets the Unique ID and deletes the any other string attached to it
                var dataFromFB = args;
                string paths   = args.Path;
            });
        }
Ejemplo n.º 13
0
        public async void ListenFirebaseToken()
        {
            EventStreamResponse response = await client.OnAsync("user/" + DataStatic.user,

                                                                changed : (sender, args, context) => { CheckToken(); });
        }
Ejemplo n.º 14
0
 private static async void EventStreaming()
 {
     await _client.OnAsync("chat", (sender, args) => { System.Console.WriteLine(args.Data); });
 }