public MainPage() { InitializeComponent(); _navigationHelper = new NavigationHelper(this); _sensor = KinectSensor.GetDefault(); if (_sensor != null) { _sensor.Open(); _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body); _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived; _gestureController = new GestureController(); _gestureController.GestureRecognized += GestureController_GestureRecognized; } // Initialize the gesture detection objects for our gestures this.gestureDetectorList = new List<GestureDetector>(); // Create a gesture detector for each body (6 bodies => 6 detectors) int maxBodies = this._sensor.BodyFrameSource.BodyCount; for (int i = 0; i < maxBodies; ++i) { GestureResultView result = new GestureResultView(i, false, false, 0.0f); GestureDetector detector = new GestureDetector(this._sensor, result); result.PropertyChanged += GestureResult_PropertyChanged; this.gestureDetectorList.Add(detector); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { _sensor = KinectSensor.GetDefault(); if (_sensor != null) { _sensor.Open(); _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body); _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived; _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureController_GestureRecognized; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { KinectSensor sensor = SensorExtensions.Default(); if (sensor != null) { sensor.EnableAllStreams(); sensor.ColorFrameReady += Sensor_ColorFrameReady; sensor.DepthFrameReady += Sensor_DepthFrameReady; sensor.SkeletonFrameReady += Sensor_SkeletonFrameReady; _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureController_GestureRecognized; sensor.Start(); } }
public GesturesPage() { InitializeComponent(); _sensor = KinectSensor.GetDefault(); if (_sensor != null) { _sensor.Open(); _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body); _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived; _gestureController = new GestureController(); _gestureController.GestureRecognized += GestureController_GestureRecognized; } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public ImageViewer(string imageUrl, string category, string selectedImage) { this.category = category; this.InitializeComponent(); // set the name of the content this.contentName.Text = selectedImage; // initialize the sensor chooser and UI this.sensorChooser = new KinectSensorChooser(); this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged; this.sensorChooserUi.KinectSensorChooser = this.sensorChooser; this.sensorChooser.Start(); // Bind the sensor chooser's current sensor to the KinectRegion var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser }; BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding); // assign image to button BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(imageUrl); bi.EndInit(); image.Source = bi; // Bind listener to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureRecognized; if (!Globals.userHasVisitedInteractionPage) { //show help screen showHelp(); Globals.userHasVisitedInteractionPage = true; } // launch timer to show help System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 15000; aTimer.Enabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { // show the user an image of each category /* string url = "http://backend.deviantart.com/rss.xml?q=deviation"; string urlContents = DeviantInteraction.getContentsURL(url); List<Category> categories = DeviantInteraction.parseRSS(url); // get the number of components to display int numImages = images.Count; */ currentWindow = this; // initialize sound player player = new SoundPlayer(); player.SoundLocation = hoverSound; this.InitializeComponent(); // initialize the sensor chooser and UI this.sensorChooser = new KinectSensorChooser(); this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged; this.sensorChooserUi.KinectSensorChooser = this.sensorChooser; this.sensorChooser.Start(); /* kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected); // Get first Kinect Sensor Console.WriteLine(kinectSensor.Status.ToString()); skeletons = new Skeleton[kinectSensor.SkeletonStream.FrameSkeletonArrayLength]; // Allocate ST data userInfos = new UserInfo[InteractionFrame.UserInfoArrayLength]; interactionStream = new InteractionStream(kinectSensor, new DummyInteractionClient()); interactionStream.InteractionFrameReady += InteractionStreamOnInteractionFrameReady; kinectSensor.DepthFrameReady += SensorOnDepthFrameReady; kinectSensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady); // Get Ready for Skeleton Ready Events kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30); kinectSensor.SkeletonStream.Enable(); try { kinectSensor.DepthStream.Range = DepthRange.Near; kinectSensor.SkeletonStream.EnableTrackingInNearRange = true; } catch (InvalidOperationException) { // Non Kinect for Windows devices do not support Near mode, so reset back to default mode. kinectSensor.DepthStream.Range = DepthRange.Default; kinectSensor.SkeletonStream.EnableTrackingInNearRange = false; } kinectSensor.Start(); */ // Bind the sensor chooser's current sensor to the KinectRegion var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser }; BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding); // Clear out placeholder content this.wrapPanel.Children.Clear(); // Add in display content - initialize all the images for (var index = 0; index < deviantCategories.Length; ++index) { // access current image object // Image img = images[index]; // load image from url // get the image link //string imageLink = DeviantInteraction.getImageLink(img.link); //Console.WriteLine(imageLink); /* BitmapImage bi = new BitmapImage(); bi.BeginInit(); // bi.UriSource = new Uri(images[index].link); bi.UriSource = new Uri("http://i.space.com/images/i/000/005/972/original/sun-photo-solar-filament-101118-02.jpg?1294094311"); bi.EndInit(); */ var button = new KinectTileButton { // Background = new ImageBrush(bi), Label = deviantCategories[index] // Height = 200, // Width = 100 }; // add hover event button.MouseEnter += new System.Windows.Input.MouseEventHandler(mouseEnteredButton); this.wrapPanel.Children.Add(button); } // Bind listener to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureRecognized; if(!Globals.userHasVisitedFirstPage) { //show help screen showHelp(); Globals.userHasVisitedFirstPage = true; } // launch timer to show help System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 15000; aTimer.Enabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public BrowseCategory(string category) { this.InitializeComponent(); // set the category name displayed this.category.Text = category.ToUpper(); this.categoryName = category; string url = "http://backend.deviantart.com/rss.xml?q=in:" + category; // get the images of the category images = DeviantInteraction.getImagesFromCategory(url); // get the number of components to display int numImages = images.Count; // initialize the sensor chooser and UI this.sensorChooser = new KinectSensorChooser(); this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged; this.sensorChooserUi.KinectSensorChooser = this.sensorChooser; this.sensorChooser.Start(); // Bind the sensor chooser's current sensor to the KinectRegion var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser }; BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding); // Clear out placeholder content this.wrapPanel.Children.Clear(); // Add in display content - initialize all the images for (var index = 0; index < images.Count; ++index) { Console.WriteLine("browse category : image " + index); // access current image object Image img = images[index]; // load image from url BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri( DeviantInteraction.getImageThumbnail(images[index].link)); bi.EndInit(); var button = new KinectTileButton { Background = new ImageBrush(bi), Label = img.title, Height = 250, Width = 250 }; this.wrapPanel.Children.Add(button); } // Bind listener to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureRecognized; }
private void Window_Loaded(object sender, RoutedEventArgs e) { Process.Start(@"C:\Windows\System32\KinectService.exe"); _sensor = KinectSensor.Default; if (_sensor != null) { _sensor.Open(); _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body); _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived; _gestureController = new GestureController(GestureType.All); _gestureController.GestureRecognized += GestureController_GestureRecognized; } }