/// <summary> /// Initializes a new instance of the MainWindow class. /// </summary> public MainWindow() { InitializeComponent(); // 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); //Set SystemMap SystemMap sm = new SystemMap(); system_list = sm.getLocals(); foreach (String drive in system_list) { Image i = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri("../../Images\\Hard-Drive-icon.png", UriKind.Relative); src.CacheOption = BitmapCacheOption.OnLoad; src.EndInit(); i.Source = src; i.Stretch = Stretch.Uniform; i.MaxHeight = 150; i.MaxWidth = 150; i.Margin = new Thickness(10, 10, 10, 10); var button = new KinectTileButton { Label = (drive).ToString(CultureInfo.CurrentCulture), FontSize = 20, Background = new ImageBrush(i.Source), MaxHeight = i.MaxHeight, MaxWidth = i.MaxWidth }; this.wrapPanel.Children.Add(button); } }