Esempio n. 1
0
 public static string getMenuEntryString(ActionName action)
 {
     if (action == ActionName.SubmenuExtinguishing) {
         return "Extinguish";
     } else if (action == ActionName.SubmenuDriving) {
         return "Drive";
     } else if (action == ActionName.Move) {
         return "Move";
     } else if (action == ActionName.ExtinguishToSmoke) {
         return "To smoke";
     } else if (action == ActionName.ExtinguishAll) {
         return "Extinguish All";
     } else if (action == ActionName.IdentifyPOI) {
         return "Identify POI";
     } else if (action == ActionName.PickPOI) {
         return "PickPOI";
     } else if (action == ActionName.PutPOI) {
         return "Put POI";
     } else if (action == ActionName.PickHazard) {
         return "Pick hazard";
     } else if (action == ActionName.PutHazard) {
         return "Put hazard";
     } else if (action == ActionName.DamageWall) {
         return "Damage wall";
     } else if (action == ActionName.OpenDoors) {
         return "Open doors";
     } else if (action == ActionName.CloseDoors) {
         return "Close doors";
     } else if (action == ActionName.DriveAsPassenger) {
         return "As passenger";
     } else if (action == ActionName.DriveAsDriver) {
         return "As driver";
     } else if (action == ActionName.UseWaterCannon) {
         return "Use water cannon";
     } else {
         return "You can't see this";
     }
 }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();

            if (MediaType != null)
            {
                hashCode ^= MediaType.GetHashCode();
            }
            if (SampleDirection != null)
            {
                hashCode ^= SampleDirection.GetHashCode();
            }
            if (ParameterType != null)
            {
                hashCode ^= ParameterType.GetHashCode();
            }
            foreach (string parameterName in ParameterNames)
            {
                hashCode ^= parameterName.ToUpperInvariant().GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 3
0
 public Action(ActionName entry, int cost, System.Action action)
 {
     this.entry = entry;
     this.Cost = cost;
     this.action = action;
 }
Esempio n. 4
0
 /// <summary>
 /// default constructor
 /// </summary>
 /// <param name="name"></param>
 /// <param name="time"></param>
 /// <param name="events"></param>
 public ActionArgs(ActionName name, DateTime time, List<QlikMoveEventArgs> events)
 {
     this.name = name;
     this.TimeStamp = time;
     this.events = events;
 }
 public override bool ShouldViewApply(CommercePipelineExecutionContext context, EntityView entityView,
                                      TEntity entity)
 {
     return(ActionName.Equals(entityView.Action, StringComparison.OrdinalIgnoreCase));
 }
Esempio n. 6
0
        public HtmlString RenderSubMenuItem(string functionName, string text, string actionName, string controllerName = null, object routeValues = null, object htmlAtts = null)
        {
            string format = @"<li><a href=""{URL}"" {ATTR}>{TEXT}</a></li>";


            if (ControllerName.Equals(controllerName, StringComparison.InvariantCultureIgnoreCase) && ActionName.Equals(actionName, StringComparison.InvariantCultureIgnoreCase))
            {
                return(RenderItemFormat(functionName, format, text, actionName, controllerName, routeValues, htmlAtts, "active"));
            }

            return(RenderItemFormat(functionName, format, text, actionName, controllerName, routeValues, htmlAtts));
        }
Esempio n. 7
0
 /// <summary>
 /// action constructor
 /// </summary>
 /// <param name="name">the name of the action</param>
 /// <param name="parts">an array of the action parts</param>
 public Action(ActionName name, ActionPart[] parts)
 {
     this.name = name;
     this.parts = parts;
     this.triggeredEvents = new List<QlikMoveEventArgs>();
 }
 public override int GetHashCode()
 {
     return(ActionName.TextOrEmpty().GetHashCode() ^ ControllerName.TextOrEmpty().GetHashCode() ^ AreaName.TextOrEmpty().GetHashCode());
 }
Esempio n. 9
0
        /// <summary>
        /// consume an ActionArgs send from ActionRecogniser
        /// </summary>
        /// <param name="sender">the action manager</param>
        /// <param name="a">the action detected</param>
        private void Event_ActionRecognised(object sender, ActionArgs a)
        {
            ActionName previousActionName = ActionName.NULL;
            String     activeWindow       = NativeMethods.GetActiveWindow();

            if (previousActionsQueue.Count > 1)
            {
                previousActionName = previousActionsQueue.ToArray()[previousActionsQueue.Count - 1];
            }

            if (!
                (previousActionsQueue.Count >= 1 && previousActionName == ActionName.IDLE && a.name == ActionName.IDLE ||
                 (previousActionsQueue.Count > 1 && previousActionName == ActionName.MOUSE_PRESS && a.name == ActionName.MOUSE_PRESS) ||
                 (previousActionsQueue.Count > 1 && previousActionName != ActionName.MOUSE_PRESS && a.name == ActionName.MOUSE_RELEASE) ||
                 (previousActionsQueue.Count >= 1 && previousActionName == ActionName.MENU && a.name == ActionName.MENU)) &&
                !Helper.disabledActions.Contains(a.name)
                )
            {
                LogHelper.logInput("Action Recognised : \r\n" + a.ToString(), LogHelper.logType.INFO, this);

                if (previousActiveWindow == null || !previousActiveWindow.Equals(activeWindow))
                {
                    LogHelper.logInput("Current window : " + activeWindow, LogHelper.logType.INFO, this);
                    previousActiveWindow = activeWindow;
                }

                previousActionsQueue.Enqueue(a.name);
                if (previousActionsQueue.Count == maxActionsNumber)
                {
                    previousActionsQueue.Dequeue();
                }



                if (!String.IsNullOrEmpty(activeWindow) && activeWindow.ToLower().Contains("firefox") && !ServerHelper.isKeyboardLaunched)
                {
                    ServerHelper.Send(new Message(a));
                }
                else
                {
                    switch (a.name)
                    {
                    case ActionName.OPEN:
                        MouseSimulator.LeftButtonClick();
                        MouseSimulator.LeftButtonClick();
                        break;

                    case ActionName.NEXT_SELECTION:
                    case ActionName.NEXT_TAB:
                        KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.RIGHT);
                        break;

                    case ActionName.PREVIOUS_SELECTION:
                    case ActionName.PREVIOUS_TAB:
                        KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.LEFT);
                        break;

                    case ActionName.REDO:
                        KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                        KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.VK_Y);
                        KeyboardSimulator.KeyUp(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                        break;

                    case ActionName.UNDO:
                        KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                        KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.VK_Z);
                        KeyboardSimulator.KeyUp(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                        break;

                    default:
                        break;
                    }
                }



                //NOT DEPENDING ON THE ACTIVE WINDOW
                switch (a.name)
                {
                case ActionName.CLOSE:
                    //if the virtual keyboard is up, kill it
                    if (ServerHelper.isKeyboardLaunched)
                    {
                        ServerHelper.keyboardProcess.Kill();
                        ServerHelper.keyboardProcess    = null;
                        ServerHelper.isKeyboardLaunched = false;

                        Helper.RemoveDisabledActions(new List <ActionName>()
                        {
                            ActionName.NEXT_TAB, ActionName.PREVIOUS_TAB
                        });
                    }
                    else
                    {
                        KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LMENU);
                        KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.F4);
                        KeyboardSimulator.KeyUp(StandardHelper.Inputcore.WordsVirtualKey.LMENU);
                    }
                    break;

                case ActionName.SIMPLE_SELECTION:
                    MouseSimulator.LeftButtonClick();
                    break;

                case ActionName.MENU:
                    KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LWIN);
                    KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                    KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.TAB);
                    KeyboardSimulator.NokeyDown();
                    break;

                case ActionName.MOUSE_PRESS:
                    if (!ServerHelper.isKeyboardLaunched)
                    {
                        clickTimer = new Timer(Click, null, 800, System.Threading.Timeout.Infinite);
                    }
                    break;

                case ActionName.MOUSE_RELEASE:
                    if (isPressing == false)
                    {
                        MouseSimulator.LeftButtonClick();
                        ServerHelper.Send(new Message(new ActionArgs(ActionName.SIMPLE_SELECTION, Helper.GetTimeStamp(), a.events)));
                    }
                    else if (isPressing == true)
                    {
                        MouseSimulator.LeftButtonUp();
                        isPressing = false;
                    }
                    if (clickTimer != null)
                    {
                        clickTimer.Dispose();
                    }
                    break;

                case ActionName.MULTIPLE_SELECTION:
                    if (KeyboardSimulator.keyDownList != null && !KeyboardSimulator.keyDownList.Contains(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL))
                    {
                        KeyboardSimulator.KeyDown(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                    }
                    else
                    {
                        KeyboardSimulator.KeyUp(StandardHelper.Inputcore.WordsVirtualKey.LCONTROL);
                    }
                    break;

                case ActionName.SCROLL_DOWN:
                    MouseSimulator.VerticalMouseWheel(-5);
                    break;

                case ActionName.SCROLL_UP:
                    MouseSimulator.VerticalMouseWheel(5);
                    break;

                case ActionName.EXIT:
                    //reset Kinect
                    if (KinectHelper.Instance.elevationAngle != 0)
                    {
                        KinectHelper.Instance.elevationAngle = 0;
                    }
                    //reset KeyBoard & Mouse
                    InputControler.KeyboardSimulator.NokeyDown();
                    //kill the osk process if it exists
                    if (ServerHelper.keyboardProcess != null)
                    {
                        ServerHelper.keyboardProcess.Kill();
                    }
                    //Exit
                    Environment.Exit(0);
                    break;

                case ActionName.IDLE:
                    //what to do depending on the previous action
                    if (previousActionsQueue.Count != 0)
                    {
                        switch (previousActionsQueue.Peek())
                        {
                        case ActionName.PREVIOUS_SELECTION:
                        case ActionName.NEXT_SELECTION:
                        case ActionName.MENU:
                            InputControler.KeyboardSimulator.KeyHit(StandardHelper.Inputcore.WordsVirtualKey.EXECUTE);
                            break;

                        default:
                            break;
                        }
                    }
                    //release all entries
                    InputControler.KeyboardSimulator.NokeyDown();
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 10
0
 public override int GetHashCode()
 {
     return(ActionName.GetHashCode());
 }
Esempio n. 11
0
 public SubMenu(ActionName entry, List<ActionMenu> menuEntries)
 {
     this.entry = entry;
     this.menuEntries = menuEntries;
 }
Esempio n. 12
0
 /// <summary>
 /// action constructor
 /// </summary>
 /// <param name="name">the name of the action</param>
 /// <param name="parts">an array of the action parts</param>
 public Action(ActionName name, ActionPart[] parts)
 {
     this.name            = name;
     this.parts           = parts;
     this.triggeredEvents = new List <QlikMoveEventArgs>();
 }