Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public FireDictionary(Type type, IFireDelegate fireDelegate, List <IFireControl> uiSubscribers = null, string userId = null, bool initWithCache = false)
 {
     InitDictionary(type, fireDelegate, uiSubscribers, userId, initWithCache);
 }
Beispiel #5
0
 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);
 }