/// <summary> /// update all the actions after an event occured /// </summary> /// <param name="e">the event that occured</param> public void updateAllActions(QlikMoveEventArgs e) { foreach (QlikMove.StandardHelper.ActionCore.Action a in this.actions) { a.UpdateAction(e); } }
/// <summary> /// Update the parameters of the action relying on an event that occured /// </summary> /// <param name="e">the event that occured</param> public void UpdateAction(QlikMoveEventArgs e) { //get the result ActionPartResult result = this.parts[this.currentActionPart].checkPart(e); if (result == ActionPartResult.SUCCESS) { if (this.currentActionPart + 1 < this.parts.Length) { //search for the next part this.currentActionPart++; //add the event to the list of triggering events this.triggeredEvents.Add(e); } else { //fire event or use method to send action if (this.ActionRecognised != null) { this.triggeredEvents.Add(e); this.ActionRecognised(this, new ActionArgs(this.name, e.timeStamp, this.triggeredEvents)); } //reset this.reset(); } } else if (result == ActionPartResult.FAIL) { //reset (or pause) this.reset(); } }
/// <summary> /// add and event to the stack /// </summary> /// <param name="e">the event that occured</param> public void AddEvent(QlikMoveEventArgs e) { if (this.qEvents == null) { this.qEvents = new Queue <QlikMoveEventArgs>(); } if (e != null) { this.qEvents.Enqueue(e); if (qEvents.Count == maxEventsNumber) { qEvents.Dequeue(); } this.updateAllActions(e); } }
/// <summary> /// launched when an event is fired from GestureHelper or VoiceHelper /// </summary> /// <param name="sender">the gesture/voice manager</param> /// <param name="e">the event detected</param> private void Event_EventRecognised(object sender, QlikMoveEventArgs e) { //send e to Action Recogniser queue ActionMgr.AddEvent(e); }