Example #1
0
 /// <summary>
 /// Update this firebase instance
 /// </summary>
 /// <param name="snapshot">Snapshot.</param>
 IEnumerator Modify(IDataSnapshot snapshot)
 {
     try {
         items = snapshot.DictionaryValue;
     } catch (ArgumentNullException) {         }
     yield return(null);
 }
Example #2
0
 /// <summary>
 /// This instance died, explode it locally
 /// </summary>
 /// <param name="snapshot">Snapshot.</param>
 IEnumerator Remove(IDataSnapshot snapshot)
 {
     try {
         items.Remove(snapshot.Key);
     } catch (ArgumentNullException) {         }
     yield return(null);
 }
Example #3
0
        private void AddOrUpdate(IDataSnapshot snap)
        {
            Debug.Print(snap.Key);
            string previousKey = this.LastKey;

            foreach (IDataSnapshot child in snap.Children)
            {
                IFireObject fireObjectInstance = (IFireObject)JsonConvert.DeserializeObject(child.Value(), this.ObjectType);
                fireObjectInstance.Key = child.Key;
                this.addOrUpdate(fireObjectInstance);
            }

            if (previousKey != this.LastKey)
            {
                myQuery.Off();

                if (this.UserId != null)
                {
                    //filter on user //.StartAtKey(lastKey)
                    myQuery = FireDictDelegate.firebaseApp.Child(this.Path).OrderByChild(USERIDKEY).EqualTo(this.UserId).StartAtKey(lastKey).On(FIREEVENTADD, (snap2, previous_child, context) => AddOrUpdate(snap2));
                }
                else
                {
                    myQuery = FireDictDelegate.firebaseApp.Child(this.Path).StartAtKey(lastKey).On(FIREEVENTADD, (snap2, previous_child, context) => AddOrUpdate(snap2));
                }
            }
        }
Example #4
0
 private void AddOrUpdate(IDataSnapshot snap)
 {
     var ignored = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         SetDataList(snap);
     });
 }
Example #5
0
        private void Removed(IDataSnapshot snap, string previous_child, object context)
        {
            Debug.Print(snap.Key);
            IFireObject fireObjectInstance = (IFireObject)JsonConvert.DeserializeObject(snap.Value(), this.ObjectType);

            fireObjectInstance.Key = snap.Key;
            this.remove(fireObjectInstance);
        }
Example #6
0
 void OnReceiveFirebaseData(object sender, FirebaseChangedEventArgs e)
 {
     shot = e.DataSnapshot;
     Debug.Log("ValueUpdated: " + shot.StringValue);
     root.ValueUpdated     -= OnReceiveFirebaseData;
     dataRetrievalInProcess = false;
     dataSnapshotToleaderboardEntries();
     OnDataReceived(leaderboardEntries);
 }
Example #7
0
 private void dataSnapshotToleaderboardEntries()
 {
     for (int i = 1; i <= 10; i++)
     {
         IDataSnapshot snapshot = shot.Child(i.ToString());
         leaderboardEntries [i - 1].name  = snapshot.Child("Name").StringValue;
         leaderboardEntries [i - 1].score = int.Parse(snapshot.Child("Score").StringValue);
     }
 }
Example #8
0
        private void SetDataList(IDataSnapshot snap)
        {
            List <DataSample> _firebaseItems = JsonConvert.DeserializeObject <List <DataSample> >(snap.Value());

            AnimateRows(GetDifferentFromFirebase(_firebaseItems));
            if (DataList.Items.Count == 0) //When you start app, your DataList is empty
            {
                InitializeDataListView(_firebaseItems);
            }
        }
Example #9
0
        private void UpdateChart(IDataSnapshot snap)
        {
            chart1.Series["Weather"].Points.Clear();
            foreach (var update in snap.Children)
            {
                int   index = int.Parse(update.Key);
                float temp  = update.Child("apparentTemperature").Value <float>();
                chart1.Series["Weather"].Points.AddXY(index, temp);
            }

            chart1.Invalidate();
        }
Example #10
0
        public Painting(IDataSnapshot data)
        {
            decimal tempPrice = 0m;

            this.ID          = data.Key;
            this.Artist      = data.Child("artist").Value();
            this.ImageSource = data.Child("imgSrc").Value();

            decimal.TryParse(data.Child("price").Value(), out tempPrice);
            this.Price = tempPrice;
            this.Title = data.Child("title").Value();
        }
