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> /// Delete an OSM connection /// </summary> /// <param name="idFilteredTree">id of the filtered node</param> /// <param name="idBrailleTree">id of the braille node</param> public void removeOsmConnection(String idFilteredTree, String idBrailleTree) { if (grantTrees.osmTreeConnections.Exists(r => r.BrailleTreeId.Equals(idBrailleTree) && r.FilteredTreeId.Equals(idFilteredTree))) { OsmTreeConnectorTuple relationshipToRemove = grantTrees.osmTreeConnections.Find(r => r.BrailleTreeId.Equals(idBrailleTree) && r.FilteredTreeId.Equals(idFilteredTree)); grantTrees.osmTreeConnections.Remove(relationshipToRemove); } else { Debug.WriteLine("The connection dosn't exist!"); } }
/// <summary> /// Retuns the connected filtered node to a specified (braille node) id /// </summary> /// <param name="idGeneratedBrailleNode">id of the node in the braille tree</param> /// <returns>id of the connected filtered tree node or <c>null</c></returns> public String getConnectedFilteredTreenodeId(String idGeneratedBrailleNode) { OsmTreeConnectorTuple osmRelationship = grantTrees.osmTreeConnections.Find(r => r.BrailleTreeId.Equals(idGeneratedBrailleNode)); if (osmRelationship != null) { return(osmRelationship.FilteredTreeId); } else { return(null); } }
/// <summary> /// Sets OSM connections and delets the old ones (filtered Tree <--> braille tree) /// </summary> /// <param name="idFilteredTree">id of the filtered node</param> /// <param name="idBrailleTree">id of the braille node</param> public void setOsmConnection(String idFilteredTree, String idBrailleTree) { if (idFilteredTree == null || idBrailleTree == null) { Debug.WriteLine("One of the ids dosn't exist! The relationship wasn't set."); return; } // deletes all old connections grantTrees.osmTreeConnections.Clear(); OsmTreeConnectorTuple relationship = new OsmTreeConnectorTuple(); relationship.BrailleTreeId = idBrailleTree; relationship.FilteredTreeId = idFilteredTree; grantTrees.osmTreeConnections.Add(relationship); }
/// <summary> /// Adds an OSM connection (filtered Tree <--> braille tree) /// </summary> /// <param name="idFilteredTree">id of the filtered node</param> /// <param name="idBrailleTree">id of the braille node</param> public void addOsmConnection(String idFilteredTree, String idBrailleTree) { //TODO: evtl. noch prüfen, ob die Ids existieren if (idFilteredTree == null || idBrailleTree == null) { Debug.WriteLine("One of the ids dosn't exist! The relationship wasn't set."); return; } //checks whether the connection already exists if (!grantTrees.osmTreeConnections.Exists(r => r.BrailleTreeId.Equals(idBrailleTree) && r.FilteredTreeId.Equals(idFilteredTree))) { OsmTreeConnectorTuple relationship = new OsmTreeConnectorTuple(); relationship.BrailleTreeId = idBrailleTree; relationship.FilteredTreeId = idFilteredTree; grantTrees.osmTreeConnections.Add(relationship); } }
/* private List<OsmConnector<String, String>> setOsmConnection(String guiID) * { * if (strategyMgr.osmRelationship == null) * { * //List<OsmConnector<String, String>> relationships = new List<OsmConnector<String, String>>(); * strategyMgr.setOsmConnection(new List<OsmConnector<String, String>>()); * } * OsmConnector<String, String> r3 = new OsmConnector<String, String>(); * r3.FilteredTree = guiID; * r3.BrailleTree = "braille123_3"; * strategyMgr.osmRelationship.Add(r3); * // relationships.Add(r3); * return strategyMgr.osmRelationship; * }*/ public static List <OsmTreeConnectorTuple> setOsmRelationship() { List <OsmTreeConnectorTuple> relationships = new List <OsmTreeConnectorTuple>(); OsmTreeConnectorTuple r1 = new OsmTreeConnectorTuple(); r1.FilteredTreeId = "461FD37218F2E2BCBE4C5486629A2FC6"; //Notepad; r1.BrailleTreeId = "braille123_1"; OsmTreeConnectorTuple r2 = new OsmTreeConnectorTuple(); r2.FilteredTreeId = "gui123_2"; r2.BrailleTreeId = "braille123_2"; OsmTreeConnectorTuple r3 = new OsmTreeConnectorTuple(); r3.FilteredTreeId = "6941463181BDAA498DBC02B4164EF1AA"; r3.BrailleTreeId = "braille123_3"; relationships.Add(r1); // relationships.Add(r2); relationships.Add(r3); return(relationships); }
/// <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); } }
internal void removeOsmConnection(OsmTreeConnectorTuple connectionToDel) { grantTrees.osmTreeConnections.Remove(connectionToDel); }