Inheritance: KinectBase.IKinectSettings
        //TODO: Subscribe this to the skeletonChanged event and update the GUI with a preview of the skeleton positions
        public NetworkKinectSettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.NetworkKinect)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (NetworkKinectSettings)tempSettings;
                    kinectID = kinectNumber;
                    kinectCore = (NetworkKinectCore)kinect;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();

                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;

                    //Set the binding on the joint mapping data grid
                    jointMappingDataGrid.ItemsSource = kinectSettings.jointMappings;
                    jointMappingDataGrid.Items.Refresh();
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a network Kinect sensor.");
                }
            }
            else
            {
                throw new ArgumentNullException("settings");
            }
        }
Example #2
0
        public NetworkKinectCore(ref MasterSettings settings, bool isGUILaunched, int kinectNumber, string name)
        {
            nkName = name;
            masterSettings = settings;
            dynamic tempSettings = masterSettings.kinectOptionsList[(int)kinectNumber];  //Because of the wrapper, we have to go through a dynamic variable
            masterKinectSettings = (NetworkKinectSettings)tempSettings;
            kinectID = kinectNumber;

            isGUI = isGUILaunched;
            //NOTE: unlike the physical Kinect sensors, network Kinect sensors are not launched on the creation of the core
        }
Example #3
0
        public NetworkKinectCore(ref MasterSettings settings, bool isGUILaunched, int kinectNumber, string name)
        {
            nkName         = name;
            masterSettings = settings;
            dynamic tempSettings = masterSettings.kinectOptionsList[(int)kinectNumber];  //Because of the wrapper, we have to go through a dynamic variable

            masterKinectSettings = (NetworkKinectSettings)tempSettings;
            kinectID             = kinectNumber;

            isGUI = isGUILaunched;
            //NOTE: unlike the physical Kinect sensors, network Kinect sensors are not launched on the creation of the core
        }
        public void UpdateGUI(KinectBase.MasterSettings settings)
        {
            if (kinectID.HasValue)
            {
                masterSettings = settings;
                dynamic tempSettings = masterSettings.kinectOptionsList[kinectID.Value];
                kinectSettings = (NetworkKinectSettings)tempSettings;


                //Shutdown the server, if it is running
                bool wasRunning = false;
                if (kinectCore.isKinectRunning)
                {
                    kinectCore.ShutdownSensor();
                    wasRunning = true;
                }

                //Update the skeleton server and joint mappings
                serverNameTextBox.Text           = kinectSettings.serverName;
                jointMappingDataGrid.ItemsSource = kinectSettings.jointMappings;
                jointMappingDataGrid.Items.Refresh();

                //Update the physical position
                xPosTextBox.Text  = kinectSettings.kinectPosition.X.ToString();
                yPosTextBox.Text  = kinectSettings.kinectPosition.Y.ToString();
                zPosTextBox.Text  = kinectSettings.kinectPosition.Z.ToString();
                yawTextBox.Text   = kinectSettings.kinectYaw.ToString();
                pitchTextBox.Text = kinectSettings.kinectPitch.ToString();
                rollTextBox.Text  = kinectSettings.kinectRoll.ToString();

                //Update the hand grab data
                lhServerTextBox.Text  = kinectSettings.lhServerName;
                lhChannelTextBox.Text = kinectSettings.lhChannel.ToString();
                rhServerTextBox.Text  = kinectSettings.rhServerName;
                rhChannelTextBox.Text = kinectSettings.rhChannel.ToString();

                //Restart the server if it was running to begin with
                if (wasRunning)
                {
                    kinectCore.StartNetworkKinect();
                }
            }
        }
        //TODO: Subscribe this to the skeletonChanged event and update the GUI with a preview of the skeleton positions
        public NetworkKinectSettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.NetworkKinect)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (NetworkKinectSettings)tempSettings;
                    kinectID       = kinectNumber;
                    kinectCore     = (NetworkKinectCore)kinect;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();

                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

                    //Set the binding on the joint mapping data grid
                    jointMappingDataGrid.ItemsSource = kinectSettings.jointMappings;
                    jointMappingDataGrid.Items.Refresh();

                    //Subscribe to the skeletonChanged event
                    kinectCore.SkeletonChanged += kinectCore_SkeletonChanged;

                    guiUpdateTimer           = new Timer();
                    guiUpdateTimer.Interval  = 1000;
                    guiUpdateTimer.AutoReset = true;
                    guiUpdateTimer.Elapsed  += guiUpdateTimer_Elapsed;
                    guiUpdateTimer.Start();
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a network Kinect sensor.");
                }
            }
            else
            {
                throw new ArgumentNullException("settings");
            }
        }
Example #6
0
 //Needed for serialization
 public Settings()
 {
     realSettings = new NetworkKinectSettings();
 }
Example #7
0
 //Constructor to setup the real KinectV1Settings object
 public Settings(string uniqueID, int kinectNumber)
 {
     realSettings = new NetworkKinectSettings(uniqueID, kinectNumber);
 }
        public void UpdateGUI(KinectBase.MasterSettings settings)
        {
            if (kinectID.HasValue)
            {
                masterSettings = settings;
                dynamic tempSettings = masterSettings.kinectOptionsList[kinectID.Value];
                kinectSettings = (NetworkKinectSettings)tempSettings;

                //Shutdown the server, if it is running
                bool wasRunning = false;
                if (kinectCore.isKinectRunning)
                {
                    kinectCore.ShutdownSensor();
                    wasRunning = true;
                }

                //Update the skeleton server and joint mappings
                serverNameTextBox.Text = kinectSettings.serverName;
                jointMappingDataGrid.ItemsSource = kinectSettings.jointMappings;
                jointMappingDataGrid.Items.Refresh();

                //Update the physical position
                xPosTextBox.Text = kinectSettings.kinectPosition.X.ToString();
                yPosTextBox.Text = kinectSettings.kinectPosition.Y.ToString();
                zPosTextBox.Text = kinectSettings.kinectPosition.Z.ToString();
                yawTextBox.Text = kinectSettings.kinectYaw.ToString();
                pitchTextBox.Text = kinectSettings.kinectPitch.ToString();
                rollTextBox.Text = kinectSettings.kinectRoll.ToString();

                //Update the hand grab data
                lhServerTextBox.Text = kinectSettings.lhServerName;
                lhChannelTextBox.Text = kinectSettings.lhChannel.ToString();
                rhServerTextBox.Text = kinectSettings.rhServerName;
                rhChannelTextBox.Text = kinectSettings.rhChannel.ToString();

                //Restart the server if it was running to begin with
                if (wasRunning)
                {
                    kinectCore.StartNetworkKinect();
                }
            }
        }