예제 #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();
            } 
        }
예제 #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();
            }
        }
예제 #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init(MagicWallManager magicWallManager)
        {
            _manager = magicWallManager;

            if (_kinectType == KinectType.Kinect2)
            {
                _kinectService = _kinect2Service;
            }
            else if (_kinectType == KinectType.AzureKinect)
            {
                // 缺失 kinect 3
            }

            _kinectAgents = new List <KinectAgent>();

            _startSuccessAction = StartKinectSuccess;
            _startFailedAction  = StartKinectFailed;


            if (isMock)
            {
                Debug.Log("开启 kinect 模拟模式。");

                // 模拟创建实体,实际使用kinect需注释  结束
            }
            else
            {
                _kinectService.Init(_agentContainer, _kinectAgentPrefab, _manager);
                //StartMonitoring();
            }

            Debug.Log("@@@ Kinecet 初始化成功");
        }
예제 #4
0
        public MainViewModel(IKinectService kinectService,
                             ICarControllerService carControllerService, ICarCameraService carCameraService, IControlLogic controlLogic)
            : this()
        {
            //Setup Camera
            _carCameraService             = carCameraService;
            _carCameraService.ImageReady += (sender, args) => CarCameraImage = args.BitmapImage;

            //Setup Car Controller
            _carControllerService = carControllerService;
            CarControllerStatus   = _carControllerService.Status;
            _carControllerService.CarControllerStatusChanged += CarControllerServiceOnCarControllerStatusChanged;

            //Setup Kinect
            _kinectService     = kinectService;
            KinectSensorStatus = _kinectService.Status;
            _kinectService.KinectStatusChanged += KinectServiceOnKinectStatusChanged;
            _kinectService.SkeletonFrameReady  += KinectServiceOnSkeletonFrameReady;
            _kinectService.ColorImageReady     += (sender, args) => KinectCameraImage = args.BitmapSource;

            //setup Control logic (business logic)
            _controlLogic = controlLogic;
            _controlLogic.ControllingEvent  += (sender, args) => IsControlling = args.IsControlling;
            _controlLogic.NewDirectionEvent += (sender, args) => Direction = args.Direction;
            _controlLogic.NewVelocityEvent  += (sender, args) => Velocity = args.Velocity;
            _controlLogic.TimeLeftTickEvent += (sender, args) => CountDown = args.TickTime;
            CountDown = _controlLogic.OriginalTime;

            //Setup Commands
            RetryCommand          = new DelegateCommand(Retry);
            CancelCommand         = new DelegateCommand(Cancel);
            ConnectCommand        = new DelegateCommand(Connect);
            SetKinectAngleCommand = new DelegateCommand(SetKinectAngle);
        }
예제 #5
0
        public MainViewModel(IKinectService kinectService,
		                     ICarControllerService carControllerService, ICarCameraService carCameraService, IControlLogic controlLogic)
            : this()
        {
            //Setup Camera
            _carCameraService = carCameraService;
            _carCameraService.ImageReady += (sender, args) => CarCameraImage = args.BitmapImage;

            //Setup Car Controller
            _carControllerService = carControllerService;
            CarControllerStatus = _carControllerService.Status;
            _carControllerService.CarControllerStatusChanged += CarControllerServiceOnCarControllerStatusChanged;

            //Setup Kinect
            _kinectService = kinectService;
            KinectSensorStatus = _kinectService.Status;
            _kinectService.KinectStatusChanged += KinectServiceOnKinectStatusChanged;
            _kinectService.SkeletonFrameReady += KinectServiceOnSkeletonFrameReady;
            _kinectService.ColorImageReady += (sender, args) => KinectCameraImage = args.BitmapSource;

            //setup Control logic (business logic)
            _controlLogic = controlLogic;
            _controlLogic.ControllingEvent += (sender, args) => IsControlling = args.IsControlling;
            _controlLogic.NewDirectionEvent += (sender, args) => Direction = args.Direction;
            _controlLogic.NewVelocityEvent += (sender, args) => Velocity = args.Velocity;
            _controlLogic.TimeLeftTickEvent += (sender, args) => CountDown = args.TickTime;
            CountDown = _controlLogic.OriginalTime;

            //Setup Commands
            RetryCommand = new DelegateCommand(Retry);
            CancelCommand = new DelegateCommand(Cancel);
            ConnectCommand = new DelegateCommand(Connect);
            SetKinectAngleCommand = new DelegateCommand(SetKinectAngle);
        }
