static void Main() { _source.TraceEvent(TraceEventType.Start, 0, "MSEKinectBootstrapper"); MSEKinectManager km = new MSEKinectManager(); km.Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Dispatcher.Invoke(new Action(delegate() { DrawingResources.GenerateGridLines(canvas, GridLines, GridLinesScaleSlider.Value); GridLines.ShowGridLines = true; // When we do the event handling through XAML, an event fires before the Window is loaded, and it freezes the program, so we do event binding after Window is loaded GridLinesScaleSlider.ValueChanged += UpdateGridlines; GridLinesCheckBox.Checked += ChangeGridlineVisibility; GridLinesCheckBox.Unchecked += ChangeGridlineVisibility; RangeCheckBox.Checked += ChangeRangeVisibility; RangeCheckBox.Unchecked += ChangeRangeVisibility; //Create Dictionaries for DeviceControl, PersonControl DeviceControlDictionary = new Dictionary <string, DeviceControl>(); PersonControlDictionary = new Dictionary <PairablePerson, PersonControl>(); TrackerControlDictionary = new Dictionary <string, TrackerControl>(); //Initialize and Start MSEKinectManager kinectManager = new MSEKinectManager(); kinectManager.Start(); // The tracker is created in the PersonManager constructor, so there's actually no way for us to listen for its creation the first time //trackerChanged(kinectManager.PersonManager, kinectManager.PersonManager.Tracker); //Setup Events for Device Addition and Removal, Person Addition and Removal kinectManager.DeviceManager.DeviceAdded += deviceAdded; kinectManager.DeviceManager.DeviceRemoved += deviceRemoved; kinectManager.PersonManager.PersonAdded += personAdded; kinectManager.PersonManager.PersonRemoved += personRemoved; kinectManager.PersonManager.newKinectDiscovered += KinectDiscovered; kinectManager.PersonManager.kinectRemoved += KinectRemoved; //Seperate components for displaying the visible skeletons skeletonRenderer = new SkeletonRenderer(SkeletonBasicsImage); //// Values retrieved from: //// http://blogs.msdn.com/b/kinectforwindows/archive/2012/01/20/near-mode-what-it-is-and-isn-t.aspx //// http://msdn.microsoft.com/en-us/library/jj131033.aspx //tracker.MinRange = 0.8; //tracker.MaxRange = 4; //tracker.FieldOfView = 57; })); }
public void SuccessfulPairingTest() { Setup(); // Setup the 'became paired' route on the client. Client.Route(Routes.BecomePairedRoute, delegate(IARequest request, IAResponse response) { // In response to receiving 'became paired', we test some properties on the server // Find the mock pairable person we created, test their pairing state PairablePerson person = (PairablePerson)Server.Locator.Persons.Find(x => x.Identifier.Equals("Bob")); Assert.AreEqual(PairingState.Paired, person.PairingState); // Find the Client's IADevice on the server, test its pariing state PairableDevice device = (PairableDevice)Server.Locator.Devices.Find(x => x.Identifier.Equals(Client.OwnDevice.Name)); Assert.AreEqual(PairingState.Paired, device.PairingState); // Test that the two were paired with each other Assert.AreEqual(person.HeldDeviceIdentifier, device.Identifier); Assert.AreEqual(device.HeldByPersonIdentifier, person.Identifier); doneWaitingForResponse = true; }); Server.Start(); Client.Start(); WaitForConnections(); // Create a person on the server, who is attempting to pair their device // NB: Setting PairingAttempt on a person begins a 3 second timer, after which it resets to NotPaired // The test should always complete before then, though Server.Locator.Persons.Add(new PairablePerson() { Identifier = "Bob", Location = new System.Windows.Point(1, 1), PairingState = PairingState.PairingAttempt }); // Notify the server that the client wants to be paired Client.SendRequest(new IARequest(Routes.RequestPairingRoute), Server.IntAirAct.OwnDevice); WaitForResponse(); Teardown(); }
public void SuccessfulPairingTest() { Setup(); // We would like to be able to test the round trip communication, sending 'request pairing' on the client to the server, to sending // 'become paired' from server to client. // But internally, tinyIOC registers things by type, so only the first instance of intairact's server adapter gets retrieved. // All routes are handled by the same IAA instance, which is obviously a problem when we have two in the system that we would like to have talk to each other. // So, at present this part of the test cannot work //Client.Route(Routes.BecomePairedRoute, delegate(IARequest request, IAResponse response) //{ // doneWaitingForResponse = true; //}); Server.Start(); Client.Start(); WaitForConnections(); // Create a person on the server, who is attempting to pair their device // NB: Setting PairingAttempt on a Person begins a 3 second timer, after which their pairing state resets to NotPaired // The test should always complete before then, but if mysterious failures start appearing, it could be time related Server.Locator.Persons.Add(new PairablePerson() { Identifier = "Bob", Location = new System.Windows.Point(1, 1), PairingState = PairingState.PairingAttempt }); // Notify the server that the client wants to be paired IARequest pairingRequest = new IARequest(Routes.RequestPairingRoute); pairingRequest.Origin = Client.OwnDevice; pairingRequest.Parameters["identifier"] = Client.OwnDevice.Name; Client.SendRequest(pairingRequest, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception exception) { if (exception != null) { System.Diagnostics.Debug.WriteLine(exception.Message); Assert.Fail(); } // In response to the return of the request, we test some properties on the server // Find the mock pairable person we created, test their pairing state PairablePerson person = (PairablePerson)Server.Locator.Persons.Find(x => x.Identifier.Equals("Bob")); Assert.AreEqual(PairingState.Paired, person.PairingState); // Find the Client's IADevice on the server, test its pariing state PairableDevice device = (PairableDevice)Server.Locator.Devices.Find(x => x.Identifier.Equals(Client.OwnDevice.Name)); Assert.AreEqual(PairingState.Paired, device.PairingState); // Test that the two were paired with each other Assert.AreEqual(person.HeldDeviceIdentifier, device.Identifier); Assert.AreEqual(device.HeldByPersonIdentifier, person.Identifier); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }