private void InitDictionary(Type type, IFireDelegate fireDelegate, List <IFireControl> uiSubscribers, string userId, bool initWithCache = false) { this.LastKey = ""; this.FireDictDelegate = fireDelegate; this.Items = new Dictionary <string, IFireObject>(); this.Path = type.Name; this.UISubscriptionList = uiSubscribers; this.ObjectType = type; this.UserId = userId; if (initWithCache) { this.LoadFromCache <CnC.Model.Game>(); } if (this.UserId != null) // UserId = "" = public { //filter on user //.StartAtKey(lastKey) myQuery = fireDelegate.firebaseApp.Child(this.Path).OrderByChild(USERIDKEY).EqualTo(userId).On(FIREEVENTADD, (snap, previous_child, context) => AddOrUpdate(snap)); fireDelegate.firebaseApp.Child(this.Path).OrderByChild(USERIDKEY).EqualTo(userId).On(FIREEVENTDELETE, (snap, previous_child, context) => Removed(snap, previous_child, context)); } else { //unfiltered myQuery = fireDelegate.firebaseApp.Child(this.Path).StartAtKey(lastKey).On(FIREEVENTADD, (snap, previous_child, context) => AddOrUpdate(snap)); fireDelegate.firebaseApp.Child(this.Path).On(FIREEVENTDELETE, (snap, previous_child, context) => Removed(snap, previous_child, context)); } }
public FireDictionary(Type type, IFireDelegate fireDelegate, IFireControl uiSubscriber, string userId = null, bool initWithCache = false) { List <IFireControl> controlList = new List <IFireControl>(); controlList.Add(uiSubscriber); InitDictionary(type, fireDelegate, controlList, userId, initWithCache); }
public FireList(FirebaseApp firebaseApp, Type type, IFireDelegate fireDelegate, IFireControl uiSubscriber, string userId = null, bool initWithCache = false, string userIDKey = USERIDKEY) { List <IFireControl> controlList = new List <IFireControl>(); controlList.Add(uiSubscriber); InitDictionary(firebaseApp, type, fireDelegate, controlList, userId, initWithCache, userIDKey); }
public FireDictionary(Type type, IFireDelegate fireDelegate, List <IFireControl> uiSubscribers = null, string userId = null, bool initWithCache = false) { InitDictionary(type, fireDelegate, uiSubscribers, userId, initWithCache); }
public FireList(FirebaseApp firebaseApp, Type type, IFireDelegate fireDelegate, List <IFireControl> uiSubscribers = null, string userId = null, bool initWithCache = false, string userIDKey = USERIDKEY) { InitDictionary(firebaseApp, type, fireDelegate, uiSubscribers, userId, initWithCache, userIDKey); }