예제 #6
0
        public MainViewModel()
        {
            _kinectService = new KinectService();

            _kinectService.SkeletonFrameReady += _kinectService_SkeletonFrameReady;
            _kinectService.Initialize();
        }
 public MainWindowViewModel(IKinectService kinectService, ISkeletonDrawer skeletonDrawer)
 {
     _kinectService  = kinectService;
     _skeletonDrawer = skeletonDrawer;
     _kinectService.SkeletonUpdated += _kinectService_SkeletonUpdated;
     _kinectService.ColorUpdated    += _kinectService_ColorUpdated;
     _kinectService.Initialize();
 }
예제 #8
0
        public MainViewModel()
        {
            _kinectService = new KinectService();


            _kinectService.SkeletonFrameReady += _kinectService_SkeletonFrameReady;
            _kinectService.Initialize();
        }
 public BoundingBoxViewModel(IKinectService kinectService)
 {
     this.kinectService = kinectService;
     this.kinectService.SkeletonUpdated += new EventHandler <SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
     this.BoundsDisplaySize              = 300;
     this.BoundsDepth           = .7d;
     this.BoundsWidth           = .7d;
     this.MinDistanceFromCamera = 1.0d;
 }
 public BoundingBoxViewModel(IKinectService kinectService)
 {
     this.kinectService = kinectService;
     this.kinectService.SkeletonUpdated += new EventHandler<SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
     this.BoundsDisplaySize = 300;
     this.BoundsDepth = .7d;
     this.BoundsWidth = .7d;
     this.MinDistanceFromCamera = 1.0d;
 }
예제 #11
0
        public MainViewModel(IKinectService kinectService)
        {
            this.Messages = new ObservableCollection <string>();

            this.kinectService = kinectService;
            this.kinectService.SpeechDetected   += new EventHandler(kinectService_SpeechDetected);
            this.kinectService.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(kinectService_SpeechRecognized);
            this.kinectService.SpeechRejected   += new EventHandler(kinectService_SpeechRejected);

            var grammar = new NuiGrammar();

            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = NextCommandText
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = PreviousCommandText
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "kinect"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "speech"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "mike hodnick"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "code camp"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "twin cities"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "twin cities code camp"
            });
            grammar.Items.Add(new NuiGrammarItem()
            {
                Text = "alpacas like to eat breath mints"
            });

            this.kinectService.AddGrammar(grammar);

            this.Messages.Add("Say something...");
            this.Messages.Add("Ready");

            this.index       = 1;
            this.FrameSource = this.GetPageUri(this.index);
        }
예제 #12
0
        public ViewModelLoader()
        {
            kinectService = new ConcreteKinectService();

            var prop           = DesignerProperties.IsInDesignModeProperty;
            var isInDesignMode =
                (bool)DependencyPropertyDescriptor
                .FromProperty(prop, typeof(FrameworkElement))
                .Metadata.DefaultValue;
        }
예제 #13
0
파일: MenuService.cs 프로젝트: jnsn/kinect
        public MenuService(IEventAggregator eventAggregator, IKinectService kinectService)
        {
            _eventAggregator = eventAggregator;
            _kinectService   = kinectService;

            _eventAggregator.GetEvent <SkeletonFrameUpdate>().Subscribe(OnSkeletonFrameUpdate);

            _gestureDetector.MinimalPeriodBetweenGestures = 500;
            _gestureDetector.GestureDetected += OnGestureDetected;
        }
예제 #14
0
        public MainViewModel(IKinectService kinectService)
        {
            this.PreviousCommand = new RelayCommand(this.ExecutePreviousCommand);
            this.NextCommand     = new RelayCommand(this.ExecuteNextCommand);

            this.kinectService = kinectService;
            this.kinectService.SwipeDetected += new EventHandler <SwipeEventArgs>(kinectService_SwipeDetected);

            this.index       = 1;
            this.FrameSource = this.GetPageUri(this.index);
        }
