public Demo()
        {
            InitializeComponent();

            // variable initialization
            isPointed = false;
            checkedButton = false;
            paused = false;
            counterFrames = 0;
            counterFramesBody = 0;
            mainHandId = 0;
            PointerMovedAssigned = false;
            MediaEndedAssigned = false;

            relatedBackup = null;

            // object initialization
            IdleAnimateFirstHand();
            kc = new KinectController();
            hue = new HueController("192.168.0.2");
            hue.Connect();
            hue.isBright = true;
            kc.bodyReader.FrameArrived += HandleFrame;

            idle = new DemoIdle();
            this.contentControl.Content = idle;
            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);
            app.KinectRegion = kinectRegion;

            windowProducts = new SortedList<int, Model.Product>();
            db = new DbFileManager();

            state = 1;

            playimage = new BitmapImage(new Uri("Images\\play.png", UriKind.Relative));
            pauseimage = new BitmapImage(new Uri("Images\\pause.png", UriKind.Relative));

            InitProducts();

            idle.label.Opacity = 0;

            kWin = KinectCoreWindow.GetForCurrentThread();
            if (!PointerMovedAssigned)
            {
                kWin.PointerMoved += KWin_PointerMoved;
                kWin.PointerExited += KWin_PointerExited;
                kWin.PointerEntered += KWin_PointerEntered;
                PointerMovedAssigned = true;
            }

            /*
            this.MouseMove += Demo_MouseMove;

            currentProduct = 1;
            StartTrailer(windowProducts[currentProduct].GetTrailer());
            isPointed = true;*/
        }
 public DemoInformation(Product prod)
 {
     //description.IsManipulationEnabled = false;
     if (prod.movie != null)
         InitDemoInformation(prod.movie);
     else if (prod.music != null)
         InitDemoInformation(prod.music, prod.tracklist);
     else if (prod.book != null)
         InitDemoInformation(prod.book);
 }
 public TestWindow()
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     WindowState = WindowState.Maximized;
     WindowStyle = WindowStyle.None;
     db = new DbFileManager();
     Product p = new Product(db.musics[0]);
     DemoRelateds a = new DemoRelateds(GetRelateds(p));
     this.contentControl.Content = a;
 }
        private void InformationBackButton()
        {
            counterFrames = 0;
            counterFramesBody = 0;
            contentControl.Content = idle;
            isPointed = false;
            hue.isDoubleActive = false;
            IdleAnimateFirstHand();
            state = 1;

            if (relatedBackup != null)
                windowProducts[currentProduct] = relatedBackup;

            relatedBackup = null;
            hue.isBright = true;
        }
 private void GoToRelatedInfo(Product product)
 {
     relatedBackup = windowProducts[currentProduct];
     windowProducts[currentProduct] = product;
     SkipTrailer();
 }
        private void CheckPointInThirdButtons(float X, float Y)
        {
            X = X * (float)this.Width;
            Y = Y * (float)this.Height;

            // Related Button
            if (X > this.Width - information.related.ActualWidth - 85 && X < this.Width - 15 &&
                    Y > 15 && Y < ((information.related.Height) + 75))
            {
                if (counterFrames > MAX_FRAMES_PAUSE && !checkedButton)
                {
                    checkedButton = true;
                    counterFrames = 0;
                    information.related.Opacity = 0.25;
                    if (relatedBackup != null)
                    {
                        windowProducts[currentProduct] = relatedBackup;
                        relatedBackup = null;
                    }
                    GoToRelated();
                }
                else if (!checkedButton)
                {
                    counterFrames++;
                    information.related.Opacity += 0.03;
                }
            }

            // Restart Button
            else if (X > this.Width - information.restart.Width - 85 && X < this.Width - 15 &&
                    Y > ((this.Height / 2) - (information.restart.ActualHeight / 2)) && Y < ((this.Height / 2) + (information.restart.ActualHeight / 2)) && windowProducts[currentProduct].GetTrailer()!=null)
            {
                if (counterFrames > MAX_FRAMES_PAUSE && !checkedButton)
                {
                    checkedButton = true;
                    counterFrames = 0;
                    information.restart.Opacity = 0.25;
                    StartTrailer(windowProducts[currentProduct].GetTrailer());
                }
                else if (!checkedButton)
                {
                    counterFrames++;
                    information.restart.Opacity += 0.03;
                }

            }

            // Exit Button
            else if (X > this.Width - information.exit.ActualWidth - 85 && X < this.Width - 15 &&
                   Y < this.Height - 15 && Y > ( this.Height - (information.exit.Height) - 75))
            {
                if (counterFrames > MAX_FRAMES_PAUSE && !checkedButton)
                {
                    checkedButton = true;
                    information.exit.Opacity = 0.25;
                    InformationBackButton();
                }
                else if (!checkedButton)
                {
                    counterFrames++;
                    information.exit.Opacity += 0.03;
                }

            }
            else
            {
                counterFrames = 0;
                information.exit.Opacity = 0.25;
                information.restart.Opacity = 0.25;
                information.related.Opacity = 0.25;
                checkedButton = false;
            }
        }