private void handleTimerActivation(object sender, ElapsedEventArgs e) { if (_activationTimer != null) { _activationTimer.Stop(); _activationTimer.Elapsed -= handleTimerActivation; _activationTimer.Close(); _activationTimer = null; } // Dispatch and signify control activation! Console.WriteLine("**** CONTROL ACTIVATION ******"); this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { if (cursorActivationUpdate != null) { customCursorEventArgs newCursorData = new customCursorEventArgs(currentHitControlReference, this.Margin); // I guess ScrollUpdate will be null if no one is listening cursorActivationUpdate(this, newCursorData); } })); }
/// <summary> /// This is an event that happens when a user holds a cursor over an activatable /// element for a certain amount of time. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void handleControlActivation(object sender, customCursorEventArgs e) { if (e.activationTarget is buttonTakePhoto) { if (sec_photo != null) { // DISABLE DETECTION OF PLAYERS FOR GOING BACK TO ATTRACT IN CASE PEOPLE ARE POSING AND // WE LOOSE ALL OF THEM _disableBackToAttract = true; sec_photo.initiatePhotoTake(); } } else if (e.activationTarget is buttonYes) { if (sec_photo != null) { sec_photo.confirmDenyPhoto(true); } if (sec_attract != null) { sec_attract.confimDenyPrompt(true); } // RE-ENABLE DETECTION OF PLAYERS FOR GOING BACK TO THE ATTRACT _disableBackToAttract = false; } else if (e.activationTarget is buttonNo) { if (sec_photo != null) { sec_photo.confirmDenyPhoto(false); } if (sec_attract != null) { sec_attract.confimDenyPrompt(false); } // RE-ENABLE DETECTION OF PLAYERS FOR GOING BACK TO THE ATTRACT _disableBackToAttract = false; } else if (e.activationTarget is buttonTPPrompt) { if (sec_attract != null) { sec_attract.jumpToPhotoBtnActivated(); } } else if (e.activationTarget is WrappedBGThumb) { if (sec_photo != null) { WrappedBGThumb tmpTarget = e.activationTarget as WrappedBGThumb; if(tmpTarget != null) { if (_primaryChromaImageList.Count > 0) { // In SectionPhoto we store the actual ref in the tag var tagObj = tmpTarget.GetValue(FrameworkElement.TagProperty); chromaKeyImageData targetImgData = tagObj as chromaKeyImageData; if (targetImgData != null) { sec_photo.swapBackground(targetImgData); sec_photo.toggleGreyscale(targetImgData.greyscale); } } else { bool _monochrome = false; string _bgBase = tmpTarget.Source.ToString(); string _fgBase = ""; int targetIndex = -1; targetIndex = _bgBase.IndexOf("BG1"); if (targetIndex != -1) { //_fgBase = "pack://application:,,,/Resources/BG1.png"; } targetIndex = _bgBase.IndexOf("BG2"); if (targetIndex != -1) { // _fgBase = "pack://application:,,,/Resources/BG2.png"; } targetIndex = _bgBase.IndexOf("BG3"); if (targetIndex != -1) { // _fgBase = "pack://application:,,,/Resources/BG3.png"; _monochrome = true; } // We need to seach specific photos that have a foreground too sec_photo.swapBackground(_bgBase, _fgBase); // Toggle monochrome if we need to // It may be more performant to adjust the saturation on the Kinect color camera here sec_photo.toggleGreyscale(_monochrome); } } } } }