void filteredTreeOutput_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { NodeButton.IsEnabled = true; var tree = sender as TreeView; // ... Determine typeOfTemplate of SelectedItem. if (tree.SelectedItem is TreeViewItem) { // ... Handle a TreeViewItem. TreeViewItem item = tree.SelectedItem as TreeViewItem; if (item.Header is GuiFunctions.MenuItem && ((GuiFunctions.MenuItem)item.Header).IdGenerated != null) { updatePropertiesTable(((GuiFunctions.MenuItem)item.Header).IdGenerated); } else { GuiFunctions.clearTable(filteredTreeProp); } //Methode MenuItem übergeben - tabelle } else if (tree.SelectedItem is string) { // ... Handle a string. Console.WriteLine("Fehler: "); } }
private void ExternalScreenreader_Click(object sender, RoutedEventArgs e) { OSMElements.OSMElement osm = strategyMgr.getSpecifiedExternalScreenreader().getScreenreaderContent(); if (osm != null) { treeOperations.updateNodes.addNodeExternalScreenreaderInFilteredTree(osm); filteredTreeOutput.Items.Clear(); root.Items.Clear(); // root.Header = "Filtered - Tree"; guiFunctions.createTreeForOutput(grantTrees.filteredTree, ref root); SaveButton.IsEnabled = true; filteredTreeOutput.Items.Add(root); NodeButton.IsEnabled = false; /* updatePropertiesTable(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(grantTrees.filteredTree)).properties.IdGenerated); * ((TreeViewItem)filteredTreeOutput.Items[0]).IsSelected = true; * ((TreeViewItem)filteredTreeOutput.Items[0]).IsExpanded = true;*/ GuiFunctions.clearTable(filteredTreeProp); } else { System.Diagnostics.Debug.WriteLine("Can't find content from an external screenreader!"); } }
private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { IOperationSystemStrategy operationSystemStrategy = strategyMgr.getSpecifiedOperationSystem(); ITreeStrategy <OSMElements.OSMElement> treeStrategy = strategyMgr.getSpecifiedTree(); if (e.Key == Key.F1) { if (operationSystemStrategy.deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); int pointX; int pointY; operationSystemStrategy.getCursorPoint(out pointX, out pointY); Console.WriteLine("Pointx: " + pointX); Console.WriteLine("Pointy: " + pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); System.Drawing.Rectangle rect = operationSystemStrategy.getRect(osmElement); if (osmElement.properties.isOffscreenFiltered == false) { operationSystemStrategy.paintRect(rect); } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } if (e.Key == Key.F5) { if (operationSystemStrategy.deliverCursorPosition()) { try { //Filtermethode IntPtr points = operationSystemStrategy.getHWNDByCursorPosition(); List <Strategy> possibleFilter = Settings.getPossibleFilters(); if (strategyMgr.getSpecifiedFilter() == null) { // auslesen aus GUI..... String cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName)); strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees); strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperations); } guiFunctions.deleteGrantTrees(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); Object tree = filterStrategy.filtering(operationSystemStrategy.getProcessHwndFromHwnd(filterStrategy.deliverElementID(points))); grantTrees.filteredTree = tree; filteredTreeOutput.Items.Clear(); root.Items.Clear(); root.Header = "Filtered - Tree"; guiFunctions.createTreeForOutput(tree, ref root); SaveButton.IsEnabled = true; filteredTreeOutput.Items.Add(root); NodeButton.IsEnabled = false; /* updatePropertiesTable(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties.IdGenerated); * ((TreeViewItem)filteredTreeOutput.Items[0]).IsSelected = true; * ((TreeViewItem)filteredTreeOutput.Items[0]).IsExpanded = true;*/ GuiFunctions.clearTable(filteredTreeProp); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } }