Ejemplo n.º 1
0
        public ViewModelLoader() 
        {
            unityContainer = new UnityContainer();

            RegisterTypes();

            string kinectSetting = ConfigurationManager.AppSettings["KinectService"].ToString();
            string sourceSetting = ConfigurationManager.AppSettings["SourceService"].ToString();
            string boardSetting = ConfigurationManager.AppSettings["BoardService"].ToString();
            string helpSetting = ConfigurationManager.AppSettings["HelpService"].ToString();


            kinectService = unityContainer.Resolve<IKinectService>(kinectSetting);
            sourceService = unityContainer.Resolve<ISourceService>(sourceSetting);
            boardService = unityContainer.Resolve<IBoardService>(boardSetting);
            helpService = unityContainer.Resolve<IHelpService>(helpSetting);

            var prop = DesignerProperties.IsInDesignModeProperty; 
            var isInDesignMode = (bool)DependencyPropertyDescriptor
                .FromProperty(prop, typeof(FrameworkElement))
                .Metadata.DefaultValue; 
            
            if (!isInDesignMode) 
            { 
                kinectService.Initialize();
                sourceService.Initialize();
                helpService.Initialize();
            } 
        }
Ejemplo n.º 2
0
        public ViewModelLoader()
        {
            unityContainer = new UnityContainer();

            RegisterTypes();

            string kinectSetting = ConfigurationManager.AppSettings["KinectService"].ToString();
            string sourceSetting = ConfigurationManager.AppSettings["SourceService"].ToString();
            string boardSetting  = ConfigurationManager.AppSettings["BoardService"].ToString();
            string helpSetting   = ConfigurationManager.AppSettings["HelpService"].ToString();


            kinectService = unityContainer.Resolve <IKinectService>(kinectSetting);
            sourceService = unityContainer.Resolve <ISourceService>(sourceSetting);
            boardService  = unityContainer.Resolve <IBoardService>(boardSetting);
            helpService   = unityContainer.Resolve <IHelpService>(helpSetting);

            var prop           = DesignerProperties.IsInDesignModeProperty;
            var isInDesignMode = (bool)DependencyPropertyDescriptor
                                 .FromProperty(prop, typeof(FrameworkElement))
                                 .Metadata.DefaultValue;

            if (!isInDesignMode)
            {
                kinectService.Initialize();
                sourceService.Initialize();
                helpService.Initialize();
            }
        }