Beispiel #1
0
        /// <summary>
        /// Gives all Types of <see cref="OSMElement"/>
        /// </summary>
        /// <returns>list of all Types of <see cref="OSMElement"/> with possible values OR range</returns>
        public static List <String> getAllTypes()
        {
            List <String> displayedGuiElements = GeneralProperties.getAllTypes();

            displayedGuiElements.AddRange(BrailleRepresentation.getAllTypes());
            return(displayedGuiElements);
        }
Beispiel #2
0
        public static List <DataTypeOSMElement> getAllTypes_possibleValues()
        {
            List <DataTypeOSMElement> displayedGuiElements = GeneralProperties.getAllTypes_possibleValues();

            displayedGuiElements.AddRange(BrailleRepresentation.getAllTypes_possibleValues());
            return(displayedGuiElements);
        }
Beispiel #3
0
        private static List <String> getPosibleValuesOfProperty(String propertyName)
        {
            switch (propertyName)
            {
            case "displayedGuiElementType":
                return(GeneralProperties.getAllTypes());

            default:
                return(null);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Gets a specified property
 /// </summary>
 /// <param name="elementName">name of the wanted property</param>
 /// <param name="properties">properties of the node</param>
 /// <param name="propertyType">the datatype of the property</param>
 /// <returns>the wanted property from <para>properties</para> </returns>
 public static object getPropertyElement(String elementName, GeneralProperties properties, out Type propertyType)
 {
     try
     { //see http://stackoverflow.com/questions/1196991/get-property-value-from-string-using-reflection-in-c-sharp#
         propertyType = properties.GetType().GetProperty(elementName).PropertyType;
         return(properties.GetType().GetProperty(elementName).GetValue(properties, null));
     }
     catch
     {
         throw new Exception("Exception in OSMElement.GeneralProperties: An attempt was made to query a non-existent property ('" + elementName + "')");
     }
 }
Beispiel #5
0
 /// <summary>
 /// Gets a specified property
 /// </summary>
 /// <param name="elementName">name of the wanted property</param>
 /// <param name="osmElement">properties of the node</param>
 /// <returns>the wanted property from <para>properties</para> </returns>
 public static object getElement(String elementName, OSMElement osmElement)
 {
     if (GeneralProperties.getAllTypes().Contains(elementName))
     {
         return(GeneralProperties.getPropertyElement(elementName, osmElement.properties));
     }
     if (BrailleRepresentation.getAllTypes().Contains(elementName))
     {
         return(BrailleRepresentation.getPropertyElement(elementName, osmElement.brailleRepresentation));
     }
     //TODO: Events
     return(null);
 }
Beispiel #6
0
        /// <summary>
        /// depending on the given properties, all nodes with these properties are searched (depth-first search).
        /// Only properties that have been specified are taken into account.
        /// </summary>
        /// <param name="tree">tree object for search </param>
        /// <param name="generalProperties">properties for the search</param>
        /// <param name="oper">Operator for combining the properties (and, or) </param>
        /// <returns>A list of the found tree objects</returns>
        public List <Object> getNodesByProperties(Object tree, OSMElements.GeneralProperties generalProperties, OperatorEnum oper = OperatorEnum.and)
        {//TODO: many properties are still missing
            List <Object> result = new List <Object>();

            if (tree == null)
            {
                return(result);
            }
            foreach (Object node in strategyMgr.getSpecifiedTree().AllNodes(tree))
            {
                OSMElements.OSMElement nodeData       = strategyMgr.getSpecifiedTree().GetData(node);
                Boolean propertieLocalizedControlType = generalProperties.localizedControlTypeFiltered == null || nodeData.properties.localizedControlTypeFiltered.Equals(generalProperties.localizedControlTypeFiltered);
                Boolean propertieName              = generalProperties.nameFiltered == null || nodeData.properties.nameFiltered.Equals(generalProperties.nameFiltered);
                Boolean propertieIsEnabled         = generalProperties.isEnabledFiltered == null || nodeData.properties.isEnabledFiltered == generalProperties.isEnabledFiltered;
                Boolean propertieBoundingRectangle = generalProperties.boundingRectangleFiltered == new System.Windows.Rect() || nodeData.properties.boundingRectangleFiltered.Equals(generalProperties.boundingRectangleFiltered);
                Boolean propertieIdGenerated       = generalProperties.IdGenerated == null || generalProperties.IdGenerated.Equals(nodeData.properties.IdGenerated);
                Boolean propertieAccessKey         = generalProperties.accessKeyFiltered == null || generalProperties.accessKeyFiltered.Equals(nodeData.properties.accessKeyFiltered);
                Boolean acceleratorKey             = generalProperties.acceleratorKeyFiltered == null || generalProperties.acceleratorKeyFiltered.Equals(nodeData.properties.acceleratorKeyFiltered);
                Boolean runtimeId    = generalProperties.runtimeIDFiltered == null || Enumerable.SequenceEqual(generalProperties.runtimeIDFiltered, nodeData.properties.runtimeIDFiltered);
                Boolean automationId = generalProperties.autoamtionIdFiltered == null || generalProperties.autoamtionIdFiltered.Equals(nodeData.properties.autoamtionIdFiltered); //ist zumindest bei Skype für ein UI-Element nicht immer gleich
                Boolean controlType  = generalProperties.controlTypeFiltered == null || generalProperties.controlTypeFiltered.Equals(nodeData.properties.controlTypeFiltered);
                if (OperatorEnum.Equals(oper, OperatorEnum.and))
                {
                    if (propertieBoundingRectangle && propertieLocalizedControlType && propertieIdGenerated && propertieAccessKey && acceleratorKey &&
                        runtimeId && controlType && propertieName && propertieIsEnabled)
                    {
                        result.Add(node);
                    }
                }
                if (OperatorEnum.Equals(oper, OperatorEnum.or))
                {//TODO: add properties
                    if ((generalProperties.localizedControlTypeFiltered != null && propertieLocalizedControlType) ||
                        (generalProperties.nameFiltered != null && propertieName) ||
                        (generalProperties.isEnabledFiltered != null && propertieIsEnabled) ||
                        (generalProperties.boundingRectangleFiltered != new System.Windows.Rect() && propertieBoundingRectangle) ||
                        (generalProperties.IdGenerated != null && propertieIdGenerated) ||
                        (generalProperties.accessKeyFiltered != null && propertieAccessKey) ||
                        (generalProperties.acceleratorKeyFiltered != null && acceleratorKey) ||
                        (generalProperties.runtimeIDFiltered != null && runtimeId) ||
                        (generalProperties.controlTypeFiltered != null && controlType)
                        )
                    {
                        result.Add(node);
                    }
                }
            }
            return(result);
        }
Beispiel #7
0
 public OSMElement()
 {
     properties            = new GeneralProperties();
     brailleRepresentation = new BrailleRepresentation();
     //events = new OSMEvents();
 }
Beispiel #8
0
        public override bool Equals(object obj)
        {
            if ((this == null && obj != null) || (this != null && obj == null))
            {
                return(false);
            }
            if (!obj.GetType().Equals(typeof(GeneralProperties)))
            {
                return(false);
            }
            GeneralProperties prop = (GeneralProperties)obj;
            bool result            = true;

            if (this.acceleratorKeyFiltered != null)
            {
                result = this.acceleratorKeyFiltered.Equals(prop.acceleratorKeyFiltered);
            }
            if (this.accessKeyFiltered != null)
            {
                result = result && this.accessKeyFiltered.Equals(prop.accessKeyFiltered);
            }
            if (this.appPath != null)
            {
                result = result && this.appPath.Equals(prop.appPath);
            }
            if (this.autoamtionIdFiltered != null)
            {
                result = result && this.autoamtionIdFiltered.Equals(prop.autoamtionIdFiltered);
            }
            if (this.boundingRectangleFiltered != null)
            {
                result = result && this.boundingRectangleFiltered.Equals(prop.boundingRectangleFiltered);
            }
            if (this.classNameFiltered != null)
            {
                result = result && this.classNameFiltered.Equals(prop.classNameFiltered);
            }
            if (this.controlTypeFiltered != null)
            {
                result = result && this.controlTypeFiltered.Equals(prop.controlTypeFiltered);
            }
            if (this.frameWorkIdFiltered != null)
            {
                result = result && this.frameWorkIdFiltered.Equals(prop.frameWorkIdFiltered);
            }
            if (this.grantFilterStrategy != null)
            {
                result = result && this.grantFilterStrategy.Equals(prop.grantFilterStrategy);
            }
            if (this.hasKeyboardFocusFiltered != null)
            {
                result = result && this.hasKeyboardFocusFiltered.Equals(prop.hasKeyboardFocusFiltered);
            }
            if (this.helpTextFiltered != null)
            {
                result = result && this.helpTextFiltered.Equals(prop.helpTextFiltered);
            }
            if (this.hWndFiltered != null)
            {
                result = result && this.hWndFiltered.Equals(prop.hWndFiltered);
            }
            if (this.IdGenerated != null)
            {
                result = result && this.IdGenerated.Equals(prop.IdGenerated);
            }
            if (this.isContentElementFiltered != null)
            {
                result = result && this.isContentElementFiltered.Equals(prop.isContentElementFiltered);
            }
            if (this.isControlElementFiltered != null)
            {
                result = result && this.isControlElementFiltered.Equals(prop.isControlElementFiltered);
            }
            if (this.isEnabledFiltered != null)
            {
                result = result && this.isEnabledFiltered.Equals(prop.isEnabledFiltered);
            }
            if (this.isKeyboardFocusableFiltered != null)
            {
                result = result && this.isKeyboardFocusableFiltered.Equals(prop.isKeyboardFocusableFiltered);
            }
            if (this.isOffscreenFiltered != null)
            {
                result = result && this.isOffscreenFiltered.Equals(prop.isOffscreenFiltered);
            }
            if (this.isPasswordFiltered != null)
            {
                result = result && this.isPasswordFiltered.Equals(prop.isPasswordFiltered);
            }
            if (this.isRequiredForFormFiltered != null)
            {
                result = result && this.isRequiredForFormFiltered.Equals(prop.isRequiredForFormFiltered);
            }
            if (this.isToggleStateOn != null)
            {
                result = result && this.isToggleStateOn.Equals(prop.isToggleStateOn);
            }
            if (this.itemStatusFiltered != null)
            {
                result = result && this.itemStatusFiltered.Equals(prop.itemStatusFiltered);
            }
            if (this.itemTypeFiltered != null)
            {
                result = result && this.itemTypeFiltered.Equals(prop.itemTypeFiltered);
            }
            if (this.labeledByFiltered != null)
            {
                result = result && this.labeledByFiltered.Equals(prop.labeledByFiltered);
            }
            if (this.localizedControlTypeFiltered != null)
            {
                result = result && this.localizedControlTypeFiltered.Equals(prop.localizedControlTypeFiltered);
            }
            if (this.nameFiltered != null)
            {
                result = result && this.nameFiltered.Equals(prop.nameFiltered);
            }
            result = result && this.processIdFiltered.Equals(prop.processIdFiltered);
            if (this.processName != null)
            {
                result = result && this.processName.Equals(prop.processName);
            }
            if (!this.rangeValue.Equals(new RangeValue()))
            {
                result = result && this.rangeValue.Equals(prop.rangeValue);
            }
            // if (this.runtimeIDFiltered != null) { result = result && ItemsEqual( this.runtimeIDFiltered, prop.runtimeIDFiltered); }
            if (this.suportedPatterns != null)
            {
                result = result && ItemsEqual(this.suportedPatterns, prop.suportedPatterns);
            }
            if (this.valueFiltered != null)
            {
                result = result && this.valueFiltered.Equals(prop.valueFiltered);
            }
            return(result);
        }
Beispiel #9
0
        /// <summary>
        /// Gets a specified property
        /// </summary>
        /// <param name="elementName">name of the wanted property</param>
        /// <param name="properties">properties of the node</param>
        /// <returns>the wanted property from <para>properties</para> </returns>
        public static object getPropertyElement(String elementName, GeneralProperties properties)
        {
            Type t;

            return(getPropertyElement(elementName, properties, out t));
        }