sk8ergirl 0 Newbie Poster

I followed one of the tutorial to have hand cursor and when I run my app I couldn't see the hand cursor or the userviewer
I was expecting something like this http://dotneteers.net/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/vbandi/image_5F00_2FF95AAB.png

but nothing happened when I run my programme I only saw the button I spent hours trying to fix it but I didn't know what is wrong with my code
here is my code

<Window x:Class="handMovement.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:k="http://schemas.microsoft.com/kinect/2013"

        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
        <Label x:Name="KinectStatus" Content="Kinect status change" 
               HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="15"></Label>
        <k:KinectRegion x:Name="kinectRegion">
            <Grid>
                <k:KinectUserViewer VerticalAlignment="Bottom" HorizontalAlignment="Right" UserColoringMode="HighlightPrimary" PrimaryUserColor="green" Height="150"
                k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" />
                <k:KinectTileButton x:Name="ClickMe" Label="Click Me" Click="ClickMe_Click" VerticalAlignment="Top" HorizontalAlignment="Left"></k:KinectTileButton>
                <k:KinectScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" VerticalAlignment="Center">
                    <StackPanel Orientation="Horizontal" x:Name="StackPanelWithButton" />
                </k:KinectScrollViewer>
            </Grid>
        </k:KinectRegion>

    </Grid>
</Window>

and here is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;

namespace handMovement
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private KinectSensorChooser sensorChooser;

        public MainWindow()
        {
            InitializeComponent();
            Loaded += load; 
        }
        private void load(object sender, RoutedEventArgs e)
        {
            this.sensorChooser = new KinectSensorChooser();
            this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
            this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
            this.sensorChooser.Start();
            GetTileButtonsForStackPanel();
        }


        private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs args)
        {
            bool error = false;
            if (args.OldSensor != null)
            {
                try
                {
                    args.OldSensor.DepthStream.Range = DepthRange.Default;
                    args.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
                    args.OldSensor.DepthStream.Disable();
                    args.OldSensor.SkeletonStream.Disable();
                }
                catch (InvalidOperationException inEX) { error = true; }
            }

            if (args.NewSensor != null)
            {
                switch (Convert.ToString(args.NewSensor.Status))
                {
                    case "Undefined": KinectStatus.Content = "Undefined"; break;
                    case "Disconnected": KinectStatus.Content = "Disconnected"; break;
                    case "Connected": KinectStatus.Content = "Connected"; break;
                    case "Initializing": KinectStatus.Content = "Initializing"; break;
                    case "Error": KinectStatus.Content = "Error"; break;
                    case "NotPowered": KinectStatus.Content = "NotPowered"; break;
                    case "NotReady": KinectStatus.Content = "NotReady"; break;
                    case "DeviceNotGenuine": KinectStatus.Content = "DeviceNotGenuine"; break;
                    case "DeviceNotSupported": KinectStatus.Content = "DeviceNotSupported"; break;
                    case "InsufficientBandwidth": KinectStatus.Content = "InsufficientBandwidth"; break;
                    default: KinectStatus.Content = "Undefined"; break;
                }
                try
                {
                    args.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
                    args.NewSensor.SkeletonStream.Enable();
                    try
                    {
                        args.NewSensor.DepthStream.Range = DepthRange.Near;
                        args.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
                        args.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                    }
                    catch (InvalidOperationException inEX)
                    {
                        args.NewSensor.DepthStream.Range = DepthRange.Default;
                        args.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
                        error = true;
                    }
                }
                catch (InvalidOperationException inEX) { error = true; }
            }
            if (!error) { kinectRegion.KinectSensor = args.NewSensor; }
        }

        private void ClickMe_Click(object sender, RoutedEventArgs e)
        {
            KinectStatus.Content = "Clicked me";

        }

        private void GetTileButtonsForStackPanel()
        {
            for (int i = 1; i <= 35; i++)
            {
                KinectTileButton ObjTileButton = new KinectTileButton();
                ObjTileButton.Height = 250;
                ObjTileButton.Label = i;
                ObjTileButton.Click += (o, Args) => KinectStatus.Content = "You clicked on tile button : " + i;
                StackPanelWithButton.Children.Add(ObjTileButton);
            }
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.