Example #1
0
    void SetControlType()
    {
        ControlType controlType = this.controlType;

        switch(this.touchType)
        {
            case TouchType.Click:
                controlType = ControlType.Jump;
                this.controlEventTime = 0;
                break;
            case TouchType.SweepLeft:
                controlType = ControlType.TurnLeft;
                this.controlEventTime = 0;
                break;
            case TouchType.SweepRight:
                controlType = ControlType.TurnRight;
                this.controlEventTime = 0;
                break;
            default:
                if (this.controlEventTime > this.controlEventDelay)
                {
                    controlType = ControlType.None;
                }
                this.controlEventTime += Time.deltaTime;
                break;
        }

        this.controlType = controlType;
    }
Example #2
0
 protected void RaiseEvent(List<Frame> frames, Vector3 calculateDisplacementVector, long duration, ControlType controlType)
 {
     if(MovementDetected != null)
     {
         MovementDetected(this, new MovementEventArgs(calculateDisplacementVector, duration, TJointType.HandLeft, controlType));
     }
 }
Example #3
0
 public void cleanUpOnExit()
 {
     controlType = ControlType.None;
     camera.enabled = false;
     AudioListener aL = gameObject.GetComponent<AudioListener>();
     aL.enabled = false;
 }
Example #4
0
 public MovementEventArgs(Vector3 displacement, long duration, TJointType jointType, ControlType controlType)
 {
     Displacement = displacement;
     Duration = duration;
     JointType = jointType;
     ControlType = controlType;
 }
        public static Dictionary<string, string> ReadLocalizationConfig(ControlType controlType)
        {
            string configPath = string.Format(configPathFormat, controlType.ToString(), RunTimeLocaliationTypeString);

            Dictionary<string, string> dicNameValue = new Dictionary<string, string>();

            if (File.Exists(configPath))
            {
                XmlDocument xd = new XmlDocument();
                xd.Load(configPath);

                XmlNodeList xnDataList = xd.SelectNodes("configuration/root/data");

                foreach (XmlNode xn in xnDataList)
                {
                    if (!dicNameValue.Keys.Contains(xn.Attributes["name"].Value))
                    {
                        dicNameValue.Add(xn.Attributes["name"].Value,xn.Attributes["value"].Value);
                    }
                }
            }

           
            return dicNameValue;
        }
Example #6
0
        public void Decode(byte[] bytes)
        {
            using (var ms = new MemoryStream(bytes))
            {
                Type = (ControlType) dc.GetInt16(ms.ReadBytes(2), 0);

                switch (Type)
                {
                    case ControlType.STREAM_BEGIN:
                    case ControlType.STREAM_EOF:
                    case ControlType.STREAM_DRY:
                    case ControlType.STREAM_IS_RECORDED:
                        StreamID = dc.GetInt32(ms.ReadBytes(4), 0);
                        break;
                    case ControlType.SET_BUFFER:
                        StreamID = dc.GetInt32(ms.ReadBytes(4), 0);
                        BufferLength = dc.GetInt32(ms.ReadBytes(4), 0);
                        break;
                    case ControlType.PING_REQUEST:
                    case ControlType.PING_RESPONSE:
                        Time = dc.GetInt32(ms.ReadBytes(4), 0);
                        break;
                    case ControlType.SWFV_REQUEST:
                        break;
                    case ControlType.SWFV_RESPONSE:
                        Bytes = ms.ReadBytes(42);
                        break;
                    case ControlType.BUFFER_FULL:
                    case ControlType.BUFFER_EMPTY:
                        StreamID = dc.GetInt32(ms.ReadBytes(4), 0);
                        break;
                }
            }
        }
 public FormItemContext(object bindedData, Type datatype, PropertyInfo propinfo, ControlType ctype)
 {
     BindedData = bindedData;
     DataType = datatype;
     PropertyInfo = propinfo;
     ControlType = ctype;
 }
Example #8
0
 public static void SetController(ControlType controllerToUse)
 {
     Controller = controllerToUse;
     if (Controller == ControlType.PS) offset = 0;
     if (Controller == ControlType.Xbox) offset = 1;
     if (Controller == ControlType.Pro) offset = 2;
 }
Example #9
0
 public Control(ControlType type)
 {
     if (instance == null)
     {
         instance = this;
         this.type = type;
     }
 }
Example #10
0
 public void makeActive()
 {
     controlType = ControlType.Full;
     camera.enabled = true;
     AudioListener aL = gameObject.GetComponent<AudioListener>();
     aL.enabled = true;
     justActivated = true;
 }
Example #11
0
        /*
         * Registers a listener for control events.
         */
        public void registerForInputEvents(InputListener listener, ControlType type)
        {
            Control control = Controls[type];
            if (!ListenerMap.ContainsKey(type))
                ListenerMap[type] = new List<InputListener>();

            ListenerMap[type].Add(listener);
        }
Example #12
0
        internal static Wix.Control ConvertToWControl(this IWixControl srcControl, ControlType controlType)
        {
            var wControl = new Wix.Control { Type = controlType.ToString() };

            wControl.CopyCommonPropertiesFrom(srcControl);

            return wControl;
        }
        /// <summary>
        ///		Añade un control a la lista a partir de la definición del valor
        /// </summary>
        public void AddControl(string strKey, ControlType intType, string strTitle, string strValue, bool blnRequired)
        {
            ControlProperty udtResult = new ControlProperty();

                // Carga los datos
                    udtResult.LoadValue(strKey, intType, strTitle, strValue, blnRequired);
                // Añade el control a la lista
                    lsrValues.Add(udtResult);
        }
Example #14
0
 public void openMiniScreen()
 {
     if (controlType == ControlType.None) {
         cameraView.enabled = true;
         controlType = ControlType.Inset;
     } else {
         controlType = ControlType.None;
     }
 }
Example #15
0
 public void cleanUpOnExit()
 {
     controlType = ControlType.None;
     camera.enabled = false;
     AudioListener aL = gameObject.GetComponent<AudioListener>();
     aL.enabled = false;
     Screen.lockCursor = false;
     if (lineRenderer!=null) lineRenderer.enabled = false;
 }
Example #16
0
	/*
		Constructor must specify both Controller and Button Type
	*/
	public Button(ControlType control,ButtonType button) {
		_controlType = control;
		_buttonType = button;
		_virtualName = "joystick";
		if (_controlType != ControlType.Any) {
			_virtualName += " " + ((int)(_controlType));	
		}
		_virtualName += " button " + ((int)(_buttonType));
	}
Example #17
0
 public void makeActive()
 {
     camera.enabled = true;
     camType = ControlType.Full;
     justActivated = true;
     camera.rect = new Rect(0f,0f,1f,1f);
     AudioListener aL = gameObject.GetComponent<AudioListener>();
     aL.enabled = true;
 }
Example #18
0
    public override bool GetContolType(ControlType controlType)
    {
        if (controlType == this.controlType)
        {
            this.controlType = ControlType.None;
            return true;
        }

        return false;
    }
 public override void OnModuleEnabled()
 {
     setPIDParameters();
     pid.Reset();
     lastAct = Vector3d.zero;
     worldVelocityDelta = Vector3d.zero;
     prev_worldVelocityDelta = Vector3d.zero;
     controlType = ControlType.VELOCITY_ERROR;
     base.OnModuleEnabled();
 }
Example #20
0
 public void makeActive()
 {
     Screen.lockCursor = true;
     cameraView.enabled = true;
     controlType = ControlType.Full;
     justActivated = true;
     cameraView.rect = new Rect(0f,0f,1f,1f);
     AudioListener aL = cameraView.gameObject.GetComponent<AudioListener>();
     aL.enabled = true;
 }
Example #21
0
 public WebControl(Browser aBrowser,LocatorType aLocatorType,string aLocator,ControlType aControlType)
 {
     myControlAccess = new ControlAccess();
     myControlAccess.Browser = aBrowser;
     myControlAccess.LocatorType = aLocatorType;
     myControlAccess.Locator = aLocator;
     myControlAccess.ControlType = aControlType;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
Example #22
0
 public ToolbarInfo(string text, string image, int displayIndex,
     ControlType control = ControlType.Button, string command = "", bool defaultValue = false)
 {
     Text = text;
     Image = image;
     DisplayIndex = displayIndex;
     Control = control;
     Command = command;
     Value = defaultValue;
 }
Example #23
0
    public void selectNearestItem(Vector3 position)
    {
        float nearestItemDistance = 999999999f;
        RageSpline previousActiveControl = activeControl;

        // Iterate all the GUI controls and find out which is the closest
        for (int index = 0; index < rageSpline.GetPointCount(); index++)
        {
            if ((controlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (controlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.Point;
                activeControl = controlPoints[index];
            }
            if ((inControlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (inControlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.InCtrl;
                activeControl = inControlPoints[index];
            }
            if ((outControlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (outControlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.OutCtrl;
                activeControl = outControlPoints[index];
            }
        }

        // Check if the closest is near enough
        if (nearestItemDistance > maxSelectionRange)
        {
            activeControl = null;
            activeControlPointIndex = -1;
            activeControlType = ControlType.NotSelected;
        }

        // Did the selected control change?
        if (previousActiveControl != activeControl)
        {
            // Reset the previously selected control to unselected color
            if(previousActiveControl!=null) {
                previousActiveControl.SetFillColor1(unSelectedColor);
                previousActiveControl.RefreshMesh();
            }
            // Fill the newly selected control with selectedColor
            if (activeControl != null)
            {
                activeControl.SetFillColor1(selectedColor);
                activeControl.RefreshMesh();
            }
        }
    }
 public void drawControl(ControlType type, string data)
 {
     switch (type)
     {
     case ControlType.TEXT:
         GUILayout.TextField (data);
         break;
     default:
         break;
     }
 }
Example #25
0
 /// <summary>
 /// Instantiates a player.
 /// </summary>
 /// <param name="playerID">Player Identifier.</param>
 /// <param name="monster">Monster.</param>
 /// <param name="controllerType">Controller type.</param>
 /// <param name="controllerNumber">Controller number.</param>
 public void InstantiatePlayer(string playerID, MonsterType monster, ControlType controllerType, int controllerNumber)
 {
     // Instantiate monster prefab
     GameObject go = Instantiate (Resources.Load ("Prefabs/" + monster.ToString())) as GameObject;
     APlayer player = go.GetComponent<APlayer> ();
     player.Logic = this;
     player.PlayerID = playerID;
     player.ControllerType = controllerType;
     player.ControllerNumber = controllerNumber;
     _players.Add (player);
 }
Example #26
0
 public Data(string name, string colorStr, int[] resources,
     int[] knownUnits, string[] winConditions, string[] loseConditions, ControlType control)
 {
     Name = name;
     ColorStr = colorStr;
     KnownUnits = knownUnits;
     Resources = resources;
     WinConditions = winConditions;
     LoseConditions = loseConditions;
     Control = control;
 }
        protected UITestControl GetControl(string autoId, UITestControl viewControl, ControlType controlType)
        {
            UITestControlCollection uiTestControlCollection = viewControl.GetChildren();
            UITestControl control = uiTestControlCollection.FirstOrDefault(c => ((WpfControl)c).AutomationId.Equals(autoId));
            if(control != null)
            {
                return control;
            }

            throw new Exception("Couldn't find the " + autoId + " for control type " + controlType);
        }
Example #28
0
        public AppUsage(string context, string operation, ControlType controlType, string details)
        {
            if (context == null) throw new ArgumentNullException(nameof(context));
            if (operation == null) throw new ArgumentNullException(nameof(operation));
            if (details == null) throw new ArgumentNullException(nameof(details));

            this.Context = context;
            this.Operation = operation;
            this.ControlType = controlType;
            this.Details = details;
        }
Example #29
0
 public void transferControl()
 {
     if(camType == ControlType.Full)
     {
         AudioListener aL = gameObject.GetComponent<AudioListener>();
         aL.enabled = false;
         tLC.moveToFirstPerson();
         camera.enabled = false;
         camType = ControlType.None;
         camera.rect = new Rect(.85f,.15f,0f,0f);
     }
 }
Example #30
0
 public void transferControl()
 {
     if(controlType == ControlType.Full)
     {
         Screen.lockCursor = false;
         AudioListener aL = cameraView.gameObject.GetComponent<AudioListener>();
         aL.enabled = false;
         tLC.moveToFirstPerson();
         cameraView.enabled = false;
         controlType = ControlType.None;
         cameraView.rect = new Rect(.85f,.15f,0f,0f);
     }
 }
 internal SeleniumWebCombobox(IWebElement aWebElement, ControlType aControlType, ControlAccess access)
     : base(aWebElement, aControlType, access)
 {
 }
Example #32
0
 public static SimpleSearchCondition CreateForControlType(ControlType controlType)
 {
     return(new SimpleSearchCondition(automationElement => automationElement.Current.ControlType, new ControlTypeProperty(controlType, "ControlType")));
 }
Example #33
0
 public static ControlDictionaryItem Win32Primary(Type testControlType, ControlType controlType)
 {
     return(Primary(testControlType, controlType, Constants.Win32FrameworkId));
 }
Example #34
0
        public IEnumerable <T> Find <T> (ControlType controlType = null, string automationId = null, string name = null, string className = null) where T : Control
        {
            var condition = AutomationElementExtensions.GetCondition(controlType, automationId, name, className);

            return(Find <T> (condition));
        }
Example #35
0
 public static SearchCriteria ByControlType(ControlType controlType)
 {
     return(new SearchCriteria(ConditionFactory.ByControlType(controlType)));
 }
Example #36
0
 public virtual SearchCriteria AndControlType(ControlType controlType)
 {
     _conditions.Insert(0, ConditionFactory.ByControlType(controlType));
     return(this);
 }
Example #37
0
 public static ControlDictionaryItem SilverlightSecondary(Type testControlType, ControlType controlType)
 {
     return(Secondary(testControlType, controlType, Constants.SilverlightFrameworkId));
 }
Example #38
0
 public static ControlDictionaryItem WPFSecondary(Type testControlType, ControlType controlType)
 {
     return(Secondary(testControlType, controlType, Constants.WPFFrameworkId));
 }
Example #39
0
 public ICommandBarControl Add(ControlType type, int before)
 {
     return(new CommandBarControl(IsWrappingNullReference ? null : Target.Add(type, Before: before, Temporary: CommandBarControl.AddCommandBarControlsTemporarily)));
 }
Example #40
0
 public static ControlDictionaryItem Secondary(Type testControlType, ControlType controlType)
 {
     return(new ControlDictionaryItem(testControlType, controlType, string.Empty, false, false, false, null, false));
 }
Example #41
0
 private static ControlDictionaryItem Secondary(Type testControlType, ControlType controlType, string frameworkId)
 {
     return(new ControlDictionaryItem(testControlType, controlType, string.Empty, false, false, false, frameworkId, false));
 }
Example #42
0
        /// <summary>
        /// Applies settings and adds required components for input to be detected based on the active platform.
        /// </summary>
        public static void Initialize(VRPlatform platform)
        {
            TBCore.OnUpdate += TBInput.Update;

#if UNITY_EDITOR
            _activeControlType = TBSettings.GetControlSettings().defaultEditorControlType;
#endif

            _hasActiveSDK = true;

            switch (platform)
            {
            case VRPlatform.OculusPC:
            case VRPlatform.OculusMobile:
                TBInputOculus.instance.Initialize();
                TBCore.OnFixedUpdate += TBInputOculus.instance.FixedUpdate;
                TBCore.OnUpdate      += TBInputOculus.instance.Update;
                _activeSDK            = TBInputOculus.instance;
                break;

            case VRPlatform.SteamVR:
                TBInputSteamVR.instance.Initialize();
                TBCore.OnFixedUpdate += TBInputSteamVR.instance.FixedUpdate;
                TBCore.OnUpdate      += TBInputSteamVR.instance.Update;
                _activeSDK            = TBInputSteamVR.instance;
                break;

            case VRPlatform.Daydream:
                TBInputGoogle.instance.Initialize();
                TBCore.OnFixedUpdate += TBInputGoogle.instance.FixedUpdate;
                TBCore.OnUpdate      += TBInputGoogle.instance.Update;
                _activeSDK            = TBInputGoogle.instance;
                break;

            case VRPlatform.PlayStationVR:
#if TB_HAS_UNITY_PS4
                TBPSVRInput.instance.Initialize();
                TBCore.OnFixedUpdate += TBPSVRInput.instance.FixedUpdate;
                TBCore.OnUpdate      += TBPSVRInput.instance.Update;
                _activeSDK            = TBPSVRInput.instance;
#else
                UnityEngine.Debug.LogError("TBInput attempted to initialize for PSVR, but the PSVR module is not available. Is the module installed and set up with #TB_HAS_UNITY_PS4?");
#endif
                break;

            case VRPlatform.WindowsMR:
                TBWindowsMRInput.instance.Initialize();
                TBCore.OnFixedUpdate += TBWindowsMRInput.instance.FixedUpdate;
                TBCore.OnUpdate      += TBWindowsMRInput.instance.Update;
                _activeSDK            = TBWindowsMRInput.instance;
                break;

            default:
                _hasActiveSDK = false;
                UnityEngine.Debug.LogError("Attempted to initialize TBInput without an active SDK in TBCore. This shouldn't happen if TBCore exists in your scene.");
                break;
            }

            TBLogging.LogMessage("Active Control Type: " + _activeControlType);
            if (_activeControlType == ControlType.None)
            {
                TBLogging.LogMessage("No active control type is assigned to TBInput. Input for type 'active' will be ignored until a control type is assigned.");
            }
        }
        /// <summary>
        /// this method creates automation tests subtree for particular test type
        /// </summary>
        /// <param name="testType"></param>
        /// <param name="testFilter">filter to be applied on all available automation tests collection</param>
        private void CreateTestTypeNodeSubtree(TestTypes testType, AutomationTestsFilter testFilter)
        {
            //create root currentTestTypeRootNode for the currentTestTypeRootNode type
            TreeNode currentTestTypeRootNode = new TreeNode(GetTestTypeName(testType));

            _testsTreeView.Nodes[0].Nodes.Add(currentTestTypeRootNode);

            if (testType == TestTypes.ControlTest)
            {
                //if ControlTest test type is required then let's get automation ControlType
                //for the selected automation element. If we are showing all tests, not only for selected
                //elements then let's get all automation element ControlTypes.
                //for all grabbed ControlTypes let's create subtree with tests

                ControlType[] controlTypes;

                if (this._scope == TestsScope.SelectedElementTests)
                {
                    try
                    {
                        //get control type if selected automation element
                        controlTypes = new ControlType[] { this._selectedElement.Current.ControlType };
                    }
                    catch (ElementNotAvailableException)
                    {
                        //if there are problems with the elements then ignore it
                        controlTypes = new ControlType[] { };
                    }
                }
                else
                {
                    // let's get all automation technology ControlTypes
                    controlTypes = AutomationHelper.GetAllAutomationControlTypes();
                }

                //fore each control type, let's create subtree
                foreach (ControlType controlType in controlTypes)
                {
                    //create automation tests filter for the controlType
                    FilterControlTypeTests controlTypeFilter = new FilterControlTypeTests(controlType);

                    //create tree currentTestTypeRootNode for the control type
                    TreeNode controlTypeNode = new TreeNode(controlTypeFilter.ControlTypeName);
                    currentTestTypeRootNode.Nodes.Add(controlTypeNode);

                    //create priority subtree for the controlType
                    CreatePrioritySubtreesForTestType(controlTypeNode, new AndFilter(testFilter, controlTypeFilter), testType);

                    //if the currentRootNode has no children nodes then remove it
                    if (controlTypeNode.Nodes.Count == 0)
                    {
                        controlTypeNode.Remove();
                    }
                }
            }
            else
            {
                if (testType == TestTypes.PatternTest)
                {
                    //if PatternTest test type is required then let's get all supported patterns
                    //for the selected automation element. If we are showing all tests, not only for selected
                    //elements then let's get all automation element Patterns.
                    //for all grabbed Patterns let's create subtree with tests

                    IEnumerable <AutomationPattern> supportedPatterns;

                    if (this._scope == TestsScope.SelectedElementTests)
                    {
                        try
                        {
                            //get all supported patterns
                            supportedPatterns = this._selectedElement.GetSupportedPatterns();
                        }
                        catch (ElementNotAvailableException)
                        {
                            //is there is problem with the element then ignore his patterns
                            supportedPatterns = new AutomationPattern[0];
                        }
                    }
                    else
                    {
                        //let's get all automation technology patterns
                        supportedPatterns = AutomationHelper.GetAllAutomationPatterns();
                    }

                    //for each pattern let's create subtree
                    foreach (AutomationPattern pattern in supportedPatterns)
                    {
                        //create filter filtering automation tests testing this pattern
                        FilterPatternTests patternFilter = new FilterPatternTests(pattern);

                        //create tree currentRootNode for the pattern
                        TreeNode patternNode = new TreeNode(patternFilter.PatternName);
                        currentTestTypeRootNode.Nodes.Add(patternNode);

                        //create priority subtree for the pattern
                        CreatePrioritySubtreesForTestType(patternNode, new AndFilter(testFilter, patternFilter), testType);

                        //if the currentRootNode has no children nodes then remove it
                        if (patternNode.Nodes.Count == 0)
                        {
                            patternNode.Remove();
                        }
                    }
                }
                else
                {
                    //if other TestType than ControlTests or PatternTests is required then
                    //create subtree for it
                    CreatePrioritySubtreesForTestType(currentTestTypeRootNode, testFilter, testType);
                }
            }

            //if there are no children then remove the currentTestTypeRootNode
            if (currentTestTypeRootNode.Nodes.Count == 0)
            {
                currentTestTypeRootNode.Remove();
            }
        }
Example #44
0
 public virtual bool IsControlTypeSupported(ControlType controlType)
 {
     return(items.Any(controlDictionaryItem => controlDictionaryItem.ControlType.Equals(controlType)));
 }
 internal SeleniumWebControls(IWebElement aWebElement, ControlType aControlType)
 {
     this.aWebElement  = aWebElement;
     this.aControlType = aControlType;
 }
 public List <IControl> GetChildren(string Locator, LocatorType aLocatorType, ControlType aControlType)
 {
     return(Utility.GetChildren(Locator, aLocatorType, aControlType, aWebElement));
 }
 internal SeleniumWebEditBox(IWebElement aWebElement, ControlType aControlType)
     : base(aWebElement, aControlType)
 {
 }
 public static AutomationElementCollection FindAllChildren(this AutomationElement root, ControlType type)
 {
     return(root.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, type)));
 }
 internal SeleniumWebButton(IWebElement aWebElement, ControlType aControlType)
     : base(aWebElement, aControlType)
 {
 }
Example #50
0
 /// <summary>
 /// Уточнить поиск по ControlType через логическое И.
 /// </summary>
 /// <param name="value">
 /// Тип элемента.
 /// </param>
 public ByProperty AndType(ControlType value)
 {
     this.And(AutomationElement.ControlTypeProperty, value);
     return(this);
 }
Example #51
0
 private static bool ControlTypeMatches(ControlType controlType, ControlDictionaryItem controlDictionaryItem)
 {
     //Console.WriteLine("Type - {0} vs {1}, equals? = {2}", controlType.LocalizedControlType, controlDictionaryItem.ControlType.LocalizedControlType, controlDictionaryItem.ControlType.Equals(controlType));
     return(controlDictionaryItem.ControlType.Equals(controlType));
 }
Example #52
0
 public virtual bool IsExcluded(ControlType controlType)
 {
     return(items.Exists(controlDictionaryItem => controlDictionaryItem.ControlType.Equals(controlType) && controlDictionaryItem.IsExcluded));
 }
        public static AutomationElement FindChildByIndex(this AutomationElement root, ControlType type, int index)
        {
            AutomationElementCollection controls = root.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, type));

            return(controls[index]);
        }
Example #54
0
 private static bool ControlTypeMatches(ControlType controlType, ControlDictionaryItem controlDictionaryItem)
 {
     return(controlDictionaryItem.ControlType.Equals(controlType));
 }
Example #55
0
 public ControlReference(ControlType type, uint no)
 {
     Type = type;
     Id   = no;
 }
Example #56
0
        public virtual Type GetTestControlType(string className, string name, ControlType controlType, string frameWorkId, bool isNativeControl)
        {
            if (Equals(controlType, ControlType.ListItem) && string.IsNullOrEmpty(frameWorkId))
            {
                frameWorkId = WindowsFramework.Win32.FrameworkId();
            }

            var dictionaryItems = items.Where(controlDictionaryItem =>
            {
                if (!ControlTypeMatches(controlType, controlDictionaryItem))
                {
                    return(false);
                }
                if (!FrameworkIdMatches(frameWorkId, controlDictionaryItem))
                {
                    return(false);
                }
                if (controlDictionaryItem.IsIdentifiedByClassName && !className.Contains(controlDictionaryItem.ClassName))
                {
                    return(false);
                }
                if (controlDictionaryItem.IsIdentifiedByName && controlDictionaryItem.TestControlType.Name != name)
                {
                    return(false);
                }

                return(true);
            })
                                  .ToArray();

            if (!dictionaryItems.Any())
            {
                throw new ControlDictionaryException(string.Format("Could not find TestControl for ControlType={0} and FrameworkId:{1}",
                                                                   controlType, frameWorkId));
            }
            if (dictionaryItems.Length > 1)
            {
                var primaries = dictionaryItems.Where(i => IsPrimaryControl(i.ControlType, className, name)).ToArray();
                if (primaries.Length == 1)
                {
                    return(primaries.Single().TestControlType);
                }

                var identifiedByName = dictionaryItems.Where(i => i.IsIdentifiedByName).ToArray();
                if (identifiedByName.Length == 1)
                {
                    return(identifiedByName.Single().TestControlType);
                }
                var identifiedByClassName = dictionaryItems.Where(i => i.IsIdentifiedByClassName).ToArray();
                if (identifiedByClassName.Length == 1)
                {
                    return(identifiedByClassName.Single().TestControlType);
                }
                var isPrimary = dictionaryItems.Where(i => i.IsPrimary).ToArray();
                if (isPrimary.Length == 1)
                {
                    return(isPrimary.Single().TestControlType);
                }

                throw new ControlDictionaryException(string.Format(
                                                         "Multiple TestControls found for ControlType={0} and FrameworkId:{1} - {2}",
                                                         controlType, frameWorkId,
                                                         string.Join(", ", dictionaryItems.Select(d => d.TestControlType == null ? "null" : d.TestControlType.FullName))));
            }
            return(dictionaryItems.Single().TestControlType);
        }
Example #57
0
        public Ball SpawnBall(int position, BallType ballType, ControlType ctrlType, int character, string nickname)
        {
            float characterSize = ActiveData.Characters[character].ballSize;

            return(SpawnBall(GetSpawnPoint(position, characterSize / 2f), transform.rotation, ballType, ctrlType, character, nickname));
        }
        public static MvcHtmlString GenerateHtml(string name, List <SelectListItem> items, ControlType controlType, object stateValue, string cssClass, bool disabled)
        {
            TagBuilder container = new TagBuilder("div");

            container.AddCssClass(cssClass);
            MvcHtmlString result = null;

            switch (controlType)
            {
            case ControlType.CheckBox:
                IEnumerable <string> currentValues = stateValue as IEnumerable <string>;
                result = GenerateCheckBoxList(container, name, items, currentValues, disabled);
                break;

            case ControlType.Radio:
                string currentValue = stateValue.ToString();
                result = GenerateRadioButtonList(container, name, items, currentValue, disabled);
                break;
            }
            return(result);
        }
Example #59
0
 public static ControlDictionaryItem Secondary(Type testControlType, ControlType controlType, bool hasPrimaryChildren)
 {
     return(new ControlDictionaryItem(testControlType, controlType, string.Empty, false, false, false, null, hasPrimaryChildren));
 }
Example #60
0
        private void BuildLabeledControl(PropertyInfo propertyInfo)
        {
            Grid grid = new Grid();

            grid.Width  = 270.0;
            grid.Height = 23.0;
            grid.Margin = new Thickness(0, 0, 15, 5);

            ColumnDefinition columnDefinition = new ColumnDefinition();

            columnDefinition.Width = new GridLength(120);
            grid.ColumnDefinitions.Add(columnDefinition);

            columnDefinition       = new ColumnDefinition();
            columnDefinition.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(columnDefinition);

            ControlType controlType = DisplayUtil.GetControlType(propertyInfo);

            Binding binding = this.CreateBinding(propertyInfo, controlType, this.DataContext);

            TextBox textBox = null;

            switch (controlType)
            {
            case ControlType.Button:
                Button button = new Button();
                button.SetBinding(Button.CommandProperty, binding);
                button.Content             = DisplayUtil.GetControlDescription(propertyInfo);
                button.HorizontalAlignment = HorizontalAlignment.Right;
                button.Margin  = new Thickness(5, 0, 0, 0);
                button.Padding = new Thickness(15, 3, 15, 3);
                this.commandPanel.Children.Add(button);
                break;



            case ControlType.CheckBox:
                CheckBox checkBox = new CheckBox();
                checkBox.SetBinding(CheckBox.IsCheckedProperty, binding);
                Grid.SetColumn(checkBox, 1);
                grid.Children.Add(checkBox);
                break;

            // combo box
            case ControlType.ComboBox:
                ComboBox comboBox = new ComboBox();

                if (propertyInfo.PropertyType.IsEnum)
                {
                    comboBox.ItemsSource = Enum.GetValues(propertyInfo.PropertyType);
                    // populate?
                }
                else
                {
                    comboBox.ItemsSource = RepositoryManager.GetLookupRepository(propertyInfo.PropertyType).LookupList;
                }

                comboBox.SetBinding(ComboBox.SelectedItemProperty, binding);
                Grid.SetColumn(comboBox, 1);
                grid.Children.Add(comboBox);
                break;

            case ControlType.DateBox:
                break;

            case ControlType.Label:
                textBox           = new TextBox();
                textBox.IsEnabled = false;
                textBox.SetBinding(TextBox.TextProperty, binding);

                Grid.SetColumn(textBox, 1);
                grid.Children.Add(textBox);

                break;

            case ControlType.None:
                break;


            case ControlType.TextBox:
                textBox = new TextBox();
                textBox.SetBinding(TextBox.TextProperty, binding);
                Grid.SetColumn(textBox, 1);
                grid.Children.Add(textBox);
                break;

            default:
                break;
            }

            if (controlType != ControlType.Button)
            {
                Label label = new Label();
                label.Content = DisplayUtil.GetControlDescription(propertyInfo);
                label.Margin  = new Thickness(0, -2, 0, 0);
                Grid.SetColumn(label, 0);
                grid.Children.Add(label);

                RowDefinition rowDefinition = new RowDefinition();
                rowDefinition.Height = GridLength.Auto;

                this.propertyGrid.RowDefinitions.Add(rowDefinition);

                Grid.SetRow(grid, this.propertyGrid.RowDefinitions.Count - 1);

                this.propertyGrid.Children.Add(grid);
            }
        }