示例#1
0
        private void UiElement_OnSelected(UiElement uiElement)
        {
            // Get the window title to identify the element from Name/AutomationId
            string title = UIAutomationCommon.GetRootWindowTitle(UiCommon.GetForegroundWindow());

            setPropertyValue("WindowTitle", new InArgument <string>(title));

            var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile();

            setPropertyValue("SourceImgPath", screenshotsPath);
            setPropertyValue("AutomationId", new InArgument <string>(uiElement.AutomationId));
            setPropertyValue("Name", new InArgument <string>(uiElement.Name));
            setPropertyValue("Selector", new InArgument <string>(uiElement.Selector));
            grid1.Visibility = System.Windows.Visibility.Hidden;
            setPropertyValue("visibility", System.Windows.Visibility.Visible);
            InArgument <Int32> _offsetX = uiElement.GetClickablePoint().X;
            InArgument <Int32> _offsetY = uiElement.GetClickablePoint().Y;

            setPropertyValue("offsetX", _offsetX);
            setPropertyValue("offsetY", _offsetY);
            string displayName = getPropertyValue("_DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\"";

            setPropertyValue("DisplayName", displayName);
            InArgument <Int32> _Left = uiElement.BoundingRectangle.Left;

            setPropertyValue("Left", _Left);
            InArgument <Int32> _Right = uiElement.BoundingRectangle.Right;

            setPropertyValue("Right", _Right);
            InArgument <Int32> _Top = uiElement.BoundingRectangle.Top;

            setPropertyValue("Top", _Top);
            InArgument <Int32> _Bottom = uiElement.BoundingRectangle.Bottom;

            setPropertyValue("Bottom", _Bottom);
        }
示例#2
0
        private void UiElement_OnSelected(UiElement uiElement)
        {
            // Get the window title to identify the element from Name/AutomationId
            string title = UIAutomationCommon.GetRootWindowTitle(UiCommon.GetForegroundWindow());

            setPropertyValue("WindowTitle", new InArgument <string>(title));

            var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile();

            navigateTextBlock.Visibility = System.Windows.Visibility.Hidden;
            setPropertyValue("SourceImgPath", screenshotsPath);
            setPropertyValue("AutomationId", new InArgument <string>(uiElement.AutomationId));
            setPropertyValue("Name", new InArgument <string>(uiElement.Name));
            setPropertyValue("Selector", new InArgument <string>(uiElement.Selector));
            setPropertyValue("visibility", System.Windows.Visibility.Visible);
            InArgument <Int32> _offsetX = uiElement.GetClickablePoint().X;
            InArgument <Int32> _offsetY = uiElement.GetClickablePoint().Y;

            setPropertyValue("offsetX", _offsetX);
            setPropertyValue("offsetY", _offsetY);
            string displayName = getPropertyValue("DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\"";

            setPropertyValue("DisplayName", displayName);
        }