예제 #15
0
        public MainViewModel(IKinectService kinectService)
        {
            this.PreviousCommand = new RelayCommand(this.ExecutePreviousCommand);
            this.NextCommand = new RelayCommand(this.ExecuteNextCommand);

            this.kinectService = kinectService;
            this.kinectService.SwipeDetected += new EventHandler<SwipeEventArgs>(kinectService_SwipeDetected);

            this.index = 1;
            this.FrameSource = this.GetPageUri(this.index);
        }
예제 #16
0
 public ViewModel(IKinectService kinectService)
 {
     this.kinectService = kinectService;
     this.HandOffsetX = 100;
     this.HandOffsetY = 100;
     this.MinDistanceFromCamera = 1.0d;
     this.BoundsDepth = .5d;
     this.BoundsWidth = .5d;
     this.BoundsDisplaySize = 300;
     this.kinectService.SkeletonUpdated += new EventHandler<SkeletonEventArgs>(kinectService_SkeletonUpdated);
 }
예제 #17
0
        public ControlLogic(IKinectService kinectService, ICarControllerService carControllerService, IWpfUISettings settings, IUnityContainer container)
        {
            _kinectService        = kinectService;
            _carControllerService = carControllerService;
            _container            = container;
            _settings             = settings;

            _kinectService.SkeletonFrameReady += KinectServiceOnSkeletonFrameReady;

            SetupCountdownTimer();
        }
예제 #18
0
 public ViewModel(IKinectService kinectService)
 {
     this.kinectService                  = kinectService;
     this.HandOffsetX                    = 100;
     this.HandOffsetY                    = 100;
     this.MinDistanceFromCamera          = 1.0d;
     this.BoundsDepth                    = .5d;
     this.BoundsWidth                    = .5d;
     this.BoundsDisplaySize              = 300;
     this.kinectService.SkeletonUpdated += new EventHandler <SkeletonEventArgs>(kinectService_SkeletonUpdated);
 }
예제 #19
0
        public ControlLogic(IKinectService kinectService, ICarControllerService carControllerService, IWpfUISettings settings, IUnityContainer container)
        {
            _kinectService = kinectService;
            _carControllerService = carControllerService;
            _container = container;
            _settings = settings;

            _kinectService.SkeletonFrameReady += KinectServiceOnSkeletonFrameReady;

            SetupCountdownTimer();
        }
 public ViewModelLocator()
 {
     if (ViewModelBase.IsInDesignModeStatic)
     {
         kinectService = new MockKinectService();
     }
     else
     {
         kinectService = new KinectService();
     }
     main = new MainViewModel(kinectService);
 }
예제 #21
0
        public FootDetailsService(IEventAggregator eventAggregator, IKinectService kinectService)
        {
            _eventAggregator = eventAggregator;
            _kinectService   = kinectService;

            _eventAggregator.GetEvent <SkeletonFrameUpdate>().Subscribe(OnSkeletonFrameUpdate);

            _rightFootGestureDetector.MinimalPeriodBetweenGestures = 0;
            _rightFootGestureDetector.GestureDetected            += OnRightFootGestureDetected;
            _leftFootGestureDetector.MinimalPeriodBetweenGestures = 0;
            _leftFootGestureDetector.GestureDetected += OnLeftFootGestureDetected;
        }
예제 #22
0
 public ViewModelLocator()
 {
     if (ViewModelBase.IsInDesignModeStatic)
     {
         kinectService = new MockKinectService();
     }
     else
     {
         kinectService = new KinectService();
     }
     main = new MainViewModel(kinectService);
 }
