/// <summary> /// 热键选中元素后触发 /// </summary> /// <param name="uiElement">元素</param> private void UiElement_OnKeyboardHotKeySelected(UiElement uiElement) { IsRecorded = true; m_view.WindowState = WindowState.Normal; m_view.Topmost = true; Type _type = Type.GetType("RPA.UIAutomation.Activities.Keyboard.HotKeyActivity,RPA.UIAutomation.Activities"); dynamic activity = Activator.CreateInstance(_type); activity.SourceImgPath = uiElement.CaptureInformativeScreenshotToFile(); activity.Selector = uiElement.Selector; activity.visibility = System.Windows.Visibility.Visible; activity.offsetX = uiElement.GetClickablePoint().X; activity.offsetY = uiElement.GetClickablePoint().Y; var append_displayName = " \"" + uiElement.ProcessName + " " + uiElement.Name + "\""; stuActivityInfo info = new stuActivityInfo(); info.activity = activity; info.postAction = (modelItem) => { modelItem.Properties["DisplayName"].SetValue(modelItem.Properties["DisplayName"].Value + append_displayName); }; m_activityRecordingList.Add(info); }
/////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// 进行实际的鼠标选择 /// </summary> /// <param name="uiElement">ui元素</param> /// <param name="type">类型</param> /// <param name="action">活动</param> private void DoMouseSelect(UiElement uiElement, string type, Action <object> action = null) { IsRecorded = true; m_view.WindowState = WindowState.Normal; m_view.Topmost = true; Type _type = Type.GetType($"RPA.UIAutomation.Activities.Mouse.{type},RPA.UIAutomation.Activities"); dynamic activity = Activator.CreateInstance(_type); action?.Invoke(activity); activity.SourceImgPath = uiElement.CaptureInformativeScreenshotToFile(); activity.Selector = uiElement.Selector; activity.visibility = System.Windows.Visibility.Visible; activity.offsetX = uiElement.GetClickablePoint().X; activity.offsetY = uiElement.GetClickablePoint().Y; activity.Left = uiElement.BoundingRectangle.Left; activity.Right = uiElement.BoundingRectangle.Right; activity.Top = uiElement.BoundingRectangle.Top; activity.Bottom = uiElement.BoundingRectangle.Bottom; var append_displayName = " \"" + uiElement.ProcessName + " " + uiElement.Name + "\""; stuActivityInfo info = new stuActivityInfo(); info.activity = activity; info.postAction = (modelItem) => { modelItem.Properties["DisplayName"].SetValue(modelItem.Properties["DisplayName"].Value + append_displayName); }; m_activityRecordingList.Add(info); }
private void UiElement_OnSelected(UiElement uiElement) { var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile(); setPropertyValue("SourceImgPath", screenshotsPath); 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); }
private void UiElement_OnSelected(UiElement uiElement) { var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile(); setPropertyValue("SourceImgPath", screenshotsPath); setPropertyValue("Selector", new InArgument <string>(uiElement.Selector)); navigateTextBlock.Visibility = System.Windows.Visibility.Hidden; setPropertyValue("visibility", System.Windows.Visibility.Visible); string displayName = getPropertyValue("_DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\""; setPropertyValue("DisplayName", displayName); }
private void UiElement_OnSelected(UiElement uiElement) { var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile(); setPropertyValue("SourceImgPath", screenshotsPath); grid1.Visibility = System.Windows.Visibility.Hidden; setPropertyValue("visibility", System.Windows.Visibility.Visible); string displayName = getPropertyValue("_DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\""; setPropertyValue("DisplayName", displayName); InArgument <string> _name = uiElement.Name; setPropertyValue("Title", _name); }
private void UiElement_OnSelected(UiElement uiElement) { var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile(); setPropertyValue("SourceImgPath", screenshotsPath); 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); }
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); }
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); }