Example #1
0
        /// <summary>
        /// Creates and adds an animation widget entry that will contain the
        /// specified ui widget.  UI widget represents a windows control
        /// such as a button in the scanner.  Raises an event that the
        /// widget was added
        /// </summary>
        /// <param name="uiWidget">the ui widget</param>
        /// <returns>animation widget</returns>
        private AnimationWidget createAndAddAnimationWidget(Widget uiWidget)
        {
            var retVal = new AnimationWidget { UIWidget = uiWidget };
            AnimationWidgetList.Add(retVal);
            if (EvtAnimationWidgetAdded != null)
            {
                EvtAnimationWidgetAdded(this, new AnimationWidgetAddedEventArgs(retVal));
            }

            return retVal;
        }
 /// <summary>
 /// Initializaes the object
 /// </summary>
 /// <param name="widget">the animation widget</param>
 public AnimationWidgetAddedEventArgs(AnimationWidget widget)
 {
     AnimWidget = widget;
 }
Example #3
0
        /// <summary>
        /// This function is the heart beat of ACAT.  All animations are handled in this
        /// event.  It unhighlights the currenlty highlighted animation widget and
        /// highlights the next one in the sequence.  If it has reached the end of the
        /// sequence, it wraps around and repeats the animation until the number of
        /// iterations has reached.
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (_syncObj.Status == SyncLock.StatusValues.Closing ||
                _syncObj.Status == SyncLock.StatusValues.Closed)
            {
                Log.Debug("Form is closing. Returning" + _rootWidget.UIControl.Name);
                return;
            }

            if (_inTimer)
            {
                Log.Debug("Timer is busy. returning");
                return;
            }

            _inTimer = true;

            try
            {
                Log.Debug("Before tryEnter " + _rootWidget.UIControl.Name + ", threadid: " + GetCurrentThreadId());

                if (!tryEnter(_transitionSync))
                {
                    Log.Debug("_transition sync will block returning");
                    return;
                }

                Log.Debug("After tryEnter" + _rootWidget.UIControl.Name + ", status: " + _syncObj.Status);
                if (_syncObj.Status == SyncLock.StatusValues.Closing ||
                    _syncObj.Status == SyncLock.StatusValues.Closed)
                {
                    Log.Debug("Form is closing. Returning" + _rootWidget.UIControl.Name);
                    return;
                }

                check();

                Log.Debug("CurrentAnimation: " + _currentAnimation.Name +
                          ". Count: " + _currentAnimation.AnimationWidgetList.Count +
                          ". currentWidgetIndex: " + _currentWidgetIndex);

                if (animatedWidgetCount() == 0)
                {
                    Log.Debug("No widgets to animate.");
                    _interpreter.Execute(_currentAnimation.OnEnd);
                    return;
                }

                check();

                var animationWidget = _currentAnimation.AnimationWidgetList[_currentWidgetIndex];

                Log.Debug(_rootWidget.UIControl.Name + ", status: " + _syncObj.Status);

                // if any switch is currently engaged, keep the current widget
                // highlighted until the user releases the switch
                //if (ActuatorManager.Instance.IsSwitchActive())
                if (IsSwitchActive)
                {
                    Log.Debug("Some switch is active. Will try again");
                    return;
                }

                // if there is code associated with an onEnter, execute that
                if (_currentAnimation.OnEnterExecutionNotDone && _currentAnimation.OnEnter != null)
                {
                    _interpreter.Execute(_currentAnimation.OnEnter);
                    _currentAnimation.OnEnterExecutionNotDone = false;
                }

                check();

                Log.Debug(_rootWidget.UIControl.Name + ", status: " + _syncObj.Status);

                // we have reached the end of the iteration. Turn off
                // the widget that was last highlighed and stop the
                // animation sequence
                if (_lastIteration)
                {
                    _lastIteration = false;

                    Widget selectedWidget = (_highlightedWidget != null &&
                                             _highlightedWidget.UIWidget != null) ? _highlightedWidget.UIWidget.Parent : null;

                    _rootWidget.HighlightOff();
                    if (animationWidget.OnHighlightOff.HasCode())
                    {
                        _interpreter.Execute(animationWidget.OnHighlightOff);
                    }

                    if (_currentAnimation.IsFirst)
                    {
                        setPlayerState(PlayerState.Timeout);
                    }

                    if (_timer != null)
                    {
                        _timer.Stop();
                    }
                    else
                    {
                        Log.Debug("Timer is null. returning");
                        return;
                    }

                    check();

                    AuditLog.Audit(new AuditEventAnimationEnd(
                                       _rootWidget.Name,
                                       (selectedWidget != null) ? selectedWidget.Name : string.Empty,
                                       (selectedWidget != null) ? selectedWidget.GetType().Name : string.Empty,
                                       _currentAnimation.Name));

                    // is there an onEnd code that we have to execute
                    _interpreter.Execute(_currentAnimation.OnEnd);

                    return;
                }

                check();

                if (_highlightedWidget != null && _highlightedWidget != animationWidget)
                {
                    Log.Debug(string.Format("Animation: {0}. Turning off . name = {1}. Count: {2}",
                                            _currentAnimation.Name,
                                            _highlightedWidget.UIWidget.Name,
                                            _currentAnimation.AnimationWidgetList.Count));

                    check();

                    _highlightedWidget.UIWidget.HighlightOff();

                    check();

                    if (_highlightedWidget.OnHighlightOff.HasCode())
                    {
                        _interpreter.Execute(_highlightedWidget.OnHighlightOff);
                    }
                }

                check();

                // now turn the highlight on on the next widget in the  sequence
                animationWidget = _currentAnimation.AnimationWidgetList[_currentWidgetIndex];

                Log.Debug("Animation: " + _currentAnimation.Name +
                          ". Turning on " + _currentWidgetIndex +
                          ". name = " + animationWidget.UIWidget.Name);

                check();

                animationWidget.UIWidget.HighlightOn();

                _highlightedWidget = animationWidget;

                // calculate how long to wait before triggering the
                // next timer event.  (this is how long the highlighted
                // widget will stay highlighted)

                int hesitateTime = animationWidget.HesitateTime;

                check();

                if (hesitateTime == 0 && isFirstAnimatedWidget(_currentWidgetIndex))
                {
                    hesitateTime = _currentAnimation.HesitateTime;
                }

                if (_timer != null)
                {
                    _timer.Interval = _currentAnimation.SteppingTime + hesitateTime;
                }
                else
                {
                    Log.Debug("timer is null. returning");
                    return;
                }

                check();

                if (animationWidget.OnHighlightOn.HasCode())
                {
                    _interpreter.Execute(animationWidget.OnHighlightOn);
                }

                check();

                int nextIndex = getNextAnimatedWidget(_currentWidgetIndex);

                // if we have reached the end of the animation sequence, wrap around
                if (nextIndex < 0)
                {
                    _iterationCount++;
                    int iterations = CoreGlobals.AppPreferences.ResolveVariableInt(_currentAnimation.Iterations, 1, 1);
                    if (iterations >= 0 && _iterationCount >= iterations)
                    {
                        _lastIteration = true;
                        return;
                    }

                    _currentWidgetIndex = getFirstAnimatedWidget();
                }
                else
                {
                    _currentWidgetIndex = nextIndex;
                }
            }
            catch (Exception ex)
            {
                Log.Debug("AnimationPlayerexception " + ex);
            }
            finally
            {
                Log.Debug("Before release " + _rootWidget.UIControl.Name);
                release(_transitionSync);
                Log.Debug("After release " + _rootWidget.UIControl.Name);

                Log.Debug("Setting intimer to false " + _rootWidget.UIControl.Name);
                _inTimer = false;

                Log.Debug("Exiting timer " + _rootWidget.UIControl.Name);
            }
        }
 /// <summary>
 /// Initializaes the object
 /// </summary>
 /// <param name="widget">the animation widget</param>
 public AnimationWidgetAddedEventArgs(AnimationWidget widget)
 {
     AnimWidget = widget;
 }
