public void StartRecorded() { XmlController xmlController = new XmlController(); while (ElementQueue.Count > 1) { String xmlData = ElementQueue.Dequeue(); AutomationElement ae; int num; Thread.Sleep(1500); (num, ae) = xmlController.XmlFinder(xmlData); if (num == 1) { } else if (num == 0) { MessageBox.Show("num = 0"); break; } else { MessageBox.Show("num = 2+"); break; } WindowControl(xmlData, ae); GetXmlInfo(xmlData); Thread.Sleep(300); DoAction(xmlData, ae); } }
private void GetXmlButton_Click(object sender, RoutedEventArgs e) { AutomationElement ae = (AutomationElement)((TreeViewItem)treeView1.SelectedItem).Tag; Stack <AutomationElement> automationElmements = XmlController.MakeStack(ae); String resultString = XmlController.MakeXmlFile(automationElmements, 0, null); //스택안의 구조를 xml형태로 바꾸어 string형태로 저장 resultString = resultString.Replace("><", ">\n<"); XmlBox.Text = resultString; //저장된 str을 textbox위치에 출력 }
private void MouseHook_LeftButtonDown(MouseHook.MSLLHOOKSTRUCT mouseStruct) { System.Windows.Point point = new System.Windows.Point(); point.X = mouseStruct.pt.x; point.Y = mouseStruct.pt.y; mouseHook.Uninstall(); AutomationElement ae = AutomationElement.FromPoint(point); Stack <AutomationElement> automationElements = XmlController.MakeStack(ae); String result = XmlController.MakeXmlFile(automationElements, 0, null); mainWindow.XmlBox.Text = result; mainWindow.Activate(); }
//private void MouseHook_DoubleClick(MouseHook.MSLLHOOKSTRUCT mouseStruct) //{ // Point point = new Point(mouseStruct.pt.x, mouseStruct.pt.y); // Add add = new Add(AddList); // IAsyncResult result = add.BeginInvoke(point, 2, null, null); //} private void AddList(Point point, int type) { AutomationElement ae = AutomationElement.FromPoint(point); //PrintAllTree(ae);/// String inputText = null; if (ae != null) { AutomationPattern[] aps = ae.GetSupportedPatterns(); foreach (AutomationPattern ap in aps) { //Console.WriteLine(ap.ProgrammaticName); if (ap == ValuePattern.Pattern) { ValuePattern valuePattern = ae.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern; if (valuePattern.Current.IsReadOnly == false) { RecordList.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { Stop(); InputBox inputBox = new InputBox(); inputBox.ShowDialog(); inputText = inputBox.InputText.Text; if (inputText == "") { type = 2; //dbclcik } else { type = 3; } Start(); })); } } } } String xmlData = XmlController.MakeXmlFile(XmlController.MakeStack(ae), type, inputText); RecordList.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { ElementQueue.Enqueue(xmlData); RecordList.Items.Add(xmlData); })); }
private void FindByXml_Click(object sender, RoutedEventArgs e) { XmlController xmlController = new XmlController(); String xmlData = XmlBox.Text.Replace(">\n<", "><"); AutomationElement ae; int count; (count, ae) = xmlController.XmlFinder(xmlData); if (count == 1) { MessageBox.Show("찾았습니다"); } else if (count == 0) { MessageBox.Show("못 찾았습니다"); } else { MessageBox.Show("여러개를 찾았습니다. "); } }