예제 #1
0
        /// <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);
                }
            }
        }
예제 #2
0
        /// <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);
                }
            }
        }
예제 #3
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);
                    }
                }
            }
        }