Example #5
0
        /// <summary>
        /// Event handler for when an actuator switch is down
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void actuatorManager_EvtSwitchDown(object sender, ActuatorSwitchEventArgs e)
        {
            setSwitchState(true);

            if (_player != null)
            {
                _switchDownAnimation = _player.CurrentAnimation;
                var widget = _player.HighlightedWidget;
                if (widget != null)
                {
                    Log.Debug("Highlighted widget: " + widget.UIWidget.Name);
                    _switchDownHighlightedWidget = widget;
                }
                else
                {
                    _switchDownHighlightedWidget = null;
                }
            }
        }
Example #6
0
        /// <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: " + GetCurrentThreadId());
                enter(_transitionSync);
                Log.Debug("Transition : After Enter " + _rootWidget.UIControl.Name + ", status:  " + _syncObj.Status);

                if (_syncObj.Status == SyncLock.StatusValues.Closing || _syncObj.Status == SyncLock.StatusValues.Closed)
                {
                    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");
        }
 /// <summary>
 /// Initializes the object
 /// </summary>
 /// <param name="animationWidget">animation widget</param>
 /// <param name="onMouseClick">the code for handling the click</param>
 public AnimationMouseClickEventArgs(AnimationWidget animationWidget, PCode onMouseClick)
 {
     AnimationWidget = animationWidget;
     OnMouseClick = onMouseClick;
 }
