Пример #1
0
        public void RegisterManager <T>(T customManager) where T : IManager
        {
            var basicManagerData = new BasicManagerData {
                Manager = customManager
            };

            _managerList.Add(basicManagerData);
        }
Пример #2
0
        private T CreateBasicData <T>() where T : IManager, new()
        {
            CheckForNullManagerList();

            var foundManager = CreateInstanceT <T>();

            foundManager.Init();

            var basicManagerData = new BasicManagerData {
                Manager = foundManager
            };

            _managerList.Add(basicManagerData);

            return(foundManager);
        }
Пример #3
0
        public void UnRegisterManager <T>(T customManager) where T : IManager
        {
            var searchType = typeof(T);
            BasicManagerData foundManager = null;

            foreach (var managerData in _managerList)
            {
                var manager     = managerData.Manager;
                var managerType = manager.GetType();

                if (managerType == searchType)
                {
                    foundManager = managerData;
                    break;
                }
            }

            if (foundManager != null)
            {
                _managerList.Remove(foundManager);
            }
        }