Example #11
0
	/// <summary>
	/// This instance was created, init it
	/// </summary>
	/// <param name="snapshot">Snapshot.</param>
	IEnumerator Add (IDataSnapshot snapshot) {
		try {
			if (items == null) {
				items = new Dictionary<string,object>();
			}
			items [snapshot.Key] = snapshot.DictionaryValue;
			Vector3 initPos = JsonUtility.FromJson<Vector3>(snapshot.DictionaryValue["position"].ToString());
			GameObject ship = (GameObject)Instantiate(prefab,initPos,Quaternion.identity);
			ship.GetComponent<NetworkItem>().identifier = snapshot.Key;
		} catch (ArgumentNullException) {         }
		yield return null;
	}
Example #12
0
        private void UpdateChart(IDataSnapshot snap)
        {
            chart1.Series["Weather"].Points.Clear();
            foreach (var update in snap.Children)
            {
                int index = int.Parse(update.Key);
                float temp = update.Child("apparentTemperature").Value<float>();
                chart1.Series["Weather"].Points.AddXY(index, temp);
            }

            chart1.Invalidate();
        }
Example #13
0
 /// <summary>
 /// This instance was created, init it
 /// </summary>
 /// <param name="snapshot">Snapshot.</param>
 IEnumerator Add(IDataSnapshot snapshot)
 {
     try {
         if (items == null)
         {
             items = new Dictionary <string, object>();
         }
         items [snapshot.Key] = snapshot.DictionaryValue;
         Vector3    initPos = JsonUtility.FromJson <Vector3>(snapshot.DictionaryValue["position"].ToString());
         GameObject ship    = (GameObject)Instantiate(prefab, initPos, Quaternion.identity);
         ship.GetComponent <NetworkItem>().identifier = snapshot.Key;
     } catch (ArgumentNullException) {         }
     yield return(null);
 }
Example #14
0
 private void getEnemyId()
 {
     //have BATTLE ID first
     FireBase_battle = Firebase.CreateNew(FIRE_BASE_HOST + "battle/" + BATTLE_ID);
     FireBase_battle.Push().SetValue(playerId);
     battlePlayerChildAddedEventHandler = (object sender, ChangedEventArgs e) =>
     {
         IDataSnapshot dataSnap = e.DataSnapshot;
         Logger.gameControl("FireBase_battle ChildAdded {0}, {1}", dataSnap.Key, dataSnap.StringValue);
         if (!playerId.Equals(dataSnap.StringValue))
         {
             enemyId       = dataSnap.StringValue;
             gotoStartGame = true;
             //Loom.QueueOnMainThread(() =>
             //{
             //    gameStart();
             //});
             FireBase_battle.ChildAdded -= battlePlayerChildAddedEventHandler;
         }
     };
     FireBase_battle.ChildAdded += battlePlayerChildAddedEventHandler;
 }
        private void RemoveItem(IDataSnapshot snap)
        {
            UIElement found = null;

            foreach (UIElement ui in PaintCanvas.Children)
            {
                Rectangle r = ui as Rectangle;
                if (r != null)
                {
                    if (r.Tag.ToString() == snap.Key)
                    {
                        found = r;
                        break;
                    }
                }
            }

            if (found != null)
            {
                PaintCanvas.Children.Remove(found);
            }
        }
Example #16
0
        private void RemoveItem(IDataSnapshot snap)
        {
            UIElement found = null;

            foreach (UIElement ui in PaintCanvas.Children)
            {
                Rectangle r = ui as Rectangle;
                if (r != null)
                {
                    if (r.Tag.ToString() == snap.Key)
                    {
                        found = r;
                        break;
                    }
                }
            }

            if (found != null)
            {
                PaintCanvas.Children.Remove(found);
            }
        }