Example #8
0
 /// <summary>
 /// Sets all the variables related to switch events
 /// </summary>
 private void resetSwitchEventStates()
 {
     _switchDownHighlightedWidget = null;
     _switchAcceptedHighlightedWidget = null;
     _switchDownAnimation = null;
     _switchAcceptedAnimation = null;
 }
 /// <summary>
 /// Initializes the object
 /// </summary>
 /// <param name="animationWidget">animation widget</param>
 /// <param name="onMouseClick">the code for handling the click</param>
 public AnimationMouseClickEventArgs(AnimationWidget animationWidget, PCode onMouseClick)
 {
     AnimationWidget = animationWidget;
     OnMouseClick    = onMouseClick;
 }
Example #10
0
        /// <summary>
        /// A switch was activated. Figure out the context and execute the
        /// appropriate action. The input manager triggers this event.  Evey
        /// switch has an action that is configured in the swtichconfigmap file.
        /// The action is executed depending on the state of the animation player.
        /// TODO:  If there are hot keys we need to handle for multimodal
        /// gesture, this is probablty where we would want to handle it
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void actuatorManager_EvtSwitchActivated(object sender, ActuatorSwitchEventArgs e)
        {
            IActuatorSwitch switchObj = e.SwitchObj;

            try
            {
                if (_player == null || _currentScreen == null)
                {
                    return;
                }

                Log.Debug("switch: " + switchObj.Name);
                Log.Debug("   Screen: " + _currentScreen.Name);

                if (_currentScreen.UIControl is System.Windows.Forms.Form)
                {
                    bool visible = Windows.GetVisible(_currentScreen.UIControl);
                    Log.Debug("Form: " + _currentScreen.UIControl.Name + ", playerState: " + _player.State + ", visible: " + visible);
                    if (!visible)
                    {
                        return;
                    }
                }

                // get the action associated with the switch
                PCode onTrigger = getOnTrigger(switchObj);
                if (onTrigger == null)
                {
                    Log.Debug("OnTrigger is null. returning");
                    return;
                }

                Log.Debug("onTrigger.HasCOde: " + onTrigger.HasCode());

                // execute action if the player is in the right state.
                if (_player.State != PlayerState.Stopped &&
                    _player.State != PlayerState.Unknown &&
                    _player.State != PlayerState.Paused &&
                    onTrigger.HasCode())
                {
                    Log.Debug("Executing OnTrigger for screen..." + _currentScreen.Name);
                    _interpreter.Execute(onTrigger);
                    return;
                }

                if (_player.State == PlayerState.Timeout || _player.State == PlayerState.Interrupted)
                {
                    Log.Debug("Calling player transition for firstanimation");
                    _player.Transition(_firstAnimation);
                    return;
                }

                Log.Debug("PLayer state is " + _player.State);
                if (_player.State != PlayerState.Running)
                {
                    Log.Debug(_currentScreen.Name + ": Player is not Running. Returning");
                    return;
                }

                playBeep(switchObj);

                AnimationWidget highlightedWidget = _player.HighlightedWidget;
                Animation       currentAnimation  = _player.CurrentAnimation;

                if (currentAnimation != null && highlightedWidget != null)
                {
                    var widgetName = (highlightedWidget.UIWidget is IButtonWidget) ?
                                     "Button" :
                                     highlightedWidget.UIWidget.Name;

                    AuditLog.Audit(new AuditEventUISwitchDetect(switchObj.Name,
                                                                _currentScreen.Name,
                                                                highlightedWidget.UIWidget.GetType().Name,
                                                                widgetName));

                    Log.Debug(_currentScreen.Name + ": Switch on " +
                              highlightedWidget.UIWidget.Name + " type: " +
                              highlightedWidget.UIWidget.GetType().Name);

                    // check if the widget has a onSelect code fragment. If so execute it.  Otherwise
                    // then check if the animation seq that this widget is a part of, has a onSelect.
                    // If it does, execute that.

                    PCode code;
                    SetSelectedWidget(highlightedWidget.UIWidget);
                    if (highlightedWidget.OnSelect.HasCode())
                    {
                        code = highlightedWidget.OnSelect;
                        _interpreter.Execute(code);
                    }
                    else if (currentAnimation.OnSelect.HasCode())
                    {
                        code = currentAnimation.OnSelect;
                        _interpreter.Execute(code);
                    }
                }
                else
                {
                    Log.Debug(_currentScreen.Name + ":No current animation or highlighed widget!!");
                }
            }
            catch (Exception ex)
            {
                Log.Debug(ex.ToString());
            }
        }
