/// <summary> /// Handler for the event raised when the translucent /// glass is displayed /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void Glass_EvtShowGlass(object sender, EventArgs e) { if (!_syncLock.IsClosing() && Windows.GetVisible(ScannerForm)) { Windows.SetTopMost(ScannerForm); } }
/// <summary> /// Checks if we need to exit because the scanner is closing /// and throws an exception /// </summary> private void check() { if (_syncObj != null && _syncObj.IsClosing()) { Log.Debug("Scanner closed" + _rootWidget.UIControl.Name); throw new Exception(); } }
/// <summary> /// Check to see if a command should be enabled or not. /// This depends on the context. The arg parameter /// contains the widget/command object in question. /// </summary> /// <param name="arg">Argument</param> public void CheckCommandEnabled(CommandEnabledArg arg) { if (_syncLock.IsClosing()) { return; } arg.Handled = true; arg.Enabled = false; }
/// <summary> /// Transitions to the specified target animation. Stops the current /// animation and starts the new one. /// </summary> /// <param name="animation">Animation to transition to</param> public void Transition(Animation animation) { if (_syncObj == null) { Log.Debug("_syncObj is null. returning"); return; } try { _lastIteration = false; _timer.Stop(); Log.Debug("Transition to " + animation.Name); setPlayerState(PlayerState.Stopped); Log.Debug("Transition : Before Enter " + _rootWidget.UIControl.Name + ", threadid: " + Kernel32Interop.GetCurrentThreadId()); tryEnterUntilSuccess(_transitionSync); Log.Debug("Transition : After Enter " + _rootWidget.UIControl.Name + ", status: " + _syncObj.Status); if (_syncObj.IsClosing()) { Log.Debug("FORM IS CLOSING. releasing _transitionSync and returning" + _rootWidget.UIControl.Name); release(_transitionSync); return; } _rootWidget.HighlightOff(); if (_currentAnimation != null) { _currentAnimation.Stop(); } _currentAnimation = animation; _currentAnimation.ResolveUIWidgetsReferences(_rootWidget, _variables); _currentAnimation.OnEnterExecutionNotDone = true; _iterationCount = 0; _currentWidgetIndex = getFirstAnimatedWidget(); _highlightedWidget = null; Log.Debug("Transition : Before Release " + _rootWidget.UIControl.Name); release(_transitionSync); Log.Debug("Transition : After Release " + _rootWidget.UIControl.Name); Log.Debug("Start new animation " + animation.Name); if (!animation.AutoStart && animation.OnStart) { animation.OnStart = false; setPlayerState(PlayerState.Timeout); } else if (_timer != null) { _timer.Interval = _currentAnimation.SteppingTime; Log.Debug(_rootWidget.UIControl.Name + ", syncobj.status " + _syncObj.Status); if (_syncObj.Status == SyncLock.StatusValues.None) { timer_Elapsed(null, null); Log.Debug("Starting timer " + _rootWidget.UIControl.Name); _timer.Start(); } else { Log.Debug("******** WILL NOT START TIMER!!!" + _rootWidget.UIControl.Name + ", syncobj.status " + _syncObj.Status); } setPlayerState(PlayerState.Running); } } catch (Exception ex) { Log.Debug(ex.ToString()); } Log.Debug("Returning"); }