Пример #1
0
        public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
        {
            this.keyboardService = keyboardService;
            this.keyboardService.KeyUp += new EventHandler<KeyEventArgs>(keyboardService_KeyUp);
            this.configService = configService;
            this.nuiService = nuiService;
            this.nuiService.UserRaisedHand += new EventHandler<HandRaisedEventArgs>(nuiService_UserRaisedHand);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds += new EventHandler(nuiService_UserExitedBounds);
            this.ToggleCommand = new RelayCommand(this.ExecuteToggleCommand);
            this.AutoPlayCommand = new RelayCommand(this.ExecuteAutoPlayCommand);
            this.ToggleKinectVisionCommand = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
            this.MainBackgroundBrush = (Brush)Application.Current.Resources["DefaultBackground"];
            this.EngineeringBackgroundBrush = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));

            this.videoTimer = new DispatcherTimer();
            this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
            this.videoTimer.Tick += new EventHandler(videoTimer_Tick);
            this.videoTimer.Start();

            if (!IsInDesignMode)
            {
                Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            }
        }
        public ViewModelLocator()
        {
            var kernel = new StandardKernel();

            kernel.Bind <IKeyboardService>().To <DefaultKeyboardService>();

            if (ViewModelBase.IsInDesignModeStatic)
            {
                kernel.Bind <IConfigurationService>().To <DesignConfigurationService>();
                kernel.Bind <INuiService>().To <MockNuiService>();
            }
            else
            {
                kernel.Bind <IConfigurationService>().To <AppConfigConfigurationService>();
                kernel.Bind <INuiService>().To <KinectNuiService>();
            }

            nuiService = kernel.Get <INuiService>();

            main = new MainViewModel(
                kernel.Get <IConfigurationService>(),
                nuiService,
                kernel.Get <IKeyboardService>());

            boundingBox = new BoundingBoxViewModel(
                nuiService);

            explorer = new ExplorerViewModel(
                nuiService, kernel.Get <IConfigurationService>());

            math = new MathViewModel();
        }
Пример #3
0
        public ViewModelLocator()
        {
            var kernel = new StandardKernel();
            kernel.Bind<IKeyboardService>().To<DefaultKeyboardService>();

            if (ViewModelBase.IsInDesignModeStatic)
            {
                kernel.Bind<IConfigurationService>().To<DesignConfigurationService>();
                kernel.Bind<INuiService>().To<MockNuiService>();
            }
            else
            {
                kernel.Bind<IConfigurationService>().To<AppConfigConfigurationService>();
                kernel.Bind<INuiService>().To<KinectNuiService>();
            }

            nuiService = kernel.Get<INuiService>();

            main = new MainViewModel(
                kernel.Get<IConfigurationService>(),
                nuiService,
                kernel.Get<IKeyboardService>());

            boundingBox = new BoundingBoxViewModel(
                nuiService);

            explorer = new ExplorerViewModel(
                nuiService, kernel.Get<IConfigurationService>());

            math = new MathViewModel();
        }
        public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
        {
            this.keyboardService               = keyboardService;
            this.keyboardService.KeyUp        += new EventHandler <KeyEventArgs>(keyboardService_KeyUp);
            this.configService                 = configService;
            this.nuiService                    = nuiService;
            this.nuiService.UserRaisedHand    += new EventHandler <HandRaisedEventArgs>(nuiService_UserRaisedHand);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds  += new EventHandler(nuiService_UserExitedBounds);
            this.ToggleCommand                 = new RelayCommand(this.ExecuteToggleCommand);
            this.AutoPlayCommand               = new RelayCommand(this.ExecuteAutoPlayCommand);
            this.ToggleKinectVisionCommand     = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
            this.MainBackgroundBrush           = (Brush)Application.Current.Resources["DefaultBackground"];
            this.EngineeringBackgroundBrush    = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));

            this.videoTimer          = new DispatcherTimer();
            this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
            this.videoTimer.Tick    += new EventHandler(videoTimer_Tick);
            this.videoTimer.Start();

            if (!IsInDesignMode)
            {
                Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            }
        }
 public BoundingBoxViewModel(INuiService nuiService)
 {
     this.nuiService = nuiService;
     this.nuiService.SkeletonUpdated      += new EventHandler <SkeletonUpdatedEventArgs>(nuiService_SkeletonUpdated);
     this.nuiService.UserEnteredBounds    += new EventHandler(nuiService_UserEnteredBounds);
     this.nuiService.UserExitedBounds     += new EventHandler(nuiService_UserExitedBounds);
     this.nuiService.BoundsDepth           = this.BoundsDepth;
     this.nuiService.BoundsWidth           = this.BoundsWidth;
     this.nuiService.MinDistanceFromCamera = this.MinDistanceFromCamera;
     Messenger.Default.Register <BoundingBoxEnabledMessage>(this, this.HandleBoundingBoxEnabledMessage);
 }
        public ExplorerViewModel(INuiService nuiService, IConfigurationService configService)
        {
            this.ScreenLinesCollection = new List <ScreenLines>();

            this.nuiService               = nuiService;
            this.configService            = configService;
            this.MouseRotationAdjustment  = 5d;
            this.MouseZoomAdjustment      = 5d;
            this.MetersRotationAdjustment = 200d;
            this.MetersZoomAdjustment     = 400d;

            Messenger.Default.Register <AutoPlayMessage>(this, this.ReceiveAutoPlayMessage);
            Messenger.Default.Register <ToggleMessage>(this, this.ReceiveToggleMessage);
            this.nuiService.SkeletonUpdated   += new EventHandler <SkeletonUpdatedEventArgs>(nuiService_SkeletonUpdated);
            this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
            this.nuiService.UserExitedBounds  += new EventHandler(nuiService_UserExitedBounds);
            this.LoadModel3DGroup();
        }