示例#1
0
        public Subscriptions Add(Type aType, BlazorStateComponent aBlazorStateComponent)
        {
            //if (!typeof(IState).IsAssignableFrom(aStateType))
            //{
            //  throw new ArgumentException("Type must implement IState");
            //}

            if (!(BlazorStateComponentReferencesDictionary.TryGetValue(aType, out List <WeakReference <BlazorStateComponent> > blazorStateComponentReferences)))
            {
                blazorStateComponentReferences = new List <WeakReference <BlazorStateComponent> >();
                BlazorStateComponentReferencesDictionary.Add(aType, blazorStateComponentReferences);
            }

            blazorStateComponentReferences.Add(new WeakReference <BlazorStateComponent>(aBlazorStateComponent));

            return(this);
        }
示例#2
0
        public Subscriptions Add <T>(BlazorStateComponent aBlazorStateComponent)
        {
            Type type = typeof(T);

            return(Add(type, aBlazorStateComponent));
        }