Example #1
0
        private void GetTickets()
        {
            Action <Dictionary <string, TicketModel> > onValueEvent = (Dictionary <string, TicketModel> tickets) =>
            {
                try
                {
                    System.Diagnostics.Debug.WriteLine("---> EVENT GetDataFromFirebase ");

                    Action onSetValueSuccess = () =>
                    {
                    };

                    Action <string> onSetValueError = (string errorDesc) =>
                    {
                    };

                    if (tickets != null)
                    {
                        ticketinfo.IsVisible = false;

                        if (tickets.Count != 0 && tickets.Count != ticketsList.Count)
                        {
                            ticketsList.Clear();

                            foreach (KeyValuePair <string, TicketModel> item in tickets)
                            {
                                if (ticketsList.All(d => d.Key != item.Value.Key))
                                {
                                    ticketsList.Add(item.Value);
                                }
                            }
                        }
                    }
                    else
                    {
                        ticketsList.Clear();
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("---> error GetDataFromFirebase " + ex.Message + " , Source" + ex.Source);
                    throw;
                }
            };

            _firebaseDatabase.GetTickets("tickets", onValueEvent);
        }