Example #11
0
        /// <summary>
        /// This function is the heart beat of ACAT.  All animations are handled in this
        /// event.  It unhighlights the currenlty highlighted animation widget and
        /// highlights the next one in the sequence.  If it has reached the end of the
        /// sequence, it wraps around and repeats the animation until the number of
        /// iterations has reached.
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (_syncObj.Status == SyncLock.StatusValues.Closing ||
                _syncObj.Status == SyncLock.StatusValues.Closed)
            {
                Log.Debug("Form is closing. Returning" + _rootWidget.UIControl.Name);
                return;
            }

            if (_inTimer)
            {
                Log.Debug("Timer is busy. returning");
                return;
            }

            _inTimer = true;

            try
            {
                Log.Debug("Before tryEnter " + _rootWidget.UIControl.Name + ", threadid: " + GetCurrentThreadId());

                if (!tryEnter(_transitionSync))
                {
                    Log.Debug("_transition sync will block returning");
                    return;
                }

                Log.Debug("After tryEnter" + _rootWidget.UIControl.Name + ", status: " + _syncObj.Status);
                if (_syncObj.Status == SyncLock.StatusValues.Closing ||
                    _syncObj.Status == SyncLock.StatusValues.Closed)
                {
                    Log.Debug("Form is closing. Returning" + _rootWidget.UIControl.Name);
                    return;
                }

                check();

                Log.Debug("CurrentAnimation: " + _currentAnimation.Name +
                            ". Count: " + _currentAnimation.AnimationWidgetList.Count +
                            ". currentWidgetIndex: " + _currentWidgetIndex);

                if (animatedWidgetCount() == 0)
                {
                    Log.Debug("No widgets to animate.");
                    _interpreter.Execute(_currentAnimation.OnEnd);
                    return;
                }

                check();

                var animationWidget = _currentAnimation.AnimationWidgetList[_currentWidgetIndex];

                Log.Debug(_rootWidget.UIControl.Name + ", status: " + _syncObj.Status);

                // if any switch is currently engaged, keep the current widget
                // highlighted until the user releases the switch
                //if (ActuatorManager.Instance.IsSwitchActive())
                if (IsSwitchActive)
                {
                    Log.Debug("Some switch is active. Will try again");
                    return;
                }

                // if there is code associated with an onEnter, execute that
                if (_currentAnimation.OnEnterExecutionNotDone && _currentAnimation.OnEnter != null)
                {
                    _interpreter.Execute(_currentAnimation.OnEnter);
                    _currentAnimation.OnEnterExecutionNotDone = false;
                }

                check();

                Log.Debug(_rootWidget.UIControl.Name + ", status: " + _syncObj.Status);

                // we have reached the end of the iteration. Turn off
                // the widget that was last highlighed and stop the
                // animation sequence
                if (_lastIteration)
                {
                    _lastIteration = false;

                    Widget selectedWidget = (_highlightedWidget != null &&
                                                _highlightedWidget.UIWidget != null) ? _highlightedWidget.UIWidget.Parent : null;

                    _rootWidget.HighlightOff();
                    if (animationWidget.OnHighlightOff.HasCode())
                    {
                        _interpreter.Execute(animationWidget.OnHighlightOff);
                    }

                    if (_currentAnimation.IsFirst)
                    {
                        setPlayerState(PlayerState.Timeout);
                    }

                    if (_timer != null)
                    {
                        _timer.Stop();
                    }
                    else
                    {
                        Log.Debug("Timer is null. returning");
                        return;
                    }

                    check();

                    AuditLog.Audit(new AuditEventAnimationEnd(
                                        _rootWidget.Name,
                                        (selectedWidget != null) ? selectedWidget.Name : string.Empty,
                                        (selectedWidget != null) ? selectedWidget.GetType().Name : string.Empty,
                                        _currentAnimation.Name));

                    // is there an onEnd code that we have to execute
                    _interpreter.Execute(_currentAnimation.OnEnd);

                    return;
                }

                check();

                if (_highlightedWidget != null && _highlightedWidget != animationWidget)
                {
                    Log.Debug(string.Format("Animation: {0}. Turning off . name = {1}. Count: {2}",
                                _currentAnimation.Name,
                                _highlightedWidget.UIWidget.Name,
                                _currentAnimation.AnimationWidgetList.Count));

                    check();

                    _highlightedWidget.UIWidget.HighlightOff();

                    check();

                    if (_highlightedWidget.OnHighlightOff.HasCode())
                    {
                        _interpreter.Execute(_highlightedWidget.OnHighlightOff);
                    }
                }

                check();

                // now turn the highlight on on the next widget in the  sequence
                animationWidget = _currentAnimation.AnimationWidgetList[_currentWidgetIndex];

                Log.Debug("Animation: " + _currentAnimation.Name +
                            ". Turning on " + _currentWidgetIndex +
                            ". name = " + animationWidget.UIWidget.Name);

                check();

                animationWidget.UIWidget.HighlightOn();

                _highlightedWidget = animationWidget;

                // calculate how long to wait before triggering the
                // next timer event.  (this is how long the highlighted
                // widget will stay highlighted)

                int hesitateTime = animationWidget.HesitateTime;

                check();

                if (hesitateTime == 0 && isFirstAnimatedWidget(_currentWidgetIndex))
                {
                    hesitateTime = _currentAnimation.HesitateTime;
                }

                if (_timer != null)
                {
                    _timer.Interval = _currentAnimation.SteppingTime + hesitateTime;
                }
                else
                {
                    Log.Debug("timer is null. returning");
                    return;
                }

                check();

                if (animationWidget.OnHighlightOn.HasCode())
                {
                    _interpreter.Execute(animationWidget.OnHighlightOn);
                }

                check();

                int nextIndex = getNextAnimatedWidget(_currentWidgetIndex);

                // if we have reached the end of the animation sequence, wrap around
                if (nextIndex < 0)
                {
                    _iterationCount++;
                    int iterations = CoreGlobals.AppPreferences.ResolveVariableInt(_currentAnimation.Iterations, 1, 1);
                    if (iterations >= 0 && _iterationCount >= iterations)
                    {
                        _lastIteration = true;
                        return;
                    }

                    _currentWidgetIndex = getFirstAnimatedWidget();
                }
                else
                {
                    _currentWidgetIndex = nextIndex;
                }
            }
            catch (Exception ex)
            {
                Log.Debug("AnimationPlayerexception " + ex);
            }
            finally
            {
                Log.Debug("Before release " + _rootWidget.UIControl.Name);
                release(_transitionSync);
                Log.Debug("After release " + _rootWidget.UIControl.Name);

                Log.Debug("Setting intimer to false " + _rootWidget.UIControl.Name);
                _inTimer = false;

                Log.Debug("Exiting timer " + _rootWidget.UIControl.Name);
            }
        }