예제 #23
0
        public const int TIMEOUT_TIME    = 1000; // msec

        public MainWindow()
        {
            InitializeComponent();
            kinectService   = new KinectService();
            positionChecker = new PositionChecker(kinectService);
            robot           = new Robot(positionChecker);
            skeletonDrawer  = new SkeletonDrawer();

            this.Closing += MainWindow_Closing;


            this.DataContext = new MainWindowViewModel(kinectService, skeletonDrawer);
        }
        public BoundingBoxViewModel(IKinectService kinectService)
        {
            this.kinectService = kinectService;
            this.kinectService.SkeletonUpdated += new EventHandler <SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
            this.BoundsDisplaySize              = 300;
            this.BoundsDepth           = .7d;
            this.BoundsWidth           = .7d;
            this.MinDistanceFromCamera = 1.0d;

            this.videoWorker = new BackgroundWorker();
            this.videoWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(videoWorker_RunWorkerCompleted);
            this.videoWorker.DoWork             += new DoWorkEventHandler(videoWorker_DoWork);
            this.videoWorker.RunWorkerAsync();
        }
        public BoundingBoxViewModel(IKinectService kinectService)
        {
            this.kinectService = kinectService;
            this.kinectService.SkeletonUpdated += new EventHandler<SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
            this.BoundsDisplaySize = 300;
            this.BoundsDepth = .7d;
            this.BoundsWidth = .7d;
            this.MinDistanceFromCamera = 1.0d;

            this.videoWorker = new BackgroundWorker();
            this.videoWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(videoWorker_RunWorkerCompleted);
            this.videoWorker.DoWork += new DoWorkEventHandler(videoWorker_DoWork);
            this.videoWorker.RunWorkerAsync();
        }
예제 #26
0
        public ViewModelLoader()
        {
            kinectService = new ConcreteKinectService();

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

            if (!isInDesignMode)
            {
                kinectService.Initialize();
            }
        }
예제 #27
0
        public MainViewModel(IKinectService kinectService)
        {
            this.kinectService = kinectService;
            this.kinectService.SkeletonUpdated += new EventHandler <SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
            this.kinectService.SwipeDetected   += new EventHandler <SwipeEventArgs>(kinectService_SwipeDetected);
            this.MenuItems = new ObservableCollection <MenuItemViewModel>();
            this.LoadMenuItems();

            this.imageWorker                     = new BackgroundWorker();
            this.imageWorker.DoWork             += new DoWorkEventHandler(imageWorker_DoWork);
            this.imageWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(imageWorker_RunWorkerCompleted);
            this.imageWorker.RunWorkerAsync();

            Messenger.Default.Register <ItemMessage>(this, m =>
            {
                this.ItemMessageText = m.Text;
            });
        }
예제 #28
0
        public MainViewModel(IKinectService kinectService)
        {
            this.kinectService = kinectService;
            this.kinectService.SkeletonUpdated += new EventHandler<SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
            this.kinectService.SwipeDetected += new EventHandler<SwipeEventArgs>(kinectService_SwipeDetected);
            this.MenuItems = new ObservableCollection<MenuItemViewModel>();
            this.LoadMenuItems();

            this.imageWorker = new BackgroundWorker();
            this.imageWorker.DoWork += new DoWorkEventHandler(imageWorker_DoWork);
            this.imageWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(imageWorker_RunWorkerCompleted);
            this.imageWorker.RunWorkerAsync();

            Messenger.Default.Register<ItemMessage>(this, m =>
            {
                this.ItemMessageText = m.Text;
            });
        }
        public ViewModelLoader()
        {
            var prop = DesignerProperties.IsInDesignModeProperty;

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

            if (isInDesignMode)
            {
                kinectService = new MockKinectService();
            }
            else
            {
                kinectService = new KinectService();
            }

            main        = new MainViewModel(kinectService);
            boundingBox = new BoundingBoxViewModel(kinectService);
        }
예제 #30
0
        public ViewModel(IKinectService kinectService, ISourceService sourceService, IBoardService boardService, IHelpService helpService)
        {
            user = new UserState();

            idleJobQueue = new Queue <Action>();

            this.helpService = helpService;
            this.helpService.NewHelpMessage += new EventHandler <HelpMessageEventArgs>(helpService_NewHelpMessage);

            this.kinectService = kinectService;

            this.sourceService = sourceService;
            this.sourceService.EventsUpdated += new EventHandler <SourceEventArgs>(sourceService_EventsUpdated);

            this.boardService = boardService;
            this.boardService.BoardsUpdated += new EventHandler(boardService_BoardsChanged);

            appIdleTimer          = new DispatcherTimer();
            appIdleTimer.Interval = TimeSpan.FromMinutes(1);
            appIdleTimer.Tick    += new EventHandler(appIdle_Tick);
            appIdleTimer.Start();
        }
