public KinectV2CustomButtonController(IInputModel inputModel, KinectRegion kinectRegion, EventHandler HandPointerEnter, EventHandler HandPointerLeave)
 {
     _inputModel                    = inputModel as PressableModel;
     _handPointerEnter              = HandPointerEnter;
     _handPointerLeave              = HandPointerLeave;
     _kinectRegion                  = kinectRegion;
     _interactiveElement            = _inputModel.Element as KinectV2CustomButton;
     kinectCoreWindow.PointerMoved += kinectCoreWindow_PointerMoved;
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         _kinectRegion                  = null;
         _inputModel                    = null;
         _interactiveElement            = null;
         kinectCoreWindow.PointerMoved -= kinectCoreWindow_PointerMoved;
         _handPointerEnter              = null;
         _handPointerLeave              = null;
         kinectCoreWindow               = null;
         _disposedValue                 = true;
     }
 }
Exemple #3
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var brush  = new ImageBrush();
            var brush2 = new ImageBrush();

            brush.ImageSource  = new BitmapImage(new Uri(@"C:\Users\markk\Desktop\my_kinect_violin\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\Images\violinicon.png", UriKind.Relative));
            brush2.ImageSource = new BitmapImage(new Uri(@"C:\Users\markk\Desktop\my_kinect_violin\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\WPFKinectV2CustomButton-master\Images\violinicon2.png", UriKind.Relative));

            for (int i = 0; i < 16; i++)
            {
                KinectV2CustomButton button1 = new KinectV2CustomButton();
                if (i <= 3)
                {
                    button1.Name    = "G" + i;
                    button1.Content = "G" + i;
                }
                else if (i >= 4 && i <= 7)
                {
                    button1.Name    = "D" + (i - 4);
                    button1.Content = "D" + (i - 4);
                }
                else if (i >= 8 && i <= 11)
                {
                    button1.Name    = "A" + (i - 8);
                    button1.Content = "A" + (i - 8);
                }
                else
                {
                    button1.Name    = "E" + (i - 12);
                    button1.Content = "E" + (i - 12);
                }
                button1.Margin            = new Thickness(50);
                button1.Width             = 60;
                button1.Height            = 60;
                button1.FontSize          = 30;
                button1.HandPointerEnter += Button1_HandPointerEnter;
                button1.HandPointerLeave += Button1_HandPointerLeave;
                button1.Background        = brush;
                button1.FontWeight        = FontWeights.Bold;
                button1.FontStyle         = FontStyles.Italic;
                button1.Foreground        = Brushes.White;
                button1.BorderBrush       = Brushes.Transparent;
                //button1
                //button1.

                KinectButtons.Children.Add(button1);
            }
            for (int i = 0; i < 4; i++)
            {
                KinectV2CustomButton button2 = new KinectV2CustomButton();
                if (i == 0)
                {
                    button2.Name       = "Violin";
                    button2.Content    = "Violin";
                    button2.Background = brush;
                }
                if (i == 1)
                {
                    button2.Name       = "Ensem";
                    button2.Content    = "Ensem";
                    button2.Background = brush;
                }
                if (i == 2)
                {
                    button2.Name       = "Cello";
                    button2.Content    = "Cello";
                    button2.Background = brush;
                }
                if (i == 3)
                {
                    button2.Name       = "Bass";
                    button2.Content    = "Bass";
                    button2.Background = brush;
                }
                button2.Margin            = new Thickness(25);
                button2.Width             = 60;
                button2.Height            = 60;
                button2.FontSize          = 17;
                button2.HandPointerEnter += Button1_HandPointerEnter;
                button2.HandPointerLeave += Button1_HandPointerLeave;
                button2.BorderBrush       = Brushes.Transparent;
                button2.FontStyle         = FontStyles.Italic;
                button2.Foreground        = Brushes.White;
                button2.FontWeight        = FontWeights.Bold;
                //button2.BorderBrush = Brushes.White;
                KinectButtons2.Children.Add(button2);
            }
        }