Пример #1
0
        public String filterSubtreeOfApplication()
        {
            if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition())
            {
                try
                {
                    IntPtr          points         = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition();
                    IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
                    int             pointX;
                    int             pointY;
                    strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY);
                    Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Descendants, -1);
                    if (grantTree.filteredTree != null)
                    {
                        List <Object> result = treeOperation.searchNodes.getNodesByProperties(grantTree.filteredTree, strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties, OperatorEnum.and);
                        if (result.Count == 1)
                        {
                            GuiFunctions guiFunctions = new GuiFunctions(strategyMgr, grantTree, treeOperation);
                            treeOperation.updateNodes.filterSubtreeWithCurrentFilterStrtegy(strategyMgr.getSpecifiedTree().GetData(result[0]).properties.IdGenerated);

                            // guiFunctions.filterAndAddSubtreeOfApplication(strategyMgr.getSpecifiedTreeOperations().getFilteredTreeOsmElementById("7CA0B5B9845D7906E3BD235A600F3546"));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occurred: '{0}'", ex);
                }
            }
            return("");
        }
Пример #2
0
        public String filterNodeOfApplicatione()
        {
            if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition())
            {
                try
                {
                    IntPtr          points         = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition();
                    IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
                    int             pointX;
                    int             pointY;
                    strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY);
                    Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Element, 0);

                    /*  if (grantTree.filteredTree != null)
                     * {
                     *    treeOperation.updateNodes.changePropertiesOfFilteredNode(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties);
                     * }*/
                    // strategyMgr.getSpecifiedTreeOperations().printTreeElements(tree, -1);
                    if (strategyMgr.getSpecifiedTree().HasChild(tree) == true)
                    {
                        return(printProperties(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties));
                    }
                    return("");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occurred: '{0}'", ex);
                }
            }
            return("");
        }
Пример #3
0
        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);
                    }
                }
            }
        }
Пример #4
0
 public void filterTreeOfApplication()
 {
     if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition())
     {
         try
         {
             IntPtr          points         = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition();
             IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
             // filterStrategy.setStrategyMgr(strategyMgr);
             //ITreeStrategy<OSMElement.OSMElement> tree1 = filterStrategy.filtering(operationSystemStrategy.getProcessHwndFromHwnd(filterStrategy.deliverElementID(points)));
             // strategyMgr.setFilteredTree(tree1);
             int pointX;
             int pointY;
             strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY);
             Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Application);
             // strategyMgr.getSpecifiedTreeOperations().printTreeElements(parentBrailleTreeNode, -1);
             grantTree.filteredTree = tree;
         }
         catch (Exception ex)
         {
             Console.WriteLine("An error occurred: '{0}'", ex);
         }
     }
 }
Пример #5
0
        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);
                    }
                }
            }
        }