Example #1
0
        //---------------------------------------------------------------------------------------------------------

        private static Dictionary <String, List <ActionObserver> > loadObserverMaps()
        {
            Dictionary <String, List <ActionObserver> > dicResults = new Dictionary <String, List <ActionObserver> >();

            List <Type> subControllers = new List <Type>();

            foreach (KeyValuePair <String, Type> kv in ObjectContext.Instance.TypeList)
            {
                if (kv.Value.IsAbstract)
                {
                    continue;
                }

                if (kv.Value.IsSubclassOf(typeof(ControllerBase)) && kv.Value.BaseType != typeof(ControllerBase))
                {
                    subControllers.Add(kv.Value);
                }

                if (rft.IsInterface(kv.Value, typeof(ActionObserver)))
                {
                    ActionObserver obj = (ActionObserver)ObjectContext.GetByType(kv.Value);
                    loadActionObserver(dicResults, obj);
                }
            }

            return(processSubControllers(subControllers, dicResults));
        }
Example #2
0
        private static bool subContains(List <ActionObserver> subActionObserver, ActionObserver ob)
        {
            foreach (ActionObserver x in subActionObserver)
            {
                if (x.GetType() == ob.GetType())
                {
                    return(true);
                }
            }

            return(false);
        }
Example #3
0
        private static bool subContains( List<ActionObserver> subActionObserver, ActionObserver ob )
        {
            foreach (ActionObserver x in subActionObserver) {

                if (x.GetType() == ob.GetType()) return true;

            }

            return false;
        }
Example #4
0
        private static void loadActionObserver( Dictionary<String, List<ActionObserver>> dic, ActionObserver obj )
        {
            Dictionary<Type, String> actions = obj.GetRelatedActions();

            foreach (KeyValuePair<Type, String> kv in actions) {

                String[] arrActions = kv.Value.Split( '/' );
                foreach (String action in arrActions) {

                    String key = kv.Key.FullName + "_" + action;

                    List<ActionObserver> clist = dic.ContainsKey( key ) ? dic[key] : new List<ActionObserver>();
                    if (clist.Contains( obj ) == false) {
                        clist.Add( obj );
                    }

                    dic[key] = clist;
                }
            }
        }
Example #5
0
        private static void loadActionObserver(Dictionary <String, List <ActionObserver> > dic, ActionObserver obj)
        {
            Dictionary <Type, String> actions = obj.GetRelatedActions();

            foreach (KeyValuePair <Type, String> kv in actions)
            {
                String[] arrActions = kv.Value.Split('/');
                foreach (String action in arrActions)
                {
                    String key = kv.Key.FullName + "_" + action;

                    List <ActionObserver> clist = dic.ContainsKey(key) ? dic[key] : new List <ActionObserver>();
                    if (clist.Contains(obj) == false)
                    {
                        clist.Add(obj);
                    }

                    dic[key] = clist;
                }
            }
        }