Example #12
0
        /// <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: " + GetCurrentThreadId());
                enter(_transitionSync);
                Log.Debug("Transition : After Enter " + _rootWidget.UIControl.Name + ", status:  " + _syncObj.Status);

                if (_syncObj.Status == SyncLock.StatusValues.Closing || _syncObj.Status == SyncLock.StatusValues.Closed)
                {
                    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");
        }
Example #13
0
        /// <summary>
        /// Initializes the player
        /// </summary>
        /// <param name="rootWidget">root widget for the scanner</param>
        /// <param name="interpreter">the interpreter object</param>
        /// <param name="variables">variables and their values</param>
        public AnimationPlayer(Widget rootWidget, Interpret interpreter, Variables variables)
        {
            Log.Debug("CTOR(" + rootWidget.Name + ")");
            if (rootWidget.UIControl is IPanel)
            {
                _syncObj = ((IPanel) rootWidget.UIControl).SyncObj;
            }

            _transitionSync = _syncObj;

            _interpreter = interpreter;
            _timer = new System.Timers.Timer();
            _timer.Elapsed += timer_Elapsed;
            _highlightedWidget = null;
            _currentAnimation = null;
            _rootWidget = rootWidget;
            _playerState = PlayerState.Stopped;
            _variables = variables;
            _inTimer = false;
            IsSwitchActive = false;
        }