public void GeAlinkFromFrame() { IEOperateCore ieCore = new IEOperateCore("http://psgis.chinasofti.com/oa/SignOnServlet"); HTMLInputElementClass userName = ieCore.GetElementByTagName <HTMLInputElementClass>("input").ToList().Find(item => item.name.Equals("userName")); HTMLInputElementClass passWord = ieCore.GetElementByTagName <HTMLInputElementClass>("input").ToList().Find(item => item.name.Equals("password")); HTMLImgClass imgLogin = ieCore.GetElementByTagName <HTMLImgClass>("img").ToList().Find(item => item.name.Equals("login_r3_c3")); userName.value = string.Empty; passWord.value = string.Empty; userName.value = "E100086376"; passWord.value = "Qa20080607"; imgLogin.click(); Thread.Sleep(3500); ieCore = new IEOperateCore("http://psgis.chinasofti.com/oa/portal"); HTMLDivElementClass btnPMS = ieCore.GetElementByTagName <HTMLDivElementClass>("div").ToList().Find(item => item.className.Equals("channel app_PMS系统")); Thread.Sleep(4000); btnPMS.click(); Thread.Sleep(5000); ieCore = new IEOperateCore("http://psgpms.chinasofti.com/main.jsp"); HTMLFrameElementClass midIframe = ieCore.GetInputElementByID <HTMLFrameElementClass>("ManagerLeftFrame"); }
public MainWindow() { InitializeComponent(); _currentDevice = new DeviceItem { DeviceAddress = "http://192.168.1.104:8080/", DeviceName = "Yarvik", DeviceType = DeviceTypes.Android }; // NOTE: Make sure that you've read through the add-on language's 'Getting Started' topic // since it tells you how to set up an ambient parse request dispatcher and an ambient // code repository within your application OnStartup code, and add related cleanup in your // application OnExit code. These steps are essential to having the add-on perform well. // Initialize the project assembly (enables support for automated IntelliPrompt features) _projectAssembly = new CSharpProjectAssembly("SampleBrowser"); var assemblyLoader = new BackgroundWorker(); assemblyLoader.DoWork += DotNetProjectAssemblyReferenceLoader; assemblyLoader.RunWorkerAsync(); // Load the .NET Languages Add-on C# language and register the project assembly on it var language = new CSharpSyntaxLanguage(); language.RegisterProjectAssembly(_projectAssembly); CodeEditor.Document.Language = language; CodeEditor.Document.Language.RegisterService(new IndicatorQuickInfoProvider()); CodeEditor.PreviewKeyDown += (sender, args) => { if (args.Key != Key.Enter || (Keyboard.Modifiers & ModifierKeys.Control) != ModifierKeys.Control) return; SendCodeButton_Click(null,null); args.Handled = true; }; _udpDiscoveryClient = new UdpDiscoveryClient( // ready => Dispatcher.Invoke((Action) (() => SendCodeButton.IsEnabled = ready)), ready => { }, (name, address) => Dispatcher.Invoke(() => { if (address.Contains("?")) address = address.Replace("?", AndroidPort); var deviceItem = new DeviceItem { DeviceAddress = address, DeviceName = name, DeviceType = name.StartsWith("ProtoPad Service on ANDROID Device ") ? DeviceTypes.Android : DeviceTypes.iOS }; if (!DevicesComboBox.Items.Cast<object>().Any(i => (i as DeviceItem).DeviceAddress == deviceItem.DeviceAddress)) { DevicesComboBox.Items.Add(deviceItem); } DevicesComboBox.IsEnabled = true; //ResultTextBox.Text += String.Format("Found '{0}' on {1}", name, address); })); ResultTextBox.Navigated += (sender, args) => { var htmlDocument = ResultTextBox.Document as HTMLDocument; _htmlHolder = htmlDocument.getElementById("wrapallthethings") as HTMLDivElementClass; _htmlWindow = htmlDocument.parentWindow; _udpDiscoveryClient.SendServerPing(); var ticksPassed = 0; var dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += (s, a) => { if (ticksPassed > 2) { dispatcherTimer.Stop(); if (DevicesComboBox.Items.Count == 1) { DevicesComboBox.SelectedIndex = 0; } } _udpDiscoveryClient.SendServerPing(); ticksPassed++; }; dispatcherTimer.Interval = TimeSpan.FromMilliseconds(200); dispatcherTimer.Start(); }; ResultTextBox.NavigateToString(Properties.Resources.ResultHtmlWrap); }