/// <summary>
        /// Apply an update from the action to the treenode
        /// First apply to the GUI tree where the selection happend then copy it over to master tree
        /// </summary>
        /// <param name="action">The action that carries the update</param>
        public void UpdateAction(ActionCommandCls actionCmd)
        {
            //log.Debug( "UpdateNodeFromAction - Entry" );
            if (actionCmd == null)
            {
                return;
            }

            // input is either "" or a valid mapping or a blended mapping
            if (string.IsNullOrEmpty(actionCmd.Input))
            {
                // new unmapped
                this.Command = ""; this.BackColor = MyColors.UnassignedColor;
                if (this.Level == 2)
                {
                    this.Action = (this.Parent as ActionTreeNode).Action;
                }
            }
            // blended mapped ones - can only get a Blend Background
            else if (actionCmd.Input == DeviceCls.DisabledInput)
            {
                this.Command = actionCmd.DevInput; this.BackColor = MyColors.BlendedColor;
            }
            else
            {
                // mapped ( regular ones )
                this.Command = actionCmd.DevInput;
                // background is along the input
                this.BackColor = Act.DeviceColor(actionCmd.DevInput);
            }
            this.Modified = !actionCmd.DefaultActivationMode; // apply modifier visual
        }
Exemple #2
0
        /// <summary>
        /// Creates and adds the inputCommand list with given input string
        /// AC2 style input is used i.e. with device tag in front
        ///   apply given ActivationMode - can be "~" to indicate DONT APPLY
        /// </summary>
        /// <param name="devInput"></param>
        /// <returns>Returns the ActionCommand created</returns>
        public ActionCommandCls AddCommand(string devInput, ActivationMode activationMode)
        {
            ActionCommandCls acc = new ActionCommandCls(devInput, InputList.Count - 1); // starts from -1 ...

            acc.ActivationMode = new ActivationMode(activationMode);
            InputList.Add(acc);
            return(acc);
        }
Exemple #3
0
        }                                           // index of the vis treenode


        /// <summary>
        /// Clone this object
        /// </summary>
        /// <returns>A deep Clone of this object</returns>
        public object Clone( )
        {
            ActionCommandCls ac = (ActionCommandCls)this.MemberwiseClone();

            // more objects to deep copy
            ac.ActivationMode = ( ActivationMode )this.ActivationMode.Clone( );

            return(ac);
        }
Exemple #4
0
        /// <summary>
        /// Add an ActionCommand with Input at nodeindex
        ///   apply default ActivationMode
        /// </summary>
        /// <param name="devInput">The input to apply</param>
        /// <param name="index">The nodeindex</param>
        /// <returns>The created ActionCommand</returns>
        public ActionCommandCls AddCommand(string devInput, int index)
        {
            ActionCommandCls acc = new ActionCommandCls(devInput, index)
            {
                ActivationMode = new ActivationMode(ActivationMode.Default)
            };

            InputList.Add(acc);
            return(acc);
        }
Exemple #5
0
        /// <summary>
        /// Find an ActionCommand with index in an Action
        /// </summary>
        /// <param name="index">The input index to find</param>
        /// <returns>An actionCommand or null if not found</returns>
        public ActionCommandCls FindActionInputObject(int index)
        {
            log.Debug("FindActionInputObject - Entry");
            // Apply the input to the ActionTree
            ActionCommandCls acc = null;

            acc = this.InputList.Find(delegate(ActionCommandCls _ACC) { return(_ACC.NodeIndex == index); });
            if (acc == null)
            {
                log.Error("FindActionInputObject - Action Input not found in Action");
                return(null); // ERROR - Action Input not found in tree
            }
            return(acc);
        }
Exemple #6
0
        /// <summary>
        /// Copy return the action while reassigning the JsN Tag
        /// </summary>
        /// <param name="newJsList">The JsN reassign list</param>
        /// <returns>The action copy with reassigned input</returns>
        public ActionCommandCls ReassignJsN(JsReassingList newJsList)
        {
            ActionCommandCls newAc = (ActionCommandCls)this.Clone();

            // reassign the jsX part for Joystick commands
            if (this.DevID.StartsWith("js"))
            {
                int oldJsN = JoystickCls.JSNum(this.DevID);
                if (JoystickCls.IsJSValid(oldJsN))
                {
                    if (newJsList.ContainsOldJs(oldJsN))
                    {
                        newAc.DevID = JoystickCls.ReassignJSTag(this.DevID, newJsList.newJsFromOldJs(oldJsN));
                    }
                }
            }

            return(newAc);
        }