public void addFiles(String path) { List <String> list = sm.getSubContent(path); if (list.Count == 0) { Console.WriteLine("Empty content"); } else { foreach (String drive in list) { Image i = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); if (File.Exists(path + drive)) { src.UriSource = new Uri("../../Images\\File-icon.png", UriKind.Relative); } else { src.UriSource = new Uri("../../Images\\Folder-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); //Set the label /* * Label label = new Label(); * label.Name = drive; * label.MaxWidth = 20; * label.MaxHeight = 20; */ 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); //Add the image in the Stack Panel //sp.Children.Add(i); } } }
private void OnPuzzleButtonClick(object sender, RoutedEventArgs e) { e.Handled = true; KinectTileButton b = e.Source as KinectTileButton; if (b != null) { int row = (int)b.GetValue(Grid.RowProperty); int col = (int)b.GetValue(Grid.ColumnProperty); MoveStatus moveStatus = _puzzleLogic.GetMoveStatus(row, col); if (MoveMade != null) { MoveMade(this, new HandledEventArgs(moveStatus != MoveStatus.BadMove)); } if (moveStatus != MoveStatus.BadMove) { if (!_styling || !_shouldAnimateInteractions) { // Not templated, just move piece MovePiece(b, row, col); } else { AnimatePiece(b, row, col, moveStatus); } } } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.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); // Clear out placeholder content this.wrapPanel.Children.Clear(); // Add in display content for (var index = 0; index < 300; ++index) { var button = new KinectTileButton { Label = (index + 1).ToString(CultureInfo.CurrentCulture) }; this.wrapPanel.Children.Add(button); } // Bind listener to scroll viewer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); }
private void FillScrollContent() { ModeSelectorPanel.Children.Clear(); KinectTileButton[] modeButtons = new KinectTileButton[MODE_COMMAND_TEXT.Length]; // fill scroll content for (int i = 0; i < MODE_COMMAND_TEXT.Length; i++) { modeButtons[i] = new KinectTileButton { Label = MODE_COMMAND_TEXT[i], Height = 150 }; ModeSelectorPanel.Children.Add(modeButtons[i]); } // XXX: REMOVE ONCE TESTING COMPLETE modeButtons[0].Click += delegate(object sender, RoutedEventArgs e) { if (currentGesture != null) { return; } currentGesture = new TestGesture(); currentGesture.SequenceUpdated += HandleSequenceUpdatedEvent; }; // TODO: hook each button to appropriate gesture in Gestures namespace }
public void updateAudioListTop10() { centerLabel.Content = "TOP Songs"; updateChosenList(); this.clearScrollList(); string[] tmp = this.getTop10(); for (int i = 0; i < tmp.Length; i++) { //audioFiles.Add(new AudioFile(i, audioList[i], 0)); KinectTileButton btn = presentAudioFile(tmp[i]); //KinectTileButton btn = new KinectTileButton{Name="audio" + i.ToString(), Cl} btn.Name = "audio" + i.ToString(); //btn.Height = 200; //{ // Name = "audio" + i.ToString(), // Content = new Label { Content = audioList[i], FontSize=50 }, // Height = 200, // //FontSize = 36 //}; //btn.Click btn.Click += songClicked; btn.MouseEnter += songHover; //btn.GotFocus += songHover; //btn.TouchEnter += songHover; KinectRegion.AddHandPointerEnterHandler(btn, this.songHover); //KinectRegion.AddHandPointerLeaveHandler(btn, this.songClicked); //kinectRegion.Ad scrollList.Children.Add(btn); //scrollList.Children.Add(presentAudioFile(audioList[i])); } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.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); // Clear out placeholder content //this.wrapPanel.Children.Clear(); // Add in display content for (var index = 0; index < 300; ++index) { var button = new KinectTileButton { Label = (index + 1).ToString(CultureInfo.CurrentCulture) }; // this.wrapPanel.Children.Add(button); } // Bind listner to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); // Inicialización de la detección de gestos. sensor = KinectSensor.KinectSensors.Where( s => s.Status == KinectStatus.Connected).FirstOrDefault(); if (sensor != null) { sensor.SkeletonStream.Enable(); sensor.SkeletonFrameReady += Sensor_SkeletonFrameReady; _gestureR.GestureRecognized += Gesture_GestureRecognizedR; _gestureL.GestureRecognized += Gesture_GestureRecognizedL; //_gestureClapIn.GestureRecognized += Gesture_GestureRecognizedClapIn; //_gestureClapOut.GestureRecognized += Gesture_GestureRecognizedClapOut; _gestureSilenceIn.GestureRecognized += Gesture_GestureRecognizedSilenceIn; _gestureSlideR.GestureRecognized += Gesture_GestureRecognizedSlideR; sensor.Start(); } // Reproductor de música. player = new System.Media.SoundPlayer(); player.SoundLocation = "Media/vivaldi.wav"; player.Play(); isPlayerRunning = true; }
/// <summary> /// List View button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ScrollButtonClick(object sender, RoutedEventArgs e) { KinectTileButton button = (KinectTileButton)sender; videoPlayer = new VideoPlayer(button.Tag as String); Main.Content = videoPlayer; this.BackButton.Visibility = Visibility.Visible; this.Toolbar.Visibility = Visibility.Collapsed; }
void ButtonOnClick(Object sender, RoutedEventArgs e) { KinectTileButton btn = (KinectTileButton)sender; if (btn == recordButton) { OnStartRecord(); } else if (btn == useButton) { OnTestGesture(); } else if (btn == stopButton) { OnStopRecord(); } else if (btn == modeButton) { if (m_isInRecordMode) { m_isInRecordMode = false; recordButton.Visibility = System.Windows.Visibility.Hidden; useButton.Visibility = System.Windows.Visibility.Hidden; stopButton.Visibility = System.Windows.Visibility.Hidden; exportButton.Visibility = System.Windows.Visibility.Hidden; OnTestGesture(); codeView.Visibility = System.Windows.Visibility.Visible; consoleView.Visibility = System.Windows.Visibility.Visible; runButton.Visibility = System.Windows.Visibility.Visible; UndoButton.Visibility = System.Windows.Visibility.Visible; } else { m_isInRecordMode = true; recordButton.Visibility = System.Windows.Visibility.Visible; useButton.Visibility = System.Windows.Visibility.Visible; stopButton.Visibility = System.Windows.Visibility.Visible; exportButton.Visibility = System.Windows.Visibility.Visible; OnStopRecord(); m_codeString = ""; codeView.Content = m_codeString; codeView.Visibility = System.Windows.Visibility.Hidden; consoleView.Visibility = System.Windows.Visibility.Hidden; runButton.Visibility = System.Windows.Visibility.Hidden; UndoButton.Visibility = System.Windows.Visibility.Hidden; } } else if (btn == exportButton) { //todo } }
private KinectTileButton createKinectButton(SignWord signWord) { KinectTileButton button = new KinectTileButton(); button.DataContext = signWord; button.Click += btnSignWord_Click; button.Label = signWord.Name; return(button); }
public void setActiveSong(int index) { if (index >= 0 && index < scrollChosenList.Children.Count) { UIElement tmp = scrollChosenList.Children[index]; KinectTileButton btn = (tmp as KinectTileButton); setActiveSong(btn); } }
private void ColorButton_Click(object sender, RoutedEventArgs e) { KinectTileButton b = sender as KinectTileButton; SolidColorBrush brush = b.Background as SolidColorBrush; lastColor = color; color = brush.Color; ColorSelectorGrid.Visibility = System.Windows.Visibility.Collapsed; SelectedColorShower.Fill = new SolidColorBrush(color); }
private void loadPicture_Click(object sender, RoutedEventArgs e) { KinectTileButton button = sender as KinectTileButton; string imgPath = (string)button.Tag; inkCanvas.Children.Clear(); inkCanvas.Strokes.Clear(); fileName = System.IO.Path.GetFileName(imgPath); Loadimage.ImportPng(new Uri(imgPath), inkCanvas); imageSelectOverlay.Visibility = Visibility.Collapsed; }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.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); // Clear out placeholder content this.wrapPanel.Children.Clear(); // Add in display content /*for (var index = 0; index < 300; ++index) * { * var button = new KinectTileButton { Label = (index + 1).ToString(CultureInfo.CurrentCulture) }; * this.wrapPanel.Children.Add(button); * }*/ string[] Files = Directory.GetFiles("C:\\Borne_OTM", "*.*", SearchOption.AllDirectories); foreach (string file in Files) { BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri(file, UriKind.Relative); bi.EndInit(); var button = new KinectTileButton(); button.Height = 600; button.Width = 400; button.Background = new ImageBrush(bi); this.wrapPanel.Children.Add(button); } // Bind listner to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); }
public void setActiveSong(KinectTileButton btn) { btn.BorderBrush = Brushes.Gold; btn.BorderThickness = new Thickness(5.0); if (this.activeElement != null && this.activeElement != btn) { this.activeElement.BorderThickness = new Thickness(0.0); } this.activeElement = btn; }
private void BuildListView() { MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.ScrubbingEnabled = true; mediaPlayer.Open(uri); mediaPlayer.Pause(); mediaPlayer.MediaOpened += new EventHandler(delegate(Object o, EventArgs e) { MediaPlayer mediaPlayer1 = o as MediaPlayer; for (int i = 0; i < positions.Count; i++) { var ts = new TimeSpan(0, 0, Convert.ToInt32(positions.ElementAt(i))); mediaPlayer1.Play(); mediaPlayer1.Position = ts; DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); drawingContext.DrawVideo(mediaPlayer1, new Rect(0, 0, 160, 100)); drawingContext.Close(); double dpiX = 1 / 200; double dpiY = 1 / 200; RenderTargetBitmap bmp = new RenderTargetBitmap(160, 100, dpiX, dpiY, PixelFormats.Pbgra32); bmp.Render(drawingVisual); Image newImage = new Image(); newImage.Source = bmp; newImage.Stretch = Stretch.Uniform; newImage.Width = 200; newImage.Height = 120; KinectTileButton button = new KinectTileButton(); button.Label = ts.ToString(); button.Width = Double.NaN; button.Height = Double.NaN; button.FontSize = 18.0; button.Width = 200; button.Height = 120; button.Background = Brushes.Black; button.FontSize = 12.0; button.Content = newImage; button.Click += (o1, re) => { mediaElement.Position = ts; }; scrollContent.Children.Add(button); mediaPlayer1.Pause(); } mediaPlayer.Close(); }); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.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); // Clear out placeholder content //this.wrapPanel.Children.Clear(); // Add in display content var btn_AddRule = new KinectTileButton { Label = ("Add a Rule") }; var btn_DeleteRule = new KinectTileButton { Label = ("Delete a Rule") }; var btn_EditRule = new KinectTileButton { Label = ("Edit a Rule") }; var btn_ListRule = new KinectTileButton { Label = ("List Rules") }; var btn_SearchRule = new KinectTileButton { Label = ("Search Rules") }; this.wrapPanel.Children.Capacity = 120; this.wrapPanel.Children.Add(btn_AddRule); this.wrapPanel.Children.Add(btn_DeleteRule); this.wrapPanel.Children.Add(btn_EditRule); this.wrapPanel.Children.Add(btn_ListRule); this.wrapPanel.Children.Add(btn_SearchRule); // Bind listner to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); }
private void updateChosenList() { scrollChosenList.Children.Clear(); for (int i = 0; i < chosenList.Count; i++) { KinectTileButton btn = presentAudioFile(chosenList[i].ToString()); btn.Name = "audio" + i.ToString(); btn.Click += removeSong; btn.MouseEnter += songHover; KinectRegion.AddHandPointerEnterHandler(btn, this.songHover); scrollChosenList.Children.Add(btn); //this.updateInfo(btn.Name); } }
private KinectTileButton ClonarBoton(KinectTileButton original) { KinectTileButton nuevo = new KinectTileButton(); Brush imagen = original.Background; nuevo.Background = imagen; nuevo.Width = selected.Width; nuevo.Height = selected.Height; nuevo.Name = selected.Name; nuevo.Uid = "elegido"; nuevo.Click += (s, e) => { SalaObra(s, e); }; return(nuevo); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.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); // Clear out placeholder content this.wrapPanel.Children.Clear(); // Add in display content var bApplesGame = new KinectTileButton { Label = "Apples Game" }; bApplesGame.Width = 450; bApplesGame.Height = 450; this.wrapPanel.Children.Add(bApplesGame); var bBubblesGame = new KinectTileButton { Label = "Bubbles Game" }; bBubblesGame.Width = 450; bBubblesGame.Height = 450; this.wrapPanel.Children.Add(bBubblesGame); /*for (var index = 0; index < gamesCount; ++index) * { * var button = new KinectTileButton { Label = "Game " + (index + 1).ToString(CultureInfo.CurrentCulture) }; * button.Width = 450; * button.Height = 450; * this.wrapPanel.Children.Add(button); * }*/ // Bind listner to scrollviwer scroll position change, and check scroll viewer position this.UpdatePagingButtonState(); scrollViewer.ScrollChanged += (o, e) => this.UpdatePagingButtonState(); }
// Assumed to be a valid move. private void MovePiece(KinectTileButton b, int row, int col) { PuzzleCell newPosition = _puzzleLogic.MovePiece(row, col); b.SetValue(Grid.ColumnProperty, newPosition.Col); b.SetValue(Grid.RowProperty, newPosition.Row); if (_puzzleLogic.CheckForWin()) { if (PuzzleWon != null) { PuzzleWon(this, EventArgs.Empty); } } }
/// <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); } }
void OnScrollViewButtonClick(Object sender, RoutedEventArgs e) { KinectTileButton btn = (KinectTileButton)sender; selectedToken = btn.Content.ToString(); Console.WriteLine(selectedToken); //Back to the main windows MainWindow main = new MainWindow(); GesturePackage pk = new GesturePackage(selectedToken); pk.setLeftCoordinates(left_coordinates); pk.setRightCoordinates(right_coordinates); Clean(); this.Close(); main.OpenMain(pk); }
private void SetupThePuzzleGridStructure() { _puzzleLogic = new PuzzleLogic(_numRows); // Define rows and columns in the Grid for (int row = 0; row < _numRows; row++) { RowDefinition r = new RowDefinition(); r.Height = GridLength.Auto; this.RowDefinitions.Add(r); ColumnDefinition c = new ColumnDefinition(); c.Width = GridLength.Auto; this.ColumnDefinitions.Add(c); } Style buttonStyle = (Style)this.Resources["PuzzleButtonStyle"]; // Now add the buttons in int i = 1; for (int row = 0; row < _numRows; row++) { for (int col = 0; col < _numRows; col++) { // lower right cell is empty if (_numRows != 1 && row == _numRows - 1 && col == _numRows - 1) { continue; } KinectTileButton b = new KinectTileButton(); b.FontSize = 24; // Styling comes in only here... if (_styling) { b.Style = buttonStyle; } b.SetValue(Grid.RowProperty, row); b.SetValue(Grid.ColumnProperty, col); b.Content = i.ToString(); i++; this.Children.Add(b); } } }
private void btnSignWord_Click(object sender, RoutedEventArgs e) { KinectTileButton button = (KinectTileButton)sender; if (signWordPage == null) { signWordPage = new SignWordPage((SystemStatusCollection)this.DataContext); } ((SystemStatusCollection)this.DataContext).CurrentSignWord = ((SignWord)button.DataContext); UIElementCollection children = ((Panel)this.Parent).Children; if (!children.Contains(signWordPage)) { children.Add(signWordPage); } }
private void ControlSelectButton_Click(object sender, RoutedEventArgs e) { KinectTileButton b = sender as KinectTileButton; if (b.Name == "ControlSelectButton1") { controlManager.changeCurrentControlMode(0); settings.controlModeId = 0; settings.Save(); } else { controlManager.changeCurrentControlMode(1); settings.controlModeId = 1; settings.Save(); } }
private void BuildListItem(String path, String name) { MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.ScrubbingEnabled = true; Uri uri = new Uri(path); mediaPlayer.Open(uri); mediaPlayer.Pause(); mediaPlayer.Position = TimeSpan.FromSeconds(30); mediaPlayer.MediaOpened += new EventHandler(delegate(Object o, EventArgs e) { MediaPlayer mediaPlayer1 = o as MediaPlayer; DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); drawingContext.DrawVideo(mediaPlayer1, new Rect(0, 0, 160, 100)); drawingContext.Close(); double dpiX = 1 / 200; double dpiY = 1 / 200; RenderTargetBitmap bmp = new RenderTargetBitmap(160, 100, dpiX, dpiY, PixelFormats.Pbgra32); bmp.Render(drawingVisual); Image newImage = new Image(); newImage.Source = bmp; newImage.Stretch = Stretch.Uniform; newImage.Width = 200; newImage.Height = 120; KinectTileButton button = new KinectTileButton(); button.Label = name; button.Width = Double.NaN; button.Height = Double.NaN; button.FontSize = 18.0; button.Tag = path; button.Width = 200; button.Height = 120; button.Background = Brushes.Black; button.FontSize = 12.0; button.Content = newImage; button.Click += ScrollButtonClick; scrollContent.Children.Add(button); }); }
private bool EnviarPapelera(KinectTileButton target) { bool borrado = false; double x = (Canvas.GetLeft(target) + target.Width) / 2; double y = (Canvas.GetTop(target) + target.Height) / 2; if (x > Canvas.GetLeft(borrar) && x < Canvas.GetLeft(borrar) + borrar.Width && y > Canvas.GetTop(borrar) && y < Canvas.GetTop(borrar) + borrar.Height) { this.canvasKinect.Children.Remove(target); buttons.Remove(target); borrado = true; } return(borrado); }
private void borrarCopias(object sender, RoutedEventArgs e) { List <KinectTileButton> borrados = new List <KinectTileButton>(); KinectTileButton button = (KinectTileButton)sender; foreach (KinectTileButton target in buttons) { if (target.Uid == "elegido" && button.Name == target.Name) { borrados.Add(target); this.canvasKinect.Children.Remove(target); } } foreach (KinectTileButton target in borrados) { buttons.Remove(target); } }
//detect if hand is overlapping over any button private bool isHandOver(Point punto, List <KinectTileButton> buttonslist) { var handX = punto.X; var handY = punto.Y; foreach (KinectTileButton target in buttonslist) { System.Windows.Point targetTopLeft = new System.Windows.Point(Canvas.GetLeft(target), Canvas.GetTop(target)); if (handX > targetTopLeft.X && handX < targetTopLeft.X + target.Width && handY > targetTopLeft.Y && handY < targetTopLeft.Y + target.Height && target.IsVisible) { selected = target; return(true); } } return(false); }
private void InputSelectButton_Click(object sender, RoutedEventArgs e) { KinectTileButton b = sender as KinectTileButton; if (b.Name == "InputSelect1") { foreach (KinectTileButton button in FindVisualChildren <KinectTileButton>(MainWindow1)) { KinectRegion.SetIsHoverTarget(button, false); KinectRegion.SetIsPressTarget(button, true); } foreach (KinectCircleButton button in FindVisualChildren <KinectCircleButton>(MainWindow1)) { KinectRegion.SetIsHoverTarget(button, false); KinectRegion.SetIsPressTarget(button, true); } settings.selectionMode = "push"; settings.Save(); } else { foreach (KinectTileButton button in FindVisualChildren <KinectTileButton>(MainWindow1)) { KinectRegion.SetIsHoverTarget(button, true); KinectRegion.SetIsPressTarget(button, false); } foreach (KinectCircleButton button in FindVisualChildren <KinectCircleButton>(MainWindow1)) { KinectRegion.SetIsHoverTarget(button, true); KinectRegion.SetIsPressTarget(button, false); } settings.selectionMode = "hover"; settings.Save(); } }