Example #17
0
	/// <summary>
	/// This instance was created, init it
	/// </summary>
	/// <param name="snapshot">Snapshot.</param>
	IEnumerator Add (IDataSnapshot snapshot) {
		try {
			if (items == null) {
				items = new Dictionary<string,object>();
			}

			//Move players involved
			items [snapshot.Key] = snapshot.DictionaryValue;
			if (snapshot.Key.StartsWith("Player_")) {
				Vector3 initPos = JsonUtility.FromJson<Vector3>(snapshot.DictionaryValue["position"].ToString());
				GameObject player = (GameObject)Instantiate(prefab,initPos,Quaternion.identity);
				player.transform.parent = transform;
				player.GetComponent<NetworkItem>().identifier = snapshot.Key;
			}
			if (snapshot.Key == _levelPrefix)
			{
				var level = this.gameObject.GetComponentInChildren<LevelScript>();

				level.PopulateLayers(snapshot.DictionaryValue, this);
			}
		} catch (ArgumentNullException) {         }
		yield return null;
	}
 private void Removed(IDataSnapshot snap)
 {
     Dispatcher.Invoke(() => RemoveItem(snap));
 }
Example #19
0
	/// <summary>
	/// This instance died, explode it locally
	/// </summary>
	/// <param name="snapshot">Snapshot.</param>
	IEnumerator Remove (IDataSnapshot snapshot) {
		try {
			items.Remove (snapshot.Key);
		} catch (ArgumentNullException) {         }
		yield return null;
	}
Example #20
0
        private void PaintItem(IDataSnapshot snap)
        {
            Point p = NormalizedPointFromFirebase(snap.Key);

            PaintPoint(p, GetBrushFromFirebaseColor(snap.Value()));
        }
 private void PaintItem(IDataSnapshot snap)
 {
     Point p = NormalizedPointFromFirebase(snap.Key);
     PaintPoint(p, GetBrushFromFirebaseColor(snap.Value()));
 }
Example #22
0
 private void AddOrUpdate(IDataSnapshot snap)
 {
     Dispatcher.Invoke(() => PaintItem(snap));
 }
Example #23
0
 private void Removed(IDataSnapshot snap)
 {
     Dispatcher.Invoke(() => RemoveItem(snap));
 }
Example #24
0
    /***
     * The Firebase structure should be eventRoot--eventId
     *                                        --eventId
     *                                        --eventId
     *                                        --eventId
     * And dataSnap.key is the eventId.
     */
    public static List <RemoteEventBase> getBattleEventValue(IDataSnapshot dataSnap)
    {
        List <RemoteEventBase> result = new List <RemoteEventBase>();

        Logger.firebase("getFirebaseValue event root " + dataSnap.Key);
        Logger.firebase("getFirebaseValue String " + dataSnap.StringValue);

        Dictionary <string, object> dic = dataSnap.DictionaryValue;
        string eventId = dataSnap.Key;

        //foreach (string eventId in dic.Keys)
        //{
        if (mHandledEventList.Contains(eventId))
        {
            Logger.firebase("getFirebaseValue ignore " + eventId);
            return(null);
        }
        //object eventValue = null;
        //dic.TryGetValue(eventId, out eventValue);
        object eventValue = dataSnap.DictionaryValue;

        Logger.firebase("getFirebaseValue handle event id " + eventId);
        Logger.firebase("getFirebaseValue handle event content " + eventValue);

        Dictionary <string, object> theEvents = (Dictionary <string, object>)eventValue;

        string  actionName = null, actor = null, act_target = null, playerId = null, timeStamp = null;
        Vector3 currentLocation = Vector3.one, targetLocation = Vector3.one;
        float   x = 0, y = 0, z = 0;
        Dictionary <string, object> temploc = null;

        object temp       = null;
        object tempVector = null;

        foreach (string key in theEvents.Keys)
        {
            temp = null;
            theEvents.TryGetValue(key, out temp);

            Logger.firebase("getFirebaseValue handle event content key " + key);
            Logger.firebase("getFirebaseValue handle event content value " + temp);

            switch (key)
            {
            case RemoteEventBase.KEY_ACTION_NAME:
                actionName = (string)temp;
                break;

            case RemoteEventBase.KEY_ACTOR:
                actor = (string)temp;
                break;

            case RemoteEventBase.KEY_ACT_TARGET:
                act_target = (string)temp;
                break;

            case RemoteEventBase.KEY_PLAYER_ID:
                playerId = (string)temp;
                break;

            case RemoteEventBase.KEY_TIME_STAMP:
                timeStamp = (string)temp;
                break;

            case RemoteEventBase.KEY_LOC_CURRENT:
                temploc = (Dictionary <string, object>)temp;
                foreach (string vectorkey in temploc.Keys)
                {
                    temploc.TryGetValue(vectorkey, out tempVector);
                    {
                        Debug.Log("getFirebaseValue handle locCurrent event key " + vectorkey);
                        Debug.Log("getFirebaseValue handle locCurrent event value " + tempVector.ToString());
                        Debug.Log("getFirebaseValue handle locCurrent event value " + float.Parse(tempVector.ToString()));
                        Debug.Log("getFirebaseValue handle locCurrent event value " + tempVector);
                    }
                    switch (vectorkey)
                    {
                    case RemoteEventBase.KEY_VECTOR_X:
                        x = float.Parse(tempVector.ToString());
                        break;

                    case RemoteEventBase.KEY_VECTOR_Y:
                        y = float.Parse(tempVector.ToString());
                        break;

                    case RemoteEventBase.KEY_VECTOR_Z:
                        z = float.Parse(tempVector.ToString());
                        break;
                    }
                }
                currentLocation = new Vector3(x, y, z);
                break;

            case RemoteEventBase.KEY_LOC_TARGET:
                temploc = (Dictionary <string, object>)temp;
                foreach (string vectorkey in temploc.Keys)
                {
                    temploc.TryGetValue(vectorkey, out tempVector);
                    switch (vectorkey)
                    {
                    case RemoteEventBase.KEY_VECTOR_X:
                        x = float.Parse(tempVector.ToString());
                        break;

                    case RemoteEventBase.KEY_VECTOR_Y:
                        y = float.Parse(tempVector.ToString());
                        break;

                    case RemoteEventBase.KEY_VECTOR_Z:
                        z = float.Parse(tempVector.ToString());
                        break;
                    }
                }
                targetLocation = new Vector3(x, y, z);
                break;

            default:
                break;
            }
        }
        RemoteEventBase singleEvent = new RemoteEventBase(eventId, actionName, actor, act_target, playerId, timeStamp, currentLocation, targetLocation);

        mHandledEventList.Add(eventId);
        result.Add(singleEvent);
        Logger.firebase("getFirebaseValue add event " + eventId);
        //}

        Logger.firebase("getFirebaseValue count " + result.Count);

        return(result);
    }
Example #25
0
    // Use this for initialization
    private void gameStart()
    {
        Debug.Log("GameController start+");
        _gameProcessing = true;
        controlUIPanelHost.SetActive(true);
        unitControlPanels = controlUIPanelHost.GetComponentsInChildren <UnitControlPanel>();

        createHumanoid();


        FireBase_battle_event = FireBase_battle.Child(RemoteEventBase.KEY_EVENT_ROOT);
        ////firebase.AuthWithPassword("*****@*****.**", "iloveawei", (AuthData auth) =>
        ////{
        ////    Debug.Log("auth success!!" + auth.Uid);
        ////}, (FirebaseError e) =>
        ////{
        ////    Debug.Log("auth failure!!");
        ////});

        FireBase_battle_event.ChildAdded += (object sender, ChangedEventArgs e) =>
        {
            IDataSnapshot dataSnap = e.DataSnapshot;


            Logger.firebase("Child added! " + sender + ", " + e + ", " + dataSnap.Key);

            try
            {
                List <RemoteEventBase> result = FireBaseUtil.getBattleEventValue(dataSnap);
                onRemoteEvents(result);
            } catch (Exception ex) {
                Debug.Log(ex.Message);
            }

            //    ////String x = dataSnap.Child("x").StringValue;
            //    ////String y = dataSnap.Child("y").StringValue;
            //    ////String z = dataSnap.Child("z").StringValue;

            //    //Dictionary<string, object> value = dataSnap.DictionaryValue;
            //    //string x = value["x"].ToString();
            //    //string y = value["y"].ToString();
            //    //string z = value["z"].ToString();

            //    //if (debugFirebase)
            //    //    Debug.Log("Child added! " + dataSnap.Key + ", s " + dataSnap.DictionaryValue + ", x " + x + ", y " + y + ", z " + z);

            //    //Vector3 p = new Vector3(float.Parse(x), float.Parse(y), float.Parse(z));
            //    //foreach (Humanoid h in humanoid)
            //    //{
            //    //    h.onRemoteUpdate(Int32.Parse(dataSnap.Key), p);
            //    //};
        };

        //firebase.ChildRemoved += (object sender, ChangedEventArgs e) =>
        //{
        //    IDataSnapshot dataSnap = e.DataSnapshot;
        //    if (debugFirebase)
        //        Debug.Log("Child removed! " + sender + ", " + e + ", " + dataSnap);
        //};

        FireBase_battle_event.ValueUpdated += (object sender, ChangedEventArgs ex) => {
            IDataSnapshot dataSnap = ex.DataSnapshot;
            Logger.firebase("Child ValueUpdated! " + sender + ", " + ex + ", " + dataSnap.Key);

            //    //String x = dataSnap.Child("x").StringValue;
            //    //String y = dataSnap.Child("y").StringValue;
            //    //String z = dataSnap.Child("z").StringValue;

            //    //Debug.Log("Child ValueUpdated! " + dataSnap.Key + ", " + dataSnap.StringValue + ", " + x + ", " + y + ", " + z);

            //    //Vector3 p = new Vector3(x, y, z);
            //    //foreach (Humanoid h in humanoid)
            //    //{
            //    //    h.onRemoteUpdate(Int32.Parse(dataSnap.Key), p);
            //    //};

            //    //try
            //    //{
            //    //    Dictionary<string, object> value = dataSnap.DictionaryValue;
            //    //    string x = value["x"].ToString();
            //    //    string y = value["y"].ToString();
            //    //    string z = value["z"].ToString();

            //    //    Debug.Log("Child ValueUpdated! " + dataSnap.Key + ", s " + dataSnap.DictionaryValue + ", x " + x + ", y " + y + ", z " + z);

            //    //    Vector3 p = new Vector3(float.Parse(x), float.Parse(y), float.Parse(z));
            //    //    foreach (Humanoid h in humanoid)
            //    //    {
            //    //        h.onRemoteUpdate(Int32.Parse(dataSnap.Key), p);
            //    //    };
            //    //}
            //    //catch (Exception exx) {
            //    //    Debug.Log(exx.ToString());
            //    //}
        };

        FireBase_battle_event.ChildChanged += (object sender, ChangedEventArgs e) => {
            //firebase.Child(enemyId.ToString()).ChildChanged += (object sender, ChangedEventArgs e) => {
            IDataSnapshot dataSnap = e.DataSnapshot;

            Logger.firebase("Child ChildChanged! " + sender + ", " + e + ", " + dataSnap.Key);

            //String x = dataSnap.Child("x").StringValue;
            //String y = dataSnap.Child("y").StringValue;
            //String z = dataSnap.Child("z").StringValue;

            //Debug.Log("Child ChildChanged! " + dataSnap.Key + ", " + x + ", " + y + ", " + z);

            //Vector3 p = new Vector3(float.Parse(x), float.Parse(y), float.Parse(z));
            //foreach (Humanoid h in humanoid)
            //{
            //    h.onRemoteUpdate(Int32.Parse(dataSnap.Key), p);
            //};

/*
 *          try
 *          {
 *              List<JsonBaseUnit> result = JsonBaseUnit.getFirebaseValue(dataSnap);
 *              foreach (Humanoid h in humanoid)
 *              {
 *                  foreach (JsonBaseUnit json in result)
 *                  {
 *                      h.onRemoteUpdate(json);
 *                  }
 *              }
 *          }
 *          catch (Exception ex)
 *          {
 *              Debug.Log(ex.ToString());
 *          }*/
        };

        //firebase.ChildChanged += (object sender, ChangedEventArgs e) => {
        //firebase.Child(playerId.ToString()).Child("attack").ChildChanged += (object sender, ChangedEventArgs e) => {
        //IDataSnapshot dataSnap = e.DataSnapshot;
        //if (debugFirebase)
        //    Debug.Log("attack ChildChanged! " + sender + ", " + e + ", " + dataSnap.Key);

        /*           try
         *         {
         *             List<JsonBaseAttack> result = JsonBaseAttack.getFirebaseValue(dataSnap);
         *             foreach (Humanoid h in humanoid)
         *             {
         *                 foreach (JsonBaseAttack json in result)
         *                 {
         *                     //h.onRemoteUpdate(json.getId(), json.getVector3());
         *                 }
         *             }
         *         }
         *         catch (Exception ex)
         *         {
         *             Debug.Log(ex.ToString());
         *         }*/
        //};

        FireBase_battle.SetValue("GameStart!");

        //Dictionary<string, object> value = new Dictionary<string, object>();
        //Dictionary<string, object> location = new Dictionary<string, object>();

        //location.Add("x", "9");
        //location.Add("y", "9");
        //location.Add("z", "999");
        //value.Add("action", "move");
        //value.Add("action_unit_id", "123");
        //value.Add("current_location", location);

        //firebase.Child("FightLog").Push().SetValue(value);

        //value.Add("target_location", location);
        //firebase.Child("FightLog").Push().SetValue(value);

        Debug.Log("GameController start-");
    }
Example #26
0
    private void getPlayer_Battle_EnemyId()
    {
        FireBase_battlelist = Firebase.CreateNew(FIRE_BASE_HOST + BATTLE_LIST);
        playerId            = System.Guid.NewGuid().ToString();
        //IFirebase FireBase_battle = FireBase_battlelist.Push();
        //battleId = FireBase_battle.Key;

        Logger.gameControl("getPlayer_Battle_EnemyId playerId {0}, battleId {1}", playerId, BATTLE_ID);
        FireBase_battlelist.ChildAdded += (object sender, ChangedEventArgs e) =>
        {
            IDataSnapshot dataSnap = e.DataSnapshot;
            Logger.gameControl("FireBase_battlelist ChildAdded {0}, {1}", dataSnap.Key, dataSnap.StringValue);
        };

        battlelistvalueUpdateEventHandler = (object sender, ChangedEventArgs e) =>
        {
            IDataSnapshot dataSnap = e.DataSnapshot;
            Logger.gameControl("FireBase_battlelist ValueUpdated {0}, {1}", dataSnap.Key, dataSnap.StringValue);
            try
            {
                Dictionary <string, object> dic = dataSnap.DictionaryValue;
                object temp         = null;
                bool   findBattleId = false;
                foreach (string battleId in dic.Keys)
                {
                    if (battleId.Contains("skip"))
                    {
                        continue;
                    }
                    //dic.TryGetValue(battleId, out temp);
                    string status = dataSnap.Child(battleId).Child(BATTLE_STATUS).StringValue;
                    Logger.gameControl("FireBase_battlelist ValueUpdated {0}, {1}", battleId, status);
                    if (BATTLE_STATUS_WAITING.Equals(status))
                    {
                        dataSnap.Child(battleId).Ref.Child(playerId).SetValue(playerId);
                        dataSnap.Child(battleId).Child(BATTLE_STATUS).Ref.SetValue(BATTLE_STATUS_FIGHTING);
                        BATTLE_ID    = battleId;
                        findBattleId = true;
                        break;
                    }
                    //Dictionary<string, object> battlevalue = (Dictionary<string, object>)temp;
                    //object temp2 = null;
                    //foreach (string battleinfo in battlevalue.Keys)
                    //{
                    //    if ("status".Equals(battleinfo))
                    //    {
                    //        battlevalue.TryGetValue(battleId, out temp2);
                    //    }
                    //}
                }

                if (!findBattleId)
                {
                    IFirebase ref_battle = FireBase_battlelist.Push();
                    BATTLE_ID = ref_battle.Key;
                    ref_battle.Child(playerId).SetValue(playerId);
                    ref_battle.Child(BATTLE_STATUS).SetValue(BATTLE_STATUS_WAITING);
                }

                FireBase_battlelist.ValueUpdated -= battlelistvalueUpdateEventHandler;
                getEnemyId();
            }
            catch (Exception ex)
            {
                Debug.Log(ex.Message);
            }
        };

        FireBase_battlelist.ValueUpdated += battlelistvalueUpdateEventHandler;

        FireBase_battlelist.ChildChanged += (object sender, ChangedEventArgs e) =>
        {
            IDataSnapshot dataSnap = e.DataSnapshot;
            Logger.gameControl("FireBase_battlelist ChildChanged {0}, {1}", dataSnap.Key, dataSnap.StringValue);
        };
    }
Example #27
0
	/// <summary>
	/// Update this firebase instance
	/// </summary>
	/// <param name="snapshot">Snapshot.</param>
	IEnumerator Modify (IDataSnapshot snapshot) {
		try {
			items = snapshot.DictionaryValue;
		} catch (ArgumentNullException) {         }
		yield return null;
	}
 private void AddOrUpdate(IDataSnapshot snap)
 {
     Dispatcher.Invoke(() => PaintItem(snap));
 }