예제 #31
0
        public ViewModel(IKinectService kinectService, ISourceService sourceService, IBoardService boardService, IHelpService helpService) 
        {
            user = new UserState();

            idleJobQueue = new Queue<Action>();

            this.helpService = helpService;
            this.helpService.NewHelpMessage += new EventHandler<HelpMessageEventArgs>(helpService_NewHelpMessage);

            this.kinectService = kinectService; 

            this.sourceService = sourceService;
            this.sourceService.EventsUpdated += new EventHandler<SourceEventArgs>(sourceService_EventsUpdated);

            this.boardService = boardService;
            this.boardService.BoardsUpdated += new EventHandler(boardService_BoardsChanged);

            appIdleTimer = new DispatcherTimer();
            appIdleTimer.Interval = TimeSpan.FromMinutes(1);
            appIdleTimer.Tick += new EventHandler(appIdle_Tick);
            appIdleTimer.Start();
        }
예제 #32
0
 public ViewModelLoader()
 {
     kinectService = new KinectService(); // use IoC instead
     main          = new MainViewModel(kinectService);
 }
예제 #33
0
 public PositionChecker(IKinectService kinectService)
 {
     _kinectService = kinectService;
     _kinectService.SkeletonUpdated += _kinectService_SkeletonUpdated;
     _actionPointsToCheck            = ActionPoints.GetActionPoints();
 }
예제 #34
0
 public SkeletonController(IKinectService kinectService, int totalPlayers = 1)
 {
     this._kinectService            = kinectService;
     this.TotalPlayers              = totalPlayers;
     kinectService.SkeletonUpdated += new EventHandler <SkeletonEventArgs>(kinectService_SkeletonUpdated);
 }
예제 #35
0
 public MainViewModel(IKinectService kinectService)
 {
     this.kinectService = kinectService;
     kinectService.SkeletonUpdated += new EventHandler<SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
     this.ShowBoundingBoxCommand = new RelayCommand(this.ExecuteShowBoundingBox);
 }
예제 #36
0
 public GestureController(IKinectService kinect)
 {
     this.kinect = kinect;
     this.kinect.SkeletonUpdated += new EventHandler<SkeletonEventArgs>(kinect_SkeletonUpdated);
 }
 public void InitializeSkeleton(IKinectService kinectService)
 {
     //kinectService.ImageFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(kinectService_ImageFrameReady);
     kinectService.SkeletonUpdated += new EventHandler <SkeletonEventArgs>(kinectService_SkeletonUpdated);
     this.kinectService             = kinectService;
 }
예제 #38
0
 public MainViewModel(IKinectService kinectService)
 {
     this.kinectService = kinectService;
     kinectService.SkeletonUpdated += new EventHandler<SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
 }
        public ViewModelLoader()
        {
            kinectService = new KinectService();

            main = new MainViewModel(kinectService);
        }
예제 #40
0
 public void InitializeSkeleton(IKinectService kinectService)
 {
     //kinectService.ImageFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(kinectService_ImageFrameReady);
     kinectService.SkeletonUpdated += new EventHandler<SkeletonEventArgs>(kinectService_SkeletonUpdated);
     this.kinectService = kinectService;
 }
 public void Initialize()
 {
     servicePipe         = NamedPipeStream.Open(SERVICE_NAME, NamedPipeStream.PipeDirection.InOut);
     kinectServiceSender = new StreamServiceSender <IKinectService>(servicePipe);
     KinectService       = kinectServiceSender.Service;
 }
예제 #42
0
        public ViewModelLoader()
        {
            kinectService = new KinectService();

            main = new MainViewModel(kinectService);
        }
예제 #43
0
 public MainViewModel(IKinectService kinectService)
 {
     this.kinectService             = kinectService;
     kinectService.SkeletonUpdated += new EventHandler <SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
     this.ShowBoundingBoxCommand    = new RelayCommand(this.ExecuteShowBoundingBox);
 }
예제 #44
0
 public MainViewModel(IKinectService kinectService)
 {
     this.kinectService             = kinectService;
     kinectService.SkeletonUpdated += new EventHandler <SkeletonUpdatedEventArgs>(kinectService_SkeletonUpdated);
 }
예제 #45
0
 public ViewModelLoader()
 {
     kinectService = new KinectService(); // use IoC instead
     main = new MainViewModel(kinectService);
 }
예제 #46
0
        public ViewModel(IKinectService kinectService)
        {
            dbManager = new DBManager();
            //dbManager.initializeDatabase();
            initializeTimer();

            this.kinectService = kinectService;
            this.kinectService.SkeletonUpdated += new System.EventHandler <SkeletonEventArgs>(kinectService_SkeletonUpdated);


            //BodyJoints fileObject = new BodyJoints(idealBodyJoints);
            //IFormatter formatter = new BinaryFormatter();
            //Stream stream = new FileStream("F:\\College\\Quarter4\\218\\project\\positions\\exercise1\\1.bin", FileMode.Create, FileAccess.Write, FileShare.None);
            //formatter.Serialize(stream, fileObject);
            //stream.Close();

            IFormatter formatter  = new BinaryFormatter();
            Stream     stream     = new FileStream("..\\..\\..\\Dataset\\1.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
            BodyJoints fileObject = (BodyJoints)formatter.Deserialize(stream);

            stream.Close();
            idealBodyJoints = fileObject;

            //IFormatter formatter2 = new BinaryFormatter();
            //Stream stream2 = new FileStream("F:\\College\\Quarter4\\218\\project\\positions\\exercise1\\1.bin", FileMode.Open, FileAccess.Read, FileShare.Read);
            //BodyJoints fileObject2 = (BodyJoints)formatter.Deserialize(stream);
            //stream.Close();
            //float[,] idealBodyJoints2 = fileObject.idealBodyJoints;

            /*
             * float[,] idealBodyJoints2 = {{ -0.009447459f , 0.60294944f, 1.31400883f} ,
             *                                      { 0.002266258f, 0.42004475f, 1.32388508f }  ,
             *                                      { 0.000935936f , 0.213289276f, 1.30896533f } ,
             *                                      {  0.000739973853f, -0.0607283078f, 1.25822461f }  ,
             *                                      { 0.220867485f, -0.1269243f, 1.17617548f },
             *                                      { -0.1677815f, -0.136166364f, 1.1603055f },
             *                                      { 0.07320645f, -0.0546527356f   ,1.22442615f },
             *                                      { -0.07176963f, -0.06349322f, 1.22342634f },
             *                                      { 0.238081276f, -0.330413043f, 1.10450733f },
             *                                      { -0.114430159f, -0.391302735f, 1.197041f },
             *                                      { 0.121732004f, -0.8049696f, 1.131731f },
             *                                      { 0.0298294257f, -0.8586146f, 1.19491315f },
             *                                      { 0.000113591552f, -0.7418386f, 1.09284163f },
             *                                      { 0.1216219f, -0.822920859f, 1.08214772f }};
             * //this.idealBodyJoints = idealBodyJoints2;
             * //setBodyDeviation(idealBodyJoints, idealBodyJoints2);
             */

            //****************************************************

            /*
             *
             * string jsonBodyJoints = JsonConvert.SerializeObject(fileObject3);
             *
             * Console.WriteLine("printing json " + jsonBodyJoints);
             *
             * var server = new WebSocketServer("ws://127.0.0.1:8181");
             * server.Start(socket =>
             * {
             *  socket.OnOpen = () =>
             *  {
             *      _clients.Add(socket);
             *      socket.Send(jsonBodyJoints);
             *  };
             *
             *  socket.OnClose = () =>
             *  {
             *      _clients.Remove(socket);
             *  };
             *
             *  socket.OnMessage = message =>
             *  {
             *      foreach (var client in _clients)
             *      {
             *          // Send the message to everyone!
             *          // Also, send the client connection's unique identifier in order
             *          // to recognize who is who.
             *          //       client.Send(client.ConnectionInfo.Id + " says: " + message);
             *          client.Send("sending body joints");
             *
             *      }
             *      Console.WriteLine("Switched to " + message);
             *  };
             * });
             *
             */
            //***************************************************8
        }