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); } } } }
private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.F1) { exampleInspectGui.inspect(); String element = exampleTree.filterNodeOfApplicatione(); NodeBox.Text = element; } if (e.Key == Key.F2) { List <String> result = exampleBrailleDis.getPosibleScreens(); NodeBox.Text = "Mögliche Screens: \n"; NodeBox.Text = result != null ? NodeBox.Text + String.Join(", ", result.Select(p => p.ToString()).ToArray()) : ""; } if (e.Key == Key.F3) { exampleBrailleDis.changeScreen(Screen.Text); } if (e.Key == Key.F4) { exampleBrailleDis.update(); } if (e.Key == Key.F5) { NodeBox.Text = exampleDisplay.allDevices(); } if (e.Key == Key.F6) { NodeBox.Text = exampleDisplay.deviceInfo(); } if (e.Key == Key.F7) { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { //Filtermethode IntPtr points = strategyMgr.getSpecifiedOperationSystem().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(grantTree); strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation); } guiFunctions.deleteGrantTrees(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); grantTree.filteredTree = filterStrategy.filtering(strategyMgr.getSpecifiedOperationSystem().getProcessHwndFromHwnd(filterStrategy.deliverElementID(points))); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } }