public void updateImg() { if (grantTrees.filteredTree == null) { Console.WriteLine("Die Anwendung wurde noch nicht gefiltert - bitte 'F5' drücken"); return; } String brailleId = ""; GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "Screenshot"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTrees.brailleTree, propertiesForSearch, OperatorEnum.and); if (treeElement.Count > 0) { brailleId = strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated; } if (brailleId.Equals("")) { return; } OsmTreeConnectorTuple osmRelationships = grantTrees.osmTreeConnections.Find(r => r.BrailleTreeId.Equals(brailleId) || r.FilteredTreeId.Equals(brailleId)); if (osmRelationships != null) { //strategyMgr.getSpecifiedFilter().updateNodeOfFilteredTree(osmRelationships.FilteredTree); treeOperation.updateNodes.filteredNodeElementOfApplication(osmRelationships.FilteredTreeId); OSMElements.OSMElement relatedBrailleTreeObject = treeOperation.searchNodes.getBrailleTreeOsmElementById(osmRelationships.BrailleTreeId); if (!relatedBrailleTreeObject.Equals(new OSMElements.OSMElement())) { strategyMgr.getSpecifiedBrailleDisplay().updateViewContent(ref relatedBrailleTreeObject); } } }
/// <summary> /// Wechselt zwischen screen1 und screen2 /// </summary> public void changeScreen(String name) { if (name.Equals("")) { return; } if (strategyMgr.getSpecifiedBrailleDisplay() == null) { return; } if (getPosibleScreens().Contains(name)) { strategyMgr.getSpecifiedBrailleDisplay().setVisibleScreen(name); } // ITreeStrategy<OSMElement.OSMElement> subtreeFiltered = strategyMgr.getSpecifiedTreeOperations().getSubtreeOfScreen(visibleScreen); //Screenshots aktualisieren beim Screen-Wechsel Object subnodesOfScreen = treeOperation.searchNodes.getSubtreeOfScreen(name); GeneralProperties prop = new GeneralProperties(); prop.controlTypeFiltered = "Screenshot"; List <Object> screenshotNodes = treeOperation.searchNodes.getNodesByProperties(subnodesOfScreen, prop); foreach (Object node in screenshotNodes) { OSMElements.OSMElement osmScreenshot = strategyMgr.getSpecifiedTree().GetData(node); strategyMgr.getSpecifiedBrailleDisplay().updateViewContent(ref osmScreenshot); strategyMgr.getSpecifiedTree().SetData(node, osmScreenshot); grantTrees.brailleTree = strategyMgr.getSpecifiedTree().Root(node); } }
/// <summary> /// Generates an id for one node of the braille (output) tree. /// </summary> /// <param name="node">one node of the braille tree</param> /// <returns>the generated id</returns> public String generatedIdBrailleNode(OSMElements.OSMElement osmElement) { /* https://blogs.msdn.microsoft.com/csharpfaq/2006/10/09/how-do-i-calculate-a-md5-hash-from-a-string/ * http://stackoverflow.com/questions/12979212/md5-hash-from-string * http://stackoverflow.com/questions/10520048/calculate-md5-checksum-for-a-file */ GeneralProperties properties = osmElement.properties; BrailleRepresentation braille = osmElement.brailleRepresentation; String result = properties.controlTypeFiltered + braille.displayedGuiElementType + braille.screenName + braille.viewName + properties.boundingRectangleFiltered.ToString() + properties.controlTypeFiltered + (braille.typeOfView == null? "":braille.typeOfView) + (braille.uiElementSpecialContent == null? "": braille.uiElementSpecialContent.ToString()); byte[] hash; using (var md5 = MD5.Create()) { hash = md5.ComputeHash(Encoding.UTF8.GetBytes(result)); } StringBuilder sb = new StringBuilder(); foreach (byte b in hash) { sb.Append(b.ToString("X2")); } return(sb.ToString()); }
private OSMElements.OSMElement addElementInBrailleTree(object filteredNode, TextviewElement tve, int width, ref int startXPosition, int startYPosition) { OSMElements.OSMElement osmFiltered = strategyMgr.getSpecifiedTree().GetData(filteredNode); int depth = strategyMgr.getSpecifiedTree().Depth(filteredNode) * shiftingPerDepth; TextviewObject tvo = grantTrees.TextviewObject; OSMElements.OSMElement osmBraille = new OSMElements.OSMElement(); GeneralProperties propBraille = new GeneralProperties(); BrailleRepresentation braille = new BrailleRepresentation(); braille.isVisible = true; propBraille.controlTypeFiltered = "Text"; braille.isGroupChild = true; braille.typeOfView = tvo.typeOfView; braille.screenName = tvo.screenName; braille.displayedGuiElementType = tve.property; braille.viewName = osmFiltered.properties.IdGenerated + "_" + tve.order; propBraille.boundingRectangleFiltered = new Rect(startXPosition, startYPosition, width, 5);//TODO: richtig machen osmBraille.properties = propBraille; osmBraille.brailleRepresentation = braille; propBraille.IdGenerated = treeOperation.generatedIds.generatedIdBrailleNode(osmBraille); osmBraille.properties = propBraille; treeOperation.osmTreeConnector.addOsmConnection(osmFiltered.properties.IdGenerated, propBraille.IdGenerated); treeOperation.updateNodes.updateNodeOfBrailleUi(ref osmBraille); return(osmBraille); }
private void OpenMenu_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog() { Filter = @"SHMD File (*.shmd)|*.shmd" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { Path = openFileDialog.FileName; SHMD = SHMD.Load(Path); General = new General(SHMD.Header, SHMD.GlobalLight, SHMD.Fog, SHMD.BackGroundColor, SHMD.Frustum, SHMD.DirectionLightAmbient, SHMD.DirectionLightDiffuse); GeneralProperties.SelectedObject = General; GeneralProperties.ExpandAllGridItems(); SkyBox.DataSource = SHMD.Sky.MapElements; WaterBox.DataSource = SHMD.Water.MapElements; GroundObjectsBox.DataSource = SHMD.GroundObject.MapElements; MapObjectsBox.DataSource = SHMD.MapObjects; CheckComponents(true); Refresh(); } }
private void createScreenshotViews(string pathToTemplate) { XElement xmlDoc = XElement.Load(@pathToTemplate); if (xmlDoc.Element(VIEWCATEGORY_LAYOUTVIEW) == null) { return; } IEnumerable <XElement> uiElement = from el in xmlDoc.Element(VIEWCATEGORY_LAYOUTVIEW).Elements("Screenshot") select el; if (uiElement == null || !uiElement.Any()) { return; } ATemplateUi generalUiInstance = new TemplateNode(strategyMgr, grantTrees, treeOperation); foreach (XElement element in uiElement) { TemplateScreenshotObject templateObject = xmlUiScreenshotToTemplateUiScreenshot(element); GeneralProperties prop = new GeneralProperties(); prop.controlTypeFiltered = templateObject.connectedFilteredNodeControltype; List <Object> nodes = treeOperation.searchNodes.getNodesByProperties(grantTrees.filteredTree, prop); generalUiInstance.createUiScreenshotFromTemplate(templateObject, nodes); } }
/// <summary> /// Setzt die Beziehung von dem "realen" GUI Element zu dem UI-Element auf der Stiftplatte umd die Darstellung eines Screenshots zu testen /// falls noch kein Baum gefiltert wurde, so wird die Anwendung gefiltert /// </summary> public void setOSMRelationshipImg() { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); if (grantTree.filteredTree == null) { filterTreeOfApplication(); } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "Screenshot"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTree.brailleTree, propertiesForSearch, OperatorEnum.and); if (treeElement.Count > 0) { treeOperation.osmTreeConnector.addOsmConnection(osmElement.properties.IdGenerated, strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated); } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } }
public void InitializeSHMD() { AddSkyObjectTextBox.AutoSize = false; AddSkyObjectTextBox.Height = 22; AddWaterObjectTextBox.AutoSize = false; AddWaterObjectTextBox.Height = 22; AddGroundObjectTextBox.AutoSize = false; AddGroundObjectTextBox.Height = 22; AddMapObjectTextBox.AutoSize = false; AddMapObjectTextBox.Height = 22; General = new General(MBI.SHMD.Header, MBI.SHMD.GlobalLight, MBI.SHMD.Fog, MBI.SHMD.BackGroundColor, MBI.SHMD.Frustum, MBI.SHMD.DirectionLightAmbient, MBI.SHMD.DirectionLightDiffuse); GeneralProperties.SelectedObject = General; GeneralProperties.ExpandAllGridItems(); SkyBox.DataSource = MBI.SHMD.Sky.MapElements; WaterBox.DataSource = MBI.SHMD.Water.MapElements; GroundObjectsBox.DataSource = MBI.SHMD.GroundObject.MapElements; MapObjectsBox.DataSource = MBI.SHMD.MapObjects; CheckSHMDComponents(true); Refresh(); }
Dictionary <string, string> MergeProperties(Dictionary <string, string> propsToMerge) { var properties = GeneralProperties.Clone(SerializationType.Json); foreach (var prop in propsToMerge) { properties [prop.Key] = prop.Value; } return(properties); }
/// <summary> /// Seeks new data for a node /// </summary> /// <param name="osmElementFilteredNode">OSM element to update</param> /// <returns>new properties for a node</returns> public GeneralProperties updateNodeContent(OSMElements.OSMElement osmElementFilteredNode) { GeneralProperties propertiesUpdated = new GeneralProperties(); AutomationElement au = getAutomationelementOfOsmElement(osmElementFilteredNode); if (au != null) { propertiesUpdated = setProperties(au); propertiesUpdated.IdGenerated = osmElementFilteredNode.properties.IdGenerated; } return(propertiesUpdated); }
private OSMElements.OSMElement createChildBrailleNode(Object filteredSubtree, TemplateUiObject templateObject, String viewName) { //TODO: falls eine Beziehung im Baum erstellt werden soll muss diese hier? noch gesetzt werden => geht nicht ID ist noch nicht vorhanden OSMElements.OSMElement brailleNode = templateObject.osm; GeneralProperties prop = templateObject.osm.properties; BrailleRepresentation braille = templateObject.osm.brailleRepresentation; prop.isEnabledFiltered = false; braille.isVisible = true; if (templateObject.osm.properties.controlTypeFiltered.Equals("DropDownMenuItem")) { OSMElements.UiElements.DropDownMenuItem dropDownMenu = new OSMElements.UiElements.DropDownMenuItem(); if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasChild = true; } if (strategyMgr.getSpecifiedTree().HasNext(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Next(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasNext = true; } if (strategyMgr.getSpecifiedTree().HasPrevious(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Previous(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasPrevious = true; } if (strategyMgr.getSpecifiedTree().HasParent(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Parent(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.isChild = true; } dropDownMenu.isOpen = false; dropDownMenu.isVertical = false; braille.uiElementSpecialContent = dropDownMenu; } if (templateObject.osm.properties.controlTypeFiltered.Equals("TabItem")) { OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem(); //tabView.orientation = templateObject.orientation; //braille.uiElementSpecialContent = tabView; braille.uiElementSpecialContent = templateObject.osm.brailleRepresentation.uiElementSpecialContent; } if (templateObject.Screens == null) { Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(new OSMElements.OSMElement()); } braille.screenName = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben braille.viewName = viewName; brailleNode.properties = prop; brailleNode.brailleRepresentation = braille; prop.IdGenerated = treeOperation.generatedIds.generatedIdBrailleNode(brailleNode); brailleNode.properties = prop; return(brailleNode); }
public void searchPropertie(String localizedControlTypeFiltered) { if (grantTree.filteredTree == null) { filterTreeOfApplication(); } GeneralProperties searchedProperties = new GeneralProperties(); searchedProperties.localizedControlTypeFiltered = localizedControlTypeFiltered.Equals("") ? "Schaltfläche" : localizedControlTypeFiltered; // searchedProperties.nameFiltered = ""; Console.Write("Gesuchte Eigenschaften "); treeOperation.searchNodes.getNodesByProperties(grantTree.filteredTree, searchedProperties, OperatorEnum.or); }
/// <summary> /// Sets some pattern of the UI element /// </summary> /// <param name="properties">the properties of the element</param> /// <param name="automationElement">the AutomationElement</param> private void setPropertiesOfPattern(ref GeneralProperties properties, AutomationElement automationElement) {//https://msdn.microsoft.com/de-de/library/ms750574(v=vs.110).aspx object valuePattern = null; if (automationElement.TryGetCurrentPattern(ValuePattern.Pattern, out valuePattern)) {/* * Conditional Support: Combo Box, Data Item, Edit,Hyperlink, List Item, Progress Bar, Slider,Spinner */ try { properties.valueFiltered = (valuePattern as ValuePattern).Current.Value; } catch (System.NullReferenceException) { } } object rangeValuePattern = null; if (automationElement.TryGetCurrentPattern(RangeValuePattern.Pattern, out rangeValuePattern)) { /* * Conditional Support: Edit, Progress Bar, Scroll Bar, Slider, Spinner */ RangeValue rangeValue = new RangeValue(); rangeValue.isReadOnly = (rangeValuePattern as RangeValuePattern).Current.IsReadOnly; rangeValue.largeChange = (rangeValuePattern as RangeValuePattern).Current.LargeChange; rangeValue.maximum = (rangeValuePattern as RangeValuePattern).Current.Maximum; rangeValue.minimum = (rangeValuePattern as RangeValuePattern).Current.Minimum; rangeValue.smallChange = (rangeValuePattern as RangeValuePattern).Current.SmallChange; rangeValue.currentValue = (rangeValuePattern as RangeValuePattern).Current.Value; properties.rangeValue = rangeValue; } object togglePattern; if (automationElement.TryGetCurrentPattern(TogglePattern.Pattern, out togglePattern)) { ToggleState state = (togglePattern as TogglePattern).Current.ToggleState; if (state == ToggleState.On) { properties.isToggleStateOn = true; } else { if (state == ToggleState.Off) { properties.isToggleStateOn = false; } } } }
private String printProperties(GeneralProperties properties) { String resultString = "Knoten: \n"; Console.WriteLine("\nProperties:"); if (properties.localizedControlTypeFiltered != null) { resultString = resultString + " localizedControlTypeFiltered: " + properties.localizedControlTypeFiltered + "\n"; } if (properties.nameFiltered != null) { resultString = resultString + "nameFiltered: " + properties.nameFiltered + "\n"; } if (properties.boundingRectangleFiltered != null && properties.boundingRectangleFiltered != new System.Windows.Rect()) { resultString = resultString + "boundingRectangleFiltered: " + properties.boundingRectangleFiltered + "\n"; } if (properties.helpTextFiltered != null) { resultString = resultString + "helpTextFiltered: " + properties.helpTextFiltered + "\n"; } if (properties.IdGenerated != null) { resultString = resultString + "IdGenerated: " + properties.IdGenerated + "\n"; } if (properties.hWndFiltered != null) { resultString = resultString + "hWndFiltered: " + properties.hWndFiltered + "\n"; } if (properties.isContentElementFiltered != null) { resultString = resultString + "isContentElementFiltered: " + properties.isContentElementFiltered + "\n"; } if (properties.valueFiltered != null) { resultString = resultString + "valueFiltered: " + properties.valueFiltered + "\n"; } if (properties.grantFilterStrategiesChildren != null) { resultString = resultString + "grantFilterStrategiesChildren" + String.Join(" : ", properties.grantFilterStrategiesChildren.Select(p => p.ToString()).ToArray()); } return(resultString); }
public void Initialize() { GeneralProperties.Analysis = Analysis; GeneralProperties.Initialize(); HourlyTotalsDetail.Analysis = Analysis; HourlyTotalsDetail.Initialize(); DailyTotalsDetail.Analysis = Analysis; DailyTotalsDetail.Initialize(); LogMeter log = Analysis.Log as LogMeter; if (log != null) { LogPropertiesDetail.Log = log; LogPropertiesDetail.Initialize(); } }
/// <summary> /// Generates an id for one node of the filtered tree. /// </summary> /// <param name="node">one filtered node</param> /// <returns>the generated id</returns> private String generatedIdFilteredNode(Object node) { /* https://blogs.msdn.microsoft.com/csharpfaq/2006/10/09/how-do-i-calculate-a-md5-hash-from-a-string/ * http://stackoverflow.com/questions/12979212/md5-hash-from-string * http://stackoverflow.com/questions/10520048/calculate-md5-checksum-for-a-file */ GeneralProperties properties = strategyMgr.getSpecifiedTree().GetData(node).properties; String result = properties.controlTypeFiltered + properties.itemTypeFiltered + properties.accessKeyFiltered + properties.acceleratorKeyFiltered + properties.frameWorkIdFiltered + properties.isContentElementFiltered + properties.isControlElementFiltered + properties.isKeyboardFocusableFiltered + properties.isPasswordFiltered + properties.isRequiredForFormFiltered + properties.itemStatusFiltered + properties.labeledByFiltered + // node.BranchCount + strategyMgr.getSpecifiedTree().BranchIndex(node) + strategyMgr.getSpecifiedTree().Depth(node); if (strategyMgr.getSpecifiedTree().HasParent(node)) { result += strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Parent(node)).properties.IdGenerated; } byte[] hash; using (var md5 = MD5.Create()) { hash = md5.ComputeHash(Encoding.UTF8.GetBytes(result)); } StringBuilder sb = new StringBuilder(); foreach (byte b in hash) { sb.Append(b.ToString("X2")); } String tmpHash = String.Join(" : ", hash.Select(p => p.ToString()).ToArray()); return(sb.ToString()); }
/// <summary> /// Setzt die Beziehung von dem "realen" GUI Element zu dem UI-Element auf der Stiftplatte mit der Id = "braille123_3" /// falls noch kein Baum gefiltert wurde, so wird die Anwendung gefiltert /// </summary> public void setOSMRelationship() { if (grantTree.brailleTree == null) { return; } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); if (grantTree.filteredTree == null) { filterTreeOfApplication(); } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "TextBox"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTree.brailleTree, propertiesForSearch, OperatorEnum.and); if (treeElement.Count > 0) { //für Testzwecke wird einfach das erste Element genutzt // OsmTreeRelationship.addOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_3", ref relationship); // OsmTreeRelationship.addOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_5", ref relationship); treeOperation.osmTreeConnector.setOsmConnection(osmElement.properties.IdGenerated, strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated); // OsmTreeRelationship.setOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_11", ref relationshipList); } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } }
/// <summary> /// Creates all Ui elements to be shown on all screens (in this type of view) /// </summary> /// <param name="pathToXml">path of the used template (XML)</param> /// <param name="typeOfView">name of the type of view in which this elements should be added (current: "SymbolView", "TextView" or "LayoutView")</param> private void createUiElementsAllScreens(String pathToXml, String typeOfView) { XElement xmlDoc = XElement.Load(@pathToXml); if (xmlDoc.Element(typeOfView) == null) { return; } IEnumerable <XElement> uiElement = from el in xmlDoc.Element(typeOfView).Elements("UiElement") where (string)el.Element("Screens") != null && (string)el.Element("Screens") == "" && (string)el.Attribute("name") != Settings.getNavigationbarSubstring() select el; if (uiElement == null || !uiElement.Any()) { return; } List <String> screenList = treeOperation.searchNodes.getPosibleScreenNames(typeOfView); foreach (XElement e in uiElement) { TemplateUiObject templateObject = xmlUiElementToTemplateUiObject(e, typeOfView); Object tree = strategyMgr.getSpecifiedTree().NewTree(); // this is necessary if the braille node has no connection to a filtered node if (templateObject.osm.brailleRepresentation.displayedGuiElementType != null && !templateObject.osm.brailleRepresentation.displayedGuiElementType.Equals("")) { GeneralProperties properties = new GeneralProperties(); properties.controlTypeFiltered = e.Attribute("name").Value; List <Object> treefilteredElements = treeOperation.searchNodes.getNodesByProperties(grantTrees.filteredTree, properties, OperatorEnum.and); foreach (Object t in treefilteredElements) { tree = t; createsBrailleNodeForScreenList(screenList, ref tree, templateObject); } } else { createsBrailleNodeForScreenList(screenList, ref tree, templateObject); } } }
internal String generatedIdFilteredNode(object node, int depth, int branchIndex, String parentId) { GeneralProperties properties = strategyMgr.getSpecifiedTree().GetData(node).properties; String result = properties.controlTypeFiltered + properties.itemTypeFiltered + properties.accessKeyFiltered + properties.acceleratorKeyFiltered + properties.frameWorkIdFiltered + properties.isContentElementFiltered + properties.isControlElementFiltered + properties.isKeyboardFocusableFiltered + properties.isPasswordFiltered + properties.isRequiredForFormFiltered + properties.itemStatusFiltered + properties.labeledByFiltered + // node.BranchCount + branchIndex + depth; if (parentId != null) { result += parentId; } byte[] hash; using (var md5 = MD5.Create()) { hash = md5.ComputeHash(Encoding.UTF8.GetBytes(result)); } StringBuilder sb = new StringBuilder(); foreach (byte b in hash) { sb.Append(b.ToString("X2")); } String tmpHash = String.Join(" : ", hash.Select(p => p.ToString()).ToArray()); return(sb.ToString()); }
internal void update() { try { if (strategyMgr.getSpecifiedBrailleDisplay() == null || grantTrees == null || grantTrees.filteredTree == null || grantTrees.brailleTree == null || grantTrees.osmTreeConnections == null) { return; } if (!strategyMgr.getSpecifiedTree().HasChild(grantTrees.filteredTree)) { return; } GeneralProperties prop1Node = strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(grantTrees.filteredTree)).properties; if (prop1Node.hWndFiltered == null || prop1Node.hWndFiltered.Equals(IntPtr.Zero)) { return; } treeOperation.updateNodes.filteredTreeOfApplication(prop1Node.hWndFiltered); treeOperation.updateNodes.updateBrailleGroups(); Object tree = grantTrees.brailleTree; foreach (Object o in strategyMgr.getSpecifiedTree().AllChildrenNodes(tree)) { OSMElements.OSMElement osm = strategyMgr.getSpecifiedTree().GetData(o); if ((!osm.brailleRepresentation.isGroupChild || osm.brailleRepresentation.groupelementsOfSameType.renderer == null) && !osm.properties.boundingRectangleFiltered.Equals(new Rect())) { treeOperation.updateNodes.updateNodeOfBrailleUi(ref osm); strategyMgr.getSpecifiedBrailleDisplay().updateViewContent(ref osm); } } strategyMgr.getSpecifiedBrailleDisplay().generatedBrailleUi(); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } }
private void createBrailleGroupFromFilteredNode(object filteredNode, ref int startYPosition) { //Erst einen eigenen Teilbaum mit allen Kindern erzeugen und diesen anschließend dem Braille-Baum hinzufügen OSMElements.OSMElement osmGroup = new OSMElements.OSMElement(); osmGroup.brailleRepresentation.isVisible = true; osmGroup.properties.controlTypeFiltered = "GroupElement"; osmGroup.brailleRepresentation.typeOfView = grantTrees.TextviewObject.typeOfView; osmGroup.brailleRepresentation.screenName = grantTrees.TextviewObject.screenName; OSMElements.OSMElement osmFiltered = strategyMgr.getSpecifiedTree().GetData(filteredNode); osmGroup.brailleRepresentation.viewName = osmFiltered.properties.IdGenerated; int depth = strategyMgr.getSpecifiedTree().Depth(filteredNode) * shiftingPerDepth; int startXPosition = depth; osmGroup.properties.boundingRectangleFiltered = new Rect(startXPosition, startYPosition, 120 - startXPosition, 5);//TODO: richtig machen osmGroup.properties.IdGenerated = treeOperation.generatedIds.generatedIdBrailleNode(osmGroup); String brailleParentId = null; if (treeOperation.searchNodes.getBrailleTreeOsmElementById(osmGroup.properties.IdGenerated).Equals(new OSMElements.OSMElement())) { object parent = strategyMgr.getSpecifiedTree().Parent(filteredNode); if (parent != null && strategyMgr.getSpecifiedTree().GetData(parent) != null) { List <string> ids = treeOperation.searchNodes.getConnectedBrailleTreenodeIds(strategyMgr.getSpecifiedTree().GetData(parent).properties.IdGenerated); if (ids != null && ids.Count > 0) {//die richtige Id raussuchen (screen & typeOfView) //parent (Groupelement) foreach (String id in ids) { List <Object> nodeList = treeOperation.searchNodes.getNodeList(id, grantTrees.brailleTree); if (nodeList != null && nodeList.Count > 0) { foreach (object o in nodeList) { Object parentGroupelement = strategyMgr.getSpecifiedTree().Parent(o); OSMElements.OSMElement osmTmp = strategyMgr.getSpecifiedTree().GetData(parentGroupelement); if (osmTmp.brailleRepresentation.screenName.Equals(grantTrees.TextviewObject.screenName) && osmTmp.brailleRepresentation.typeOfView.Equals(grantTrees.TextviewObject.typeOfView)) { brailleParentId = strategyMgr.getSpecifiedTree().GetData(parentGroupelement).properties.IdGenerated; break; } } } if (brailleParentId != null) { break; } } } } // osmGroup.properties.IdGenerated = treeOperation.updateNodes.addNodeInBrailleTree(osmGroup, brailleParentId);//hier wird ggf. nur das Gruppen-(Start-)Element hinzugefügt String idResult = treeOperation.updateNodes.addNodeInBrailleTree(osmGroup, brailleParentId);//hier wird ggf. nur das Gruppen-(Start-)Element hinzugefügt if (idResult == null) { return; } } Object brailleSubtree = strategyMgr.getSpecifiedTree().NewTree(); Object brailleSubtreeParent = strategyMgr.getSpecifiedTree().AddChild(brailleSubtree, osmGroup); List <TextviewElement> order; SpecialOrder so = textViewspecialOrderContainsControltype(osmFiltered.properties.controlTypeFiltered); if (!so.Equals(new SpecialOrder())) { order = so.order; } else { order = grantTrees.TextviewObject.orders.defaultOrder; } foreach (TextviewElement tve in order) { #region Zeichen für Beginn der Aufzählung if (grantTrees.TextviewObject.itemEnumerate != null && !grantTrees.TextviewObject.itemEnumerate.Equals("") && tve.order == 0) { strategyMgr.getSpecifiedTree().AddChild(brailleSubtreeParent, addSeparatorElementInBrailleTree(grantTrees.TextviewObject.itemEnumerate, ref startXPosition, startYPosition)); startXPosition += grantTrees.TextviewObject.itemEnumerate.Length * 3 + 2; } #endregion #region Separator if (tve.separator != null && !tve.separator.Equals("") && tve.order > 0) { strategyMgr.getSpecifiedTree().AddChild(brailleSubtreeParent, addSeparatorElementInBrailleTree(tve.separator, ref startXPosition, startYPosition)); startXPosition += tve.separator.Length * 3 + 2; } #endregion object objectText = GeneralProperties.getPropertyElement(tve.property, osmFiltered.properties); String text = (objectText != null ? objectText.ToString() : null); text = treeOperation.updateNodes.useAcronymForText(text); int width = (text.Length * 3) < tve.minWidth ? tve.minWidth : (text.Length * 3); strategyMgr.getSpecifiedTree().AddChild(brailleSubtreeParent, addElementInBrailleTree(filteredNode, tve, width, ref startXPosition, startYPosition)); startXPosition += width + 2; } startYPosition += 5; addSubtreeInBrailleTree(strategyMgr.getSpecifiedTree().Root(brailleSubtreeParent), brailleParentId); }
/// <summary> /// Initialisiert, sofern nochnicht vorhanden, ein Ausgabegerät mit den angegebenen Ansichten; /// Aktualisiert die Darstellung des Knotens "braille123_6" /// </summary> /// <param name="fromGuiElement">gibt an welche <code>GeneralProperties</code>-Eigenschaft angezeigt werden soll</param> public void UiBrailleDis(String fromGuiElement) { try { // String path = @"Templates" + System.IO.Path.DirectorySeparatorChar + "TemplateUi.xml"; String path = @"C:\Users\mkarlapp\Desktop\TemplateUi2.xml"; // setDauGui(displayedGuiElementType); /* ITreeStrategy<OSMElement.OSMElement> subtreeNav = strategyMgr.getSpecifiedTreeOperations().getSubtreeOfScreen("A1"); * if (subtreeNav != null && subtreeNav.Count > 0) * { * ui.addNavigationbarForScreen(path, subtreeNav); * } * GuiFunctions guiFuctions = new GuiFunctions(strategyMgr, grantTrees); * if (guiFuctions.isTemplateUsableForDevice(path)) * { * ui.createUiElementsAllScreensSymbolView(path); * // ui.createUiElementsNavigationbarScreensSymbolView(path); * ui.updateNavigationbarScreens(path); * * }*/ treeOperation.updateNodes.updateBrailleGroups(); if (strategyMgr.getSpecifiedBrailleDisplay() == null) { Settings settings = new Settings(); strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className); // muss dynamisch ermittelt werden strategyMgr.getSpecifiedBrailleDisplay().setStrategyMgr(strategyMgr); strategyMgr.getSpecifiedBrailleDisplay().setGeneratedGrantTrees(grantTrees); strategyMgr.getSpecifiedBrailleDisplay().setTreeOperation(treeOperation); // strategyMgr.getSpecifiedBrailleDisplay().initializedSimulator(); strategyMgr.getSpecifiedBrailleDisplay().setActiveAdapter(); strategyMgr.getSpecifiedBrailleDisplay().generatedBrailleUi(); } else { if (!strategyMgr.getSpecifiedBrailleDisplay().isInitialized()) { strategyMgr.getSpecifiedBrailleDisplay().setActiveAdapter(); strategyMgr.getSpecifiedBrailleDisplay().generatedBrailleUi(); } } strategyMgr.getSpecifiedBrailleDisplay().generatedBrailleUi(); if (grantTrees.osmTreeConnections == null) { List <OsmTreeConnectorTuple> relationship = ExampleTree.setOsmRelationship(); grantTrees.osmTreeConnections = relationship; } else { if (grantTrees.filteredTree == null) { Console.WriteLine("Die Anwendung wurde noch nicht gefiltert - bitte 'F5' drücken"); return; } GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "TextBox"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTrees.brailleTree, propertiesForSearch, OperatorEnum.and); String brailleId = ""; if (treeElement.Count > 0) { brailleId = strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated; } if (brailleId.Equals("")) { return; } OsmTreeConnectorTuple osmRelationships = grantTrees.osmTreeConnections.Find(r => r.BrailleTreeId.Equals(brailleId) || r.FilteredTreeId.Equals(brailleId)); if (osmRelationships != null) { //strategyMgr.getSpecifiedFilter().updateNodeOfFilteredTree(osmRelationships.FilteredTree); treeOperation.updateNodes.filteredNodeElementOfApplication(osmRelationships.FilteredTreeId); OSMElements.OSMElement relatedBrailleTreeObject = treeOperation.searchNodes.getBrailleTreeOsmElementById(osmRelationships.BrailleTreeId); if (!relatedBrailleTreeObject.Equals(new OSMElements.OSMElement())) { treeOperation.updateNodes.updateNodeOfBrailleUi(ref relatedBrailleTreeObject); strategyMgr.getSpecifiedBrailleDisplay().updateViewContent(ref relatedBrailleTreeObject); } } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } }
public IBuilder UseGeneralProperties(GeneralProperties properties) { ApplyParameters(properties); return(this); }
protected override Object createSpecialUiElement(Object filteredSubtree, TemplateUiObject templateObject, String brailleNodeId = null) { OSMElements.OSMElement brailleNode = templateObject.osm; GeneralProperties prop = templateObject.osm.properties; BrailleRepresentation braille = templateObject.osm.brailleRepresentation; prop.isEnabledFiltered = false; braille.isVisible = true; #region DropDownMenuItem if (templateObject.osm.properties.controlTypeFiltered.Equals("DropDownMenuItem")) { OSMElements.UiElements.DropDownMenuItem dropDownMenu = new OSMElements.UiElements.DropDownMenuItem(); if (strategyMgr.getSpecifiedTree().HasChild(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasChild = true; } if (strategyMgr.getSpecifiedTree().HasNext(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Next(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasNext = true; } if (strategyMgr.getSpecifiedTree().HasPrevious(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Previous(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.hasPrevious = true; } if (strategyMgr.getSpecifiedTree().HasParent(filteredSubtree) && strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Parent(filteredSubtree)).properties.controlTypeFiltered.Contains("Item")) { dropDownMenu.isChild = true; } dropDownMenu.isOpen = false; dropDownMenu.isVertical = false; braille.uiElementSpecialContent = dropDownMenu; } #endregion #region TabItem if (templateObject.osm.properties.controlTypeFiltered.Equals("TabItem")) { OSMElements.UiElements.TabItem tabView = new OSMElements.UiElements.TabItem(); tabView.orientation = templateObject.orientation; braille.uiElementSpecialContent = tabView; //braille.uiElementSpecialContent = templateObject.osm.brailleRepresentation.uiElementSpecialContent; } #endregion if (templateObject.Screens == null) { Debug.WriteLine("Achtung, hier wurde kein Screen angegeben!"); return(strategyMgr.getSpecifiedTree().NewTree()); } braille.screenName = templateObject.Screens[0]; // hier wird immer nur ein Screen-Name übergeben if (!templateObject.allElementsOfType || !treeOperation.searchNodes.existViewInScreen(braille.screenName, templateObject.viewName, templateObject.osm.brailleRepresentation.typeOfView)) { braille.viewName = templateObject.viewName; } else { int i = 0; String viewName = templateObject.viewName + "_" + i; while (treeOperation.searchNodes.existViewInScreen(braille.screenName, viewName, templateObject.osm.brailleRepresentation.typeOfView)) { i++; viewName += i; } braille.viewName = viewName; } brailleNode.properties = prop; brailleNode.brailleRepresentation = braille; Object tree = strategyMgr.getSpecifiedTree().NewTree(); strategyMgr.getSpecifiedTree().AddChild(tree, brailleNode); return(tree); }
/// <summary> /// Creats the condition to search an AutomationElemente depending on <see cref="GeneralProperties"/> object /// </summary> /// <param name="properties">the properties to search</param> /// <returns>a Condition object</returns> private Condition setPropertiesCondition(GeneralProperties properties) { Condition resultCondition; #region Readable from all resultCondition = new PropertyCondition(AutomationElement.ClassNameProperty, properties.classNameFiltered); // ... ? #endregion if (properties.localizedControlTypeFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, properties.localizedControlTypeFiltered), resultCondition); } if (properties.acceleratorKeyFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.AcceleratorKeyProperty, properties.acceleratorKeyFiltered), resultCondition); } if (properties.accessKeyFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.AccessKeyProperty, properties.accessKeyFiltered), resultCondition); } if (properties.runtimeIDFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.RuntimeIdProperty, properties.runtimeIDFiltered), resultCondition); } if (properties.frameWorkIdFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.FrameworkIdProperty, properties.frameWorkIdFiltered), resultCondition); } if (properties.isContentElementFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.IsContentElementProperty, properties.isContentElementFiltered), resultCondition); } if (properties.labeledByFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.LabeledByProperty, properties.labeledByFiltered), resultCondition); } if (properties.isControlElementFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.IsControlElementProperty, properties.isControlElementFiltered), resultCondition); } if (properties.isPasswordFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.IsPasswordProperty, properties.isPasswordFiltered), resultCondition); } if (properties.itemTypeFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.ItemTypeProperty, properties.itemTypeFiltered), resultCondition); } if (properties.itemStatusFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.ItemStatusProperty, properties.itemStatusFiltered), resultCondition); } if (properties.isRequiredForFormFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.IsRequiredForFormProperty, properties.isRequiredForFormFiltered), resultCondition); } if (properties.autoamtionIdFiltered != null) { resultCondition = new AndCondition(new PropertyCondition(AutomationElement.AutomationIdProperty, properties.autoamtionIdFiltered), resultCondition); } //.. return(resultCondition); }
/// <summary> /// Sets the supported pattern of the UI element /// </summary> /// <param name="properties">the properties of the element</param> /// <param name="automationElement">the AutomationElement</param> private void setSupportedPatterns(ref GeneralProperties properties, AutomationElement automationElement) { properties.suportedPatterns = automationElement.GetSupportedPatterns().Select(p => p.ProgrammaticName).ToArray(); // automationElement.GetSupportedPatterns().ToArray(); }
/// <summary> /// todo /// AutomationElement-properties to <see cref="OSMElements.GeneralProperties"/> /// Desweiteren stellt sich die frage, ob cached abgefragt wird, oder current, wegen geschwindigekti der abfrage /// </summary> /// <param name="automationElement">the AutomationElement</param> /// <returns>A <see cref="GeneralProperties"/> object with the properties of the AutomationELement</returns> private GeneralProperties setProperties(AutomationElement automationElement) { GeneralProperties elementP = new GeneralProperties(); elementP.grantFilterStrategy = Settings.filterStrategyTypeToUserName(this.GetType()); /* elementP.grantFilterStrategiesChildren = new List<string>(); * elementP.grantFilterStrategiesChildren.Add(elementP.grantFilterStrategy);*/ try { elementP.acceleratorKeyFiltered = automationElement.Current.AcceleratorKey; } catch (Exception a) { Console.WriteLine("Property: (Accelerator) '{0}'", a.ToString()); } try { elementP.accessKeyFiltered = automationElement.Current.AccessKey; } catch (Exception a) { Console.WriteLine("Property: (AccessKey) '{0}'", a.ToString()); } try { elementP.autoamtionIdFiltered = automationElement.Current.AutomationId; } catch (Exception a) { Console.WriteLine("Property: (AutomationId) '{0}'", a.ToString()); } try { if (!automationElement.Current.BoundingRectangle.IsEmpty) //Note: if BoundingRectangle == Empty =>There are problems reading the data from the XML file (XmlDeserialize) { elementP.boundingRectangleFiltered = automationElement.Current.BoundingRectangle; } } catch (Exception a) { Console.WriteLine("Property: (BoundingRectangle) '{0}'", a.ToString()); } try { elementP.classNameFiltered = automationElement.Current.ClassName; } catch (Exception a) { Console.WriteLine("Property: (ClassName) '{0}'", a.ToString()); } try { String[] t = automationElement.Current.ControlType.ProgrammaticName.Split(new String[] { "." }, StringSplitOptions.RemoveEmptyEntries); elementP.controlTypeFiltered = t[1]; } catch (Exception a) { Console.WriteLine("Property: (LocalizedControlType) '{0}'", a.ToString()); } try { elementP.frameWorkIdFiltered = automationElement.Current.FrameworkId; } catch (Exception a) { Console.WriteLine("Property: (FrameworkId) '{0}'", a.ToString()); } try { elementP.hasKeyboardFocusFiltered = automationElement.Current.HasKeyboardFocus; } catch (Exception a) { Console.WriteLine("Property: (HasKeyboardFocus) '{0}'", a.ToString()); } try { elementP.helpTextFiltered = automationElement.Current.HelpText; } catch (Exception a) { Console.WriteLine("Property: (HelpText) '{0}'", a.ToString()); } try { elementP.hWndFiltered = new IntPtr(automationElement.Current.NativeWindowHandle); } catch (Exception a) { Console.WriteLine("Property: (NativeWindowHandle) '{0}'", a.ToString()); } try { elementP.isContentElementFiltered = automationElement.Current.IsContentElement; } catch (Exception a) { Console.WriteLine("Property: (IsContentElement) '{0}'", a.ToString()); } try { elementP.isControlElementFiltered = automationElement.Current.IsControlElement; } catch (Exception a) { Console.WriteLine("Property: (IsControlElement) '{0}'", a.ToString()); } try { elementP.isEnabledFiltered = automationElement.Current.IsEnabled; } catch (Exception a) { Console.WriteLine("Property: (IsEnabled) '{0}'", a.ToString()); } try { elementP.isKeyboardFocusableFiltered = automationElement.Current.IsKeyboardFocusable; } catch (Exception a) { Console.WriteLine("Property: (IsKeyboardFocusable) '{0}'", a.ToString()); } try { elementP.isOffscreenFiltered = automationElement.Current.IsOffscreen; } catch (Exception a) { Console.WriteLine("Property: (IsOffscreen) '{0}'", a.ToString()); } try { elementP.isPasswordFiltered = automationElement.Current.IsPassword; } catch (Exception a) { Console.WriteLine("Property: (IsPassword) '{0}'", a.ToString()); } try { elementP.isRequiredForFormFiltered = automationElement.Current.IsRequiredForForm; } catch (Exception a) { Console.WriteLine("Property: (IsRequiredForForm) '{0}'", a.ToString()); } try { elementP.itemStatusFiltered = automationElement.Current.ItemStatus; } catch (Exception a) { Console.WriteLine("Property: (ItemStatus) '{0}'", a.ToString()); } try { elementP.itemTypeFiltered = automationElement.Current.ItemType; } catch (Exception a) { Console.WriteLine("Property: (ItemType) '{0}'", a.ToString()); } try { elementP.runtimeIDFiltered = automationElement.GetRuntimeId(); } catch (Exception a) { Console.WriteLine("Property: (runtime) '{0}'", a.ToString()); } try { elementP.localizedControlTypeFiltered = automationElement.Current.LocalizedControlType; } catch (Exception a) { Console.WriteLine("Property: (LocalizedControlType) '{0}'", a.ToString()); } try { elementP.nameFiltered = automationElement.Current.Name; } catch (Exception a) { Console.WriteLine("Property: (Name) '{0}'", a.ToString()); } try { elementP.processIdFiltered = automationElement.Current.ProcessId; } catch (Exception a) { Console.WriteLine("Property: (ProcessId) '{0}'", a.ToString()); } setPropertiesOfPattern(ref elementP, automationElement); setSupportedPatterns(ref elementP, automationElement); return(elementP); }