protected void Capture(object sender, EventArgs e) { string url = txtUrl.Text.Trim(); Thread thread = new Thread(delegate() { using (WebBrowser browser = new WebBrowser()) { browser.ScrollBarsEnabled = false; browser.AllowNavigation = false; browser.AllowWebBrowserDrop = false; browser.ScriptErrorsSuppressed = true; browser.Navigate("www.cnn.com"); //browser.Navigate((url, null, <data>, "Content-Type: application/x-www-form-urlencoded");) browser.Width = 1024; browser.Height = 768; browser.ClientSize = new Size(1024,768); browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DownloadCompleted); while ((browser.IsBusy) | (browser.ReadyState != WebBrowserReadyState.Complete)) { System.Windows.Forms.Application.DoEvents(); } //Thread.Sleep(5000); //browser.Dispose(); } }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); }
public NodeList(WebBrowser control, nsIDOMNodeList nodeList) : base (control) { if (control.platform != control.enginePlatform) unmanagedNodes = nsDOMNodeList.GetProxy (control, nodeList); else unmanagedNodes = nodeList; }
/// <summary> /// Worker method to acquire, refresh a token /// this method will show a browser as needed to /// complete the authentication flow /// </summary> /// <param name="browser"></param> /// <returns></returns> public Task<string> AcquireToken(WebBrowser browser) { _Browser = browser; _TCS = new TaskCompletionSource<string>(); //Check if existing token has expired, if so try refresh if (_AuthContext.IsAccessTokenExpired()) { //If expired and we have a refresh token, try that if (_AuthContext.IsRefreshViable()) { GetRefreshToken(); } else { //Start the flow from the top with the user providing credentials NavigateBrowserToAuthScreen(); } } else { _TCS.SetResult(_AuthContext.AccessToken); } return _TCS.Task; }
public WindowCollection (WebBrowser control, nsIDOMWindowCollection windowCol) : base (control) { if (control.platform != control.enginePlatform) unmanagedWindows = nsDOMWindowCollection.GetProxy (control, windowCol); else unmanagedWindows = windowCol; }
private void btnGetBotToken_Click(object sender, EventArgs e) { WebBrowser botBrowser = new WebBrowser(); botBrowser.Show(); botBrowser.Pattern = "tmi/#access_token(\\w+)"; botBrowser.Browser.Navigate("https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id=q6batx0epp608isickayubi39itsckt&redirect_uri=http%3A%2F%2Ftwitchapps.com%2Ftmi%2F&scope=chat_login"); }
private static void SetupExitAppDispatcher(WebBrowser browser) { browser.ScriptNotify += (sender, e) => { if(e.Value == "DevExpress.ExitApp") { Application.Current.Terminate(); } }; }
public NativeExecution(ref WebBrowser browser) { this.webBrowser = browser; this.commands = new Dictionary<string, PhoneGapCommand> { // TODO: These need to be included based on plugin configuration { "Accelerometer.GetCurrentAcceleration", new Plugins.Accelerometer.GetCurrentAccelerationCommand() }, { "Camera.GetPicture", new Plugins.Camera.GetPictureCommand() }, { "DebugConsole.debug", new Plugins.DebugConsole.DebugCommand() }, { "Device.GetAll", new Plugins.Device.GetAllCommand() }, { "Geolocation.GetCurrentPosition", new Plugins.Geolocation.GetCurrentPositionCommand() }, { "Network.IsReachable", new Plugins.Network.IsReachableCommand() }, { "Notification.Alert", new Plugins.Notification.AlertCommand() }, { "Notification.Beep", new Plugins.Notification.BeepCommand() }, { "Notification.Vibrate", new Plugins.Notification.VibrateCommand() }, { "Orientation.GetCurrentOrientation", new Plugins.Orientation.GetCurrentOrientationCommand() }, { "Orientation.ClearWatch", new Plugins.Orientation.ClearWatchCommmand() }, { "Orientation.WatchOrientation", new Plugins.Orientation.WatchOrientationCommmand() }, { "Send.Sms", new Plugins.Sms.SendCommand() }, { "Telephony.CallNumber", new Plugins.Telephony.CallCommand() } }; this.watchers = new Watchers(); }
public MainWindow() { InitializeComponent(); // Create instances of UserControls startScreen = new StartScreen(); newsPage = new NewsPage(); faculty = new Faculty(); events = new Events(); browser = new WebBrowser(); faculty.loadXmlDoc(); // Show the startScreen pageTransitionControl.ShowPage(startScreen); //pageTransitionControl.ShowPage(faculty); //Initialize the Kinect gesture engine GestureEngine gestEngine = new GestureEngine(); gestEngine.reset(); gestEngine.init(); //adds an event handler to the event that a new gesture is done gestEngine.GestureChanged += new ElementFlowTest.GestureEngine.NewGestureEventHandler(gestEngine_GestureChanged); }
public void Init(WebBrowser browser, PhoneApplicationPage appMainPage) { initAppUrls(); RhoLogger.InitRhoLog(); LOG.INFO("Init"); CRhoFile.recursiveCreateDir(CFilePath.join(getBlobsDirPath()," ")); m_webBrowser = browser; m_appMainPage = appMainPage; m_appMainPage.ApplicationBar = null; m_httpServer = new CHttpServer(CFilePath.join(getRhoRootPath(), "apps")); CRhoResourceMap.deployContent(); RhoRuby.Init(m_webBrowser); DBAdapter.initAttrManager(); LOG.INFO("Starting sync engine..."); SyncThread sync = null; try{ sync = SyncThread.Create(); }catch(Exception exc){ LOG.ERROR("Create sync failed.", exc); } if (sync != null) { //sync.setStatusListener(this); } RhoRuby.InitApp(); RhoRuby.call_config_conflicts(); RHOCONF().conflictsResolved(); }
// CONSTRUCTOR public ChannelAPI(CollabrifyClient c, LoadCompletedEventHandler del = null) { Debug.WriteLine(LOG_TAG + ": building ChannelAPI."); mChannelClosed = true; client = c; // Builds the browser object try { browser = new WebBrowser(); browser.IsScriptEnabled = true; browser.ScriptNotify += ScriptCallback; browser.LoadCompleted += delegate { }; if(del != null) browser.LoadCompleted += del; } catch( Exception ex) { Debug.WriteLine(LOG_TAG + ": " + ex.Source); Debug.WriteLine("\t" + ex.Message); } string html = null; using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Collabrify_wp8.Resources.home.html")) using (var r = new StreamReader(s)) html = r.ReadToEnd(); browser.NavigateToString(html); }
public Attribute (WebBrowser control, nsIDOMAttr domAttribute) : base (control, domAttribute as nsIDOMNode) { if (control.platform != control.enginePlatform) this.attribute = nsDOMAttr.GetProxy (control, domAttribute); else this.attribute = domAttribute; }
public DOMImplementation(WebBrowser control, nsIDOMDOMImplementation domImpl) : base (control) { if (control.platform != control.enginePlatform) unmanagedDomImpl = nsDOMDOMImplementation.GetProxy (control, domImpl); else unmanagedDomImpl = domImpl; hashcode = unmanagedDomImpl.GetHashCode (); }
public VKApiWrapper(WebBrowser browser, int appId) { this.browser = browser; this.appId = appId; //this.browser.ClearCookiesAsync(); //this.browser.ClearInternetCacheAsync(); }
public DocumentType (WebBrowser control, nsIDOMDocumentType doctype) : base (control, doctype as nsIDOMNode) { if (control.platform != control.enginePlatform) this.doctype = nsDOMDocumentType.GetProxy (control, doctype); else this.doctype = doctype; }
public BsonDocument from_10bet_1(ref WebBrowser browser, BsonDocument doc_result) { doc_result = Match100Helper.get_doc_result(); BrowserHelper.invoke_click_by_id(ref browser, "tp_chk_br_999_l_1_1"); doc_result["data"] = "Invoke Click!"; doc_result["url"] = browser.Document.Url.ToString(); return doc_result; }
public Stylesheet(WebBrowser control, nsIDOMStyleSheet stylesheet) : base (control) { if (control.platform != control.enginePlatform) unmanagedStyle = nsDOMStyleSheet.GetProxy (control, stylesheet); else unmanagedStyle = stylesheet; hashcode = unmanagedStyle.GetHashCode (); }
public Document (WebBrowser control, nsIDOMDocument document) : base (control, document) { if (control.platform != control.enginePlatform) this.node = nsDOMDocument.GetProxy (control, document); else this.node = document; }
internal DOMObject (WebBrowser control) { this.control = control; IntPtr p = Base.StringInit (); storage = new HandleRef (this, p); resources = new Hashtable (); event_handlers = null; }
public StylesheetList(WebBrowser control, nsIDOMStyleSheetList stylesheetList) : base (control) { if (control.platform != control.enginePlatform) unmanagedStyles = nsDOMStyleSheetList.GetProxy (control, stylesheetList); else unmanagedStyles = stylesheetList; styles = new List<IStylesheet>(); }
public void GetAppLinkFromUrlInBackground(Uri uri) { appLinkCrawlerBrowser = new WebBrowser(); appLinkCrawlerBrowser.IsScriptEnabled = true; appLinkCrawlerBrowser.ScriptNotify += AppLinkCrawlerBrowserOnScriptNotify; appLinkCrawlerBrowser.LoadCompleted += AppLinkCrawlerBrowserOnLoadCompleted; appLinkCrawlerBrowser.Navigate(uri); }
public NamedNodeMap (WebBrowser control, nsIDOMNamedNodeMap nodeMap) : base (control, true) { if (control.platform != control.enginePlatform) unmanagedNodes = nsDOMNamedNodeMap.GetProxy (control, nodeMap); else unmanagedNodes = nodeMap; }
/// <summary> /// Creates new instance of a NativeExecution class. /// </summary> /// <param name="browser">Reference to web part where application is hosted</param> public NativeExecution(ref WebBrowser browser) { if (browser == null) { throw new ArgumentNullException("browser"); } this.webBrowser = browser; }
public override void Setup() { _browser = new WebBrowser(_browserType); iBrowserInstance = ReflectionHelper.GetField<IBrowser>(_browser, "_browser"); _browser.OpenBrowser(); _browser.NavigateBrowser(getTestPage("SightLessUserTestPage.htm")); }
//OK-I GUESS /** * This method is used (or rather CAN be used) for clearing the overlays (markers) on the map * @param target */ public static void clearOverlays(WebBrowser target) { if (target == null) return; //target.InvokeScript("UI_ClearOverlays"); target.InvokeScript("eval", "clearOverlays()"); //target.loadUrl("javascript:UI_ClearOverlays()"); }
/// <summary> /// Creates a new back-button handler /// </summary> /// <param name="page">Page in which the back-button handler will be applied</param> /// <param name="browser">Browser from which we want to control the history</param> public BackButtonHandler(PhoneApplicationPage page, WebBrowser browser) { _page = page; _lastBack = DateTime.Now; _browser = browser; page.BackKeyPress += OnBackButtonPressed; }
/// <summary> /// Creates new instance of a NativeExecution class. /// </summary> /// <param name="browser">Reference to web part where application is hosted</param> public NativeExecution(ref WebBrowser browser) { if (browser == null) { throw new ArgumentNullException("browser"); } this.webBrowser = browser; this.commands = new List<BaseCommand>(); }
public BackButtonHandler(PhoneApplicationPage page, CordovaView phoneGapView) { // subscribe to the hardware back-button page.BackKeyPress += Page_BackKeyPress; _browser = phoneGapView.Browser; // handle navigation events _browser.Navigated += Browser_Navigated; }
public BsonDocument from_10bet_2(ref WebBrowser browser, BsonDocument doc_result) { doc_result = Match100Helper.get_doc_result(); string html = BrowserHelper.get_html(ref browser); StringBuilder sb = new StringBuilder(); //====================================================== HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); HtmlNodeCollection nodes_all = doc.DocumentNode.SelectNodes(@"//*"); List<HtmlNode> nodes = new List<HtmlNode>(); ArrayList list_lg = new ArrayList(); string league = ""; string start_time = ""; string host = ""; string client = ""; string win = ""; string draw = ""; string lose = ""; foreach (HtmlNode node in nodes_all) { if (node.Attributes.Contains("class") && node.Attributes["class"].Value.Trim() == "leagueWindow") { string xpath1 = node.XPath; league = doc.DocumentNode.SelectSingleNode(xpath1 + "/h5[1]").InnerText; HtmlNodeCollection nodes_tr = doc.DocumentNode.SelectNodes(xpath1 + "/div[2]/div[1]/div"); foreach (HtmlNode node_tr in nodes_tr) { if (node_tr.Attributes.Contains("class") && node_tr.Attributes["class"].Value.Trim() == "time") { start_time = node_tr.InnerText; string[] times = start_time.E_TRIM().E_SPLIT("|"); start_time = times[0].Substring(3, 2) + "-" + times[0].Substring(0, 2) + M.D + times[1]; } if (node_tr.Attributes.Contains("class") && node_tr.Attributes["class"].Value.Trim().Contains("bets") && node_tr.Attributes["class"].Value.Trim().Contains("ml")) { string xpath2 = node_tr.XPath; host = doc.DocumentNode.SelectSingleNode(xpath2 + "/ul[1]/li[1]/dl[1]/dt[1]/span[1]").InnerText; client = doc.DocumentNode.SelectSingleNode(xpath2 + "/ul[1]/li[1]/dl[1]/dt[1]/span[2]").InnerText; win = doc.DocumentNode.SelectSingleNode(xpath2 + "/ul[1]/li[1]/dl[1]/dd[1]/ul[1]/li[1]").InnerText; draw = doc.DocumentNode.SelectSingleNode(xpath2 + "/ul[1]/li[1]/dl[1]/dd[1]/ul[1]/li[2]").InnerText; lose = doc.DocumentNode.SelectSingleNode(xpath2 + "/ul[1]/li[1]/dl[1]/dd[1]/ul[1]/li[3]").InnerText; sb.AppendLine(league.PR(50) + start_time.PR(20) + host.PR(30) + client.PR(30) + win.PR(10) + draw.PR(10) + lose.PR(10)); Match100Helper.insert_data("10bet", league, start_time, host, client, win, draw, lose, "8", "0"); } } } } //====================================================== doc_result["data"] = sb.ToString(); doc_result["url"] = browser.Document.Url.ToString(); return doc_result; }
public eval_bu() { this.eval_a(); this.c = new WebBrowser(); this.c.Location = new Point(0, 0); this.c.MinimumSize = new Size(20, 20); this.c.Name = "web1"; this.c.TabIndex = 4; this.c.WebBrowserShortcutsEnabled = false; base.Controls.Add(this.c); }
public virtual bool SignIn(WebBrowser browser) { int retryCount = 3; for (int i = 0; i < retryCount; i++) { bool signInResult = InternalSignIn(browser); if(signInResult) return true; } return false; }
public void showRemoteSite(string parameters) { string[] args = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize <string[]>(parameters); Uri loc = new Uri(args[0]); int closeImageX; int.TryParse(args[1], out closeImageX); int closeImageY; int.TryParse(args[2], out closeImageY); int closeImageWidth; int.TryParse(args[3], out closeImageWidth); int closeImageHeight; int.TryParse(args[4], out closeImageHeight); Deployment.Current.Dispatcher.BeginInvoke(() => { if (browser != null) { browser.Navigate(loc); } else { if (page != null) { Grid grid = page.FindName("LayoutRoot") as Grid; if (grid != null) { browser = new WebBrowser(); browser.Navigate(loc); browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(browser_LoadCompleted); browser.Navigating += new EventHandler <NavigatingEventArgs>(browser_Navigating); browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed); browser.Navigated += new EventHandler <System.Windows.Navigation.NavigationEventArgs>(browser_Navigated); browser.IsScriptEnabled = true; grid.Children.Add(browser); closeButton = new Image(); Uri uri = new Uri("/Images/remote_close.png", UriKind.Relative); BitmapImage imgSource = new BitmapImage(uri); closeButton.Source = imgSource; closeButton.Height = closeImageHeight; closeButton.Width = closeImageWidth; closeButton.HorizontalAlignment = HorizontalAlignment.Left; closeButton.VerticalAlignment = VerticalAlignment.Top; closeButton.Margin = new Thickness(closeImageX, closeImageY, 0, 0); closeButton.Tap += closeButton_Tap; grid.Children.Add(closeButton); } // don't show app bar. //ApplicationBar bar = new ApplicationBar(); //bar.BackgroundColor = Colors.Black; //bar.IsMenuEnabled = false; //backButton = new ApplicationBarIconButton(); //backButton.Text = "Back"; //backButton.IconUri = new Uri("/Images/appbar.back.rest.png", UriKind.Relative); //backButton.Click += new EventHandler(backButton_Click); //backButton.IsEnabled = false; //bar.Buttons.Add(backButton); //fwdButton = new ApplicationBarIconButton(); //fwdButton.Text = "Forward"; //fwdButton.IconUri = new Uri("/Images/appbar.next.rest.png", UriKind.Relative); //fwdButton.Click += new EventHandler(fwdButton_Click); //fwdButton.IsEnabled = false; //bar.Buttons.Add(fwdButton); //ApplicationBarIconButton closeBtn = new ApplicationBarIconButton(); //closeBtn.Text = "Close"; //closeBtn.IconUri = new Uri("/Images/appbar.close.rest.png", UriKind.Relative); //closeBtn.Click += new EventHandler(closeBtn_Click); //bar.Buttons.Add(closeBtn); //page.ApplicationBar = bar; } } }); }
public WebcamCapture(WebBrowser web) { _web = web; }
public Form1() { InitializeComponent(); WebBrowser myBrowser = new WebBrowser(); }
// DoWebLogin is based on the following original VB code: // // Public Class Form1 // Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load // 'Part 1: Load Yahoo login page in Form_Load event // WebBrowser1.Navigate("https://login.yahoo.com/") // End Sub // Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted // 'Part 2: Locate the Username TextBox and automatically input your username // '<INPUT class=yreg_ipt id=username maxLength=96 size=17 name=login> // Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input") // For Each curElement As HtmlElement In theElementCollection // Dim controlName As String = curElement.GetAttribute("id").ToString // If controlName = "username" Then // curElement.SetAttribute("Value", "your username") // End If // Next // 'Part 3: Locate the Password TextBox and automatically input your password // '<INPUT class=yreg_ipt id=passwd type=password maxLength=64 size=17 value="" name=passwd> // theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input") // For Each curElement As HtmlElement In theElementCollection // Dim controlName As String = curElement.GetAttribute("id").ToString // If controlName = "passwd" Then // curElement.SetAttribute("Value", "your password") // End If // Next // 'Part 4: Locate the "Sign In" Button and automatically click it // '<INPUT type=submit value="Sign In" name=.save> // theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input") // For Each curElement As HtmlElement In theElementCollection // If curElement.GetAttribute("value").Equals("Sign In") Then // curElement.InvokeMember("click") // 'Javascript has a click method for we need to invoke on the current submit button element. // End If // Next // End Sub //End Class /// <summary> /// Do a login in a webbrowser /// </summary> /// <param name="browser">browser instance</param> /// <param name="usernametag">id of the username input to look for</param> /// <param name="passwordtag">id of the password input tag to look for</param> /// <param name="username">username to use to log in</param> /// <param name="password">password to log in with</param> /// <param name="clickstrvalue">click string to look for</param> public static void DoWebLogin(this WebBrowser browser, string usernametag, string passwordtag, string username, string password, string clickstrvalue) { browser.Document.SetHtmlDocAttr("input", usernametag, "id", "Value", username); browser.Document.SetHtmlDocAttr("input", passwordtag, "id", "Value", password); browser.Document.ClickHtmlButton("input", "value", clickstrvalue); }
private static async Task <object> DoWorkAsync(IEnumerable <object> args) { Rectangle screen = Screen.PrimaryScreen.Bounds; var wb = new WebBrowser(); wb.Width = screen.Width; wb.Height = screen.Height; wb.ScriptErrorsSuppressed = true; wb.ScrollBarsEnabled = false; TaskCompletionSource <bool> tcs = null; WebBrowserDocumentCompletedEventHandler documentCompletedHandler = (s, e) => tcs.TrySetResult(true); //todo:不能等到图片加载完成 // navigate to each URL in the list foreach (var url in args) { tcs = new TaskCompletionSource <bool>(); wb.DocumentCompleted += documentCompletedHandler; try { wb.Navigate(url.ToString()); // await for DocumentCompleted await tcs.Task; } finally { wb.DocumentCompleted -= documentCompletedHandler; } var doc = new HtmlDocument(); doc.LoadHtml(wb.DocumentText); HtmlNodeCollection imgNodes = doc.DocumentNode.SelectNodes(Resource.SysConfig_GetGoodsModeImgGreyXPath); foreach (HtmlNode imgNode in imgNodes) { imgNode.SetAttributeValue("src", imgNode.GetAttributeValue("original", "")); } wb.DocumentText = ""; wb.Document.Write(doc.DocumentNode.InnerHtml); //计算网页Document的宽和高 Rectangle body = wb.Document.Body.ScrollRectangle; var size = new Size(body.Width > screen.Width ? body.Width : screen.Width, body.Height > screen.Height ? body.Height : screen.Height); wb.Width = size.Width; wb.Height = size.Height; Bitmap map = CaptureFullUrl(wb); //获取元素elementId的Rectange Rectangle rect = GetElementRectangeByInject(wb, Resource.SysConfig_GoodsDescId); //从整个网页上截取指定元素elementId的范围 Bitmap newMap = map.Clone(rect, PixelFormat.Format32bppRgb); wb.Dispose(); return(newMap); } return(null); }
public void Navigate(string url) { WebBrowser.Navigate(new Uri(url)); }
private static void Wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser br = sender as WebBrowser; if (br.Document.GetElementById("contentdataform:logon_pwd") != null) { if (loginAttempts > 0) { Console.WriteLine("Wrong credentials"); Application.ExitThread(); return; } loginAttempts++; br.Document.GetElementById("contentdataform:pageFocus").SetAttribute("value", username); br.Document.GetElementById("contentdataform:logon_pwd").SetAttribute("value", password); br.Document.GetElementById("contentdataform:pageFocus").Focus(); br.Document.GetElementById("contentdataform:logon_pwd").Focus(); t1 = new System.Windows.Forms.Timer(); t1.Tick += WaitForCompanySelect; t1.Interval = 200; t1.Start(); } else if (br.Document.GetElementById("contentdataform:button_gebruikerSearchManager_search") != null) { br.Document.GetElementById("contentdataform:button_gebruikerSearchManager_search").InvokeMember("click"); if (t2 == null) { Console.WriteLine("Parsing profiles..."); Console.WriteLine(); } t2 = new System.Windows.Forms.Timer(); t2.Tick += T2_Tick; t2.Interval = 200; t2.Start(); } else { var person = new Person(); var elms = wb.Document.GetElementsByTagName("span"); foreach (HtmlElement elm in elms) { if (elm.InnerHtml == "Telefoonnummer") { var next = elm.NextSibling; person.PhoneNumber = next.GetAttribute("value"); } if (elm.InnerHtml == "Achternaam") { var next = elm.NextSibling; person.LastName = next.GetAttribute("value"); } if (elm.InnerHtml == "Voornaam") { var next = elm.NextSibling; person.FirstName = next.GetAttribute("value"); } if (elm.InnerHtml == "Kenmerk gebruiker") { var next = elm.NextSibling; person.KenmerkGebruiker = next.InnerHtml; } } persons.Add(person); Console.Write("\r Profiles found: {0} ", persons.Count); elms = wb.Document.GetElementsByTagName("a"); foreach (HtmlElement elm in elms) { if (elm.GetAttribute("className") == "menuItem menuItemSelected") { elm.InvokeMember("click"); } } } }
private void WebBrowser_DocumentCompleted222(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser m_WebBrowser = (WebBrowser)sender; Console.WriteLine("完成加载"); }
/// <summary> /// 截取整个网站,不能用多线程 /// </summary> /// <param name="url"></param> /// <returns></returns> public static Bitmap Capture(string url) { WebBrowser wb = CreateWebBrowser(url); return(CaptureFullUrl(wb)); }
private void WaitWebPageLoad222(WebBrowser m_WebBrowser) { //int n = 0; //string sUrl; //while (true) //{ // Delay(50); //系统延迟50毫秒,够少了吧! // if (m_WebBrowser.ReadyState == WebBrowserReadyState.Complete) //先判断是否发生完成事件。 // { // if (!m_WebBrowser.IsBusy) //再判断是浏览器是否繁忙 // { // n = n + 1; // Console.WriteLine("完成图片的加载"); // break; // } // n = 0; // } //} //m_WebBrowser.ScrollBarsEnabled = false; //// 这里 获取borwser内容的 高度 和宽度; //int currY = 0; //int allHeight = 0; //Console.WriteLine("获取对象"); //HtmlElement element; //string[] ary; //for (int i = 0; i < _bitmapCount; i++) //{ // element = m_WebBrowser.Document.GetElementById("sp_xx" + i); // ary = element.InnerText.Split('#'); // int w = Convert.ToInt32(ary[0]); // int h = Convert.ToInt32(ary[1]); // allHeight += h; //} //allHeight += 1; //int allWight = 720; //int width = m_WebBrowser.Document.Body.ScrollRectangle.Width < 1024 ? 1024 : m_WebBrowser.Document.Body.ScrollRectangle.Width; //int height = m_WebBrowser.Document.Body.ScrollRectangle.Height < 768 ? 768 : m_WebBrowser.Document.Body.ScrollRectangle.Height; //// 调节webBrowser的高度和宽度 -- (只用动态创建的WebBrowser才可以修改其大小,不知道为什么) //m_WebBrowser.Height = height; //m_WebBrowser.Width = allWight; ////滚动整个网页 设置此元素的上边缘或下边缘与此文档窗口对齐为止---这样可以截取网页滚动条中的内容 //m_WebBrowser.Document.Body.ScrollIntoView(true); //Bitmap bitmap = new Bitmap(width, allHeight); // 创建高度和宽度与网页相同的图片 //Rectangle rectangle = new Rectangle(0, 0, width, allHeight); // 绘图区域 //m_WebBrowser.DrawToBitmap(bitmap, rectangle); // 截图 ////string filename = PicFilePath + Guid.NewGuid().ToString("N") + ".png"; ////bitmap.Save(filename); //System.Drawing.Graphics imgGraphics = Graphics.FromImage(bitmap); //int curry = 0; //System.Drawing.Image img = bitmap; //System.Drawing.Bitmap bmpImage = new System.Drawing.Bitmap(img); //Console.WriteLine("共有图片:" + _bitmapCount); //string filename; //System.Drawing.Rectangle cropArea; ////System.Drawing.Bitmap bmpCrop; //for (int i = 0; i < _bitmapCount; i++) //{ // element = m_WebBrowser.Document.GetElementById("sp_xx" + i); // ary = element.InnerText.Split('#'); // int w = Convert.ToInt32(ary[0]); // int h = Convert.ToInt32(ary[1]); // if (i == 116) // { // Console.WriteLine("1"); // } // cropArea = new System.Drawing.Rectangle(0, curry, w, h); //要截取的区域大小 // using (System.Drawing.Bitmap bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat)) // { // //bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat); // filename = PicFilePath + Guid.NewGuid().ToString("N") + DateTime.Now.ToString("mm-ss-ms") + ".png"; // bmpCrop.Save(filename); // Console.WriteLine("保存图片:" + filename); // // element = m_WebBrowser.Document.GetElementById("txt_" + i); // if (!PicFilePathDic.ContainsKey(_htmlList[i])) // { // PicFilePathDic.Add(_htmlList[i], filename); // } // // bmpCrop.Dispose(); // // GC.Collect(); // } // curry += h; //} //img.Dispose(); //bmpImage.Dispose(); }
public MarkdownDocumentEditor(WebBrowser browser) { WebBrowser = browser; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.pgBar = new System.Windows.Forms.ProgressBar(); this.lblStatus = new System.Windows.Forms.Label(); this.btnCancel = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button(); this.chkLeaveCopy = new System.Windows.Forms.CheckBox(); this.lstProtocol = new System.Windows.Forms.ComboBox(); this.label5 = new System.Windows.Forms.Label(); this.lstAuthType = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.chkSSL = new System.Windows.Forms.CheckBox(); this.textPassword = new System.Windows.Forms.TextBox(); this.textUser = new System.Windows.Forms.TextBox(); this.textServer = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.lstMail = new System.Windows.Forms.ListView(); this.colFrom = new System.Windows.Forms.ColumnHeader(); this.colSubject = new System.Windows.Forms.ColumnHeader(); this.colDate = new System.Windows.Forms.ColumnHeader(); this.btnDel = new System.Windows.Forms.Button(); this.lblTotal = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.webMail = new System.Windows.Forms.WebBrowser(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.pgBar); this.groupBox1.Controls.Add(this.lblStatus); this.groupBox1.Controls.Add(this.btnCancel); this.groupBox1.Controls.Add(this.btnStart); this.groupBox1.Controls.Add(this.chkLeaveCopy); this.groupBox1.Controls.Add(this.lstProtocol); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.lstAuthType); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.chkSSL); this.groupBox1.Controls.Add(this.textPassword); this.groupBox1.Controls.Add(this.textUser); this.groupBox1.Controls.Add(this.textServer); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(8, 8); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(232, 328); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Account Information"; // // pgBar // this.pgBar.Location = new System.Drawing.Point(8, 312); this.pgBar.Name = "pgBar"; this.pgBar.Size = new System.Drawing.Size(216, 8); this.pgBar.TabIndex = 15; // // lblStatus // this.lblStatus.AutoSize = true; this.lblStatus.Location = new System.Drawing.Point(8, 272); this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(0, 13); this.lblStatus.TabIndex = 14; // // btnCancel // this.btnCancel.Enabled = false; this.btnCancel.Location = new System.Drawing.Point(128, 240); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(88, 24); this.btnCancel.TabIndex = 13; this.btnCancel.Text = "Cancel"; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // btnStart // this.btnStart.Location = new System.Drawing.Point(32, 240); this.btnStart.Name = "btnStart"; this.btnStart.Size = new System.Drawing.Size(88, 24); this.btnStart.TabIndex = 12; this.btnStart.Text = "Start"; this.btnStart.Click += new System.EventHandler(this.btnStart_Click); // // chkLeaveCopy // this.chkLeaveCopy.Location = new System.Drawing.Point(8, 208); this.chkLeaveCopy.Name = "chkLeaveCopy"; this.chkLeaveCopy.Size = new System.Drawing.Size(208, 16); this.chkLeaveCopy.TabIndex = 11; this.chkLeaveCopy.Text = "Leave a copy of message on server"; // // lstProtocol // this.lstProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstProtocol.Location = new System.Drawing.Point(80, 176); this.lstProtocol.Name = "lstProtocol"; this.lstProtocol.Size = new System.Drawing.Size(136, 21); this.lstProtocol.TabIndex = 10; this.lstProtocol.SelectedIndexChanged += new System.EventHandler(this.lstProtocol_SelectedIndexChanged); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(8, 178); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(46, 13); this.label5.TabIndex = 9; this.label5.Text = "Protocol"; // // lstAuthType // this.lstAuthType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstAuthType.Location = new System.Drawing.Point(80, 144); this.lstAuthType.Name = "lstAuthType"; this.lstAuthType.Size = new System.Drawing.Size(136, 21); this.lstAuthType.TabIndex = 8; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(8, 146); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(56, 13); this.label4.TabIndex = 7; this.label4.Text = "Auth Type"; // // chkSSL // this.chkSSL.Location = new System.Drawing.Point(8, 120); this.chkSSL.Name = "chkSSL"; this.chkSSL.Size = new System.Drawing.Size(208, 16); this.chkSSL.TabIndex = 6; this.chkSSL.Text = "SSL connection"; // // textPassword // this.textPassword.Location = new System.Drawing.Point(80, 86); this.textPassword.Name = "textPassword"; this.textPassword.PasswordChar = '*'; this.textPassword.Size = new System.Drawing.Size(136, 20); this.textPassword.TabIndex = 5; // // textUser // this.textUser.Location = new System.Drawing.Point(80, 54); this.textUser.Name = "textUser"; this.textUser.Size = new System.Drawing.Size(136, 20); this.textUser.TabIndex = 4; // // textServer // this.textServer.Location = new System.Drawing.Point(80, 22); this.textServer.Name = "textServer"; this.textServer.Size = new System.Drawing.Size(136, 20); this.textServer.TabIndex = 3; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(8, 88); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(53, 13); this.label3.TabIndex = 2; this.label3.Text = "Password"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(8, 56); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(29, 13); this.label2.TabIndex = 1; this.label2.Text = "User"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(8, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(38, 13); this.label1.TabIndex = 0; this.label1.Text = "Server"; // // lstMail // this.lstMail.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colFrom, this.colSubject, this.colDate }); this.lstMail.FullRowSelect = true; this.lstMail.HideSelection = false; this.lstMail.Location = new System.Drawing.Point(248, 16); this.lstMail.Name = "lstMail"; this.lstMail.Size = new System.Drawing.Size(474, 168); this.lstMail.TabIndex = 1; this.lstMail.UseCompatibleStateImageBehavior = false; this.lstMail.View = System.Windows.Forms.View.Details; this.lstMail.Click += new System.EventHandler(this.lstMail_Click); // // colFrom // this.colFrom.Text = "From"; this.colFrom.Width = 100; // // colSubject // this.colSubject.Text = "Subject"; this.colSubject.Width = 200; // // colDate // this.colDate.Text = "Date"; this.colDate.Width = 150; // // btnDel // this.btnDel.Location = new System.Drawing.Point(650, 186); this.btnDel.Name = "btnDel"; this.btnDel.Size = new System.Drawing.Size(72, 24); this.btnDel.TabIndex = 3; this.btnDel.Text = "Delete"; this.btnDel.Click += new System.EventHandler(this.btnDel_Click); // // lblTotal // this.lblTotal.AutoSize = true; this.lblTotal.Location = new System.Drawing.Point(256, 192); this.lblTotal.Name = "lblTotal"; this.lblTotal.Size = new System.Drawing.Size(0, 13); this.lblTotal.TabIndex = 4; // // label6 // this.label6.ForeColor = System.Drawing.SystemColors.HotTrack; this.label6.Location = new System.Drawing.Point(16, 352); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(216, 48); this.label6.TabIndex = 5; this.label6.Text = "Warning: if \"leave a copy of message on server\" is not checked, the emails on th" + "e server will be deleted !"; // // webMail // this.webMail.Location = new System.Drawing.Point(248, 216); this.webMail.MinimumSize = new System.Drawing.Size(20, 20); this.webMail.Name = "webMail"; this.webMail.Size = new System.Drawing.Size(474, 184); this.webMail.TabIndex = 6; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(734, 412); this.Controls.Add(this.webMail); this.Controls.Add(this.label6); this.Controls.Add(this.lblTotal); this.Controls.Add(this.btnDel); this.Controls.Add(this.lstMail); this.Controls.Add(this.groupBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.Resize += new System.EventHandler(this.Form1_Resize); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
private static Bitmap renderApiDumpImpl(WebBrowser browser) { var body = browser.Document.Body; body.Style = "zoom:150%"; const int extraWidth = 21; Rectangle size = body.ScrollRectangle; int width = size.Width + extraWidth; browser.Width = width + 8; int height = size.Height; browser.Height = height + 24; Bitmap apiRender = new Bitmap(width, height); browser.DrawToBitmap(apiRender, size); // Fill in some extra space on the right that we missed. using (Graphics graphics = Graphics.FromImage(apiRender)) { Color backColor = apiRender.GetPixel(0, 0); using (Brush brush = new SolidBrush(backColor)) { Rectangle fillArea = new Rectangle ( width - extraWidth, 0, extraWidth, height ); graphics.FillRectangle(brush, fillArea); } } // Apply some random noise and transparency to the edges. // Doing this so websites like Twitter can't force the image // to use lossy compression. Its a nice little hack :) Random rng = new Random(); var addNoise = new Action <int, int>((x, y) => { const int alpha = (224 << 24); int lum = 10 + (int)(rng.NextDouble() * 30); int argb = alpha | (lum << 16) | (lum << 8) | lum; Color pixel = Color.FromArgb(argb); apiRender.SetPixel(x, y, pixel); }); for (int x = 0; x < width; x++) { addNoise(x, 0); addNoise(x, height - 1); } for (int y = 0; y < height; y++) { addNoise(0, y); addNoise(width - 1, y); } return(apiRender); }
public static void EvalScript(this WebBrowser webBrowser, string scriptText) { webBrowser.Document.InvokeScript("eval", new object[] { scriptText }); }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser back = (WebBrowser)sender; if (e.Url != new Uri("http://qun.qq.com/member.html")) { back.Document.Cookie = cbck; back.Document.ExecCommand("Copy", false, null); } else if (e.Url == new Uri("http://qun.qq.com/member.html")) { webBrowser1.Stop(); webBrowser1.Height = 0; webBrowser1.Width = 0; back.Document.Cookie = cbck; back.Document.Body.InnerHtml = "<p>正在打开升级界面...请稍等...</p>"; back.Document.ExecCommand("Copy", false, null); string qq_cookie_login = back.Document.Cookie; int qqs = qq_cookie_login.IndexOf(" uin=o"); string qqsstr = qq_cookie_login.Substring(qqs + 6); int qqe = qqsstr.IndexOf(";"); qqnumber = qqsstr.Substring(0, qqe).TrimStart('0'); QQModel qqinfo = new QQModel(); try { LoadQQ(qqnumber, qq_cookie_login, ref qqinfo); } catch (Exception ee) { if (ee.Message.IndexOf("3.5") > -1) { MessageBox.Show("请安装.NET3.5或以上版本框架!" + "\n\r" + ee.Message, "错误", MessageBoxButtons.OK); } else { MessageBox.Show("加载QQ异常!" + "\n\r" + ee.Message, "错误", MessageBoxButtons.OK); } System.Environment.Exit(0); return; } try { // if (MyVersion.UpdateList != null) //{ HwPush fbs = new HwPush(); // fbs.MyVersion = MyVersion; fbs.qqinfo = qqinfo; fbs.qqnumber = qqnumber; fbs.VersionStrJM = VersionStrJM; fbs.publicKey = publicKey; this.Hide(); fbs.Show(); //} // else // { // MessageBox.Show("版本库异常!" + bbk, "错误", MessageBoxButtons.OK); // System.Environment.Exit(0); // return; // } } catch (Exception ee) { MessageBox.Show("版本库或者跳转异常!" + " " + ee.Message + " " + bbk, "错误", MessageBoxButtons.OK); System.Environment.Exit(0); return; } } }
private void InitializeComponent() { this.Pnl_Main = new Panel(); this.Web_Login = new WebBrowser(); this.Pnl_Bottom = new Panel(); this.Pnl_Top = new Panel(); this.Ckb_OpenCJ = new CheckBox(); this.Txt_PTUserPW = new TextBox(); this.Lbl_PTPassWord = new Label(); this.Txt_PTUserID = new TextBox(); this.Lbl_PTUserID = new Label(); this.Cbb_LoginLine = new ComboBox(); this.Lbl_LoginLine = new Label(); this.Lbl_LoginHint = new Label(); this.Pnl_Main.SuspendLayout(); this.Pnl_Top.SuspendLayout(); base.SuspendLayout(); this.Pnl_Main.Controls.Add(this.Web_Login); this.Pnl_Main.Controls.Add(this.Pnl_Bottom); this.Pnl_Main.Controls.Add(this.Pnl_Top); this.Pnl_Main.Dock = DockStyle.Fill; this.Pnl_Main.Location = new Point(0, 0); this.Pnl_Main.Name = "Pnl_Main"; this.Pnl_Main.Size = new Size(0x3e8, 0x26d); this.Pnl_Main.TabIndex = 0; this.Web_Login.Dock = DockStyle.Fill; this.Web_Login.Location = new Point(0, 0x23); this.Web_Login.MinimumSize = new Size(20, 20); this.Web_Login.Name = "Web_Login"; this.Web_Login.Size = new Size(0x3e8, 0x1e6); this.Web_Login.TabIndex = 9; this.Pnl_Bottom.BorderStyle = BorderStyle.FixedSingle; this.Pnl_Bottom.Dock = DockStyle.Bottom; this.Pnl_Bottom.Location = new Point(0, 0x209); this.Pnl_Bottom.Name = "Pnl_Bottom"; this.Pnl_Bottom.Size = new Size(0x3e8, 100); this.Pnl_Bottom.TabIndex = 8; this.Pnl_Top.BorderStyle = BorderStyle.FixedSingle; this.Pnl_Top.Controls.Add(this.Lbl_LoginHint); this.Pnl_Top.Controls.Add(this.Ckb_OpenCJ); this.Pnl_Top.Controls.Add(this.Txt_PTUserPW); this.Pnl_Top.Controls.Add(this.Lbl_PTPassWord); this.Pnl_Top.Controls.Add(this.Txt_PTUserID); this.Pnl_Top.Controls.Add(this.Lbl_PTUserID); this.Pnl_Top.Controls.Add(this.Cbb_LoginLine); this.Pnl_Top.Controls.Add(this.Lbl_LoginLine); this.Pnl_Top.Dock = DockStyle.Top; this.Pnl_Top.Location = new Point(0, 0); this.Pnl_Top.Name = "Pnl_Top"; this.Pnl_Top.Size = new Size(0x3e8, 0x23); this.Pnl_Top.TabIndex = 4; this.Ckb_OpenCJ.AutoSize = true; this.Ckb_OpenCJ.Location = new Point(6, 6); this.Ckb_OpenCJ.Name = "Ckb_OpenCJ"; this.Ckb_OpenCJ.Size = new Size(0x4b, 0x15); this.Ckb_OpenCJ.TabIndex = 0x9f; this.Ckb_OpenCJ.Text = "开启采集"; this.Ckb_OpenCJ.UseVisualStyleBackColor = true; this.Txt_PTUserPW.Location = new Point(0x289, 5); this.Txt_PTUserPW.Name = "Txt_PTUserPW"; this.Txt_PTUserPW.Size = new Size(130, 0x17); this.Txt_PTUserPW.TabIndex = 0x9e; this.Lbl_PTPassWord.AutoSize = true; this.Lbl_PTPassWord.Location = new Point(0x257, 8); this.Lbl_PTPassWord.Name = "Lbl_PTPassWord"; this.Lbl_PTPassWord.Size = new Size(0x2c, 0x11); this.Lbl_PTPassWord.TabIndex = 0x9d; this.Lbl_PTPassWord.Text = "密码:"; this.Txt_PTUserID.Location = new Point(0x1cf, 5); this.Txt_PTUserID.Name = "Txt_PTUserID"; this.Txt_PTUserID.Size = new Size(130, 0x17); this.Txt_PTUserID.TabIndex = 0x9c; this.Lbl_PTUserID.AutoSize = true; this.Lbl_PTUserID.Location = new Point(0x19d, 8); this.Lbl_PTUserID.Name = "Lbl_PTUserID"; this.Lbl_PTUserID.Size = new Size(0x2c, 0x11); this.Lbl_PTUserID.TabIndex = 0x9b; this.Lbl_PTUserID.Text = "账号:"; this.Cbb_LoginLine.DropDownStyle = ComboBoxStyle.DropDownList; this.Cbb_LoginLine.FormattingEnabled = true; this.Cbb_LoginLine.Location = new Point(0x9d, 5); this.Cbb_LoginLine.Name = "Cbb_LoginLine"; this.Cbb_LoginLine.Size = new Size(250, 0x19); this.Cbb_LoginLine.TabIndex = 0x98; this.Lbl_LoginLine.AutoSize = true; this.Lbl_LoginLine.Location = new Point(0x53, 8); this.Lbl_LoginLine.Name = "Lbl_LoginLine"; this.Lbl_LoginLine.Size = new Size(0x44, 0x11); this.Lbl_LoginLine.TabIndex = 0; this.Lbl_LoginLine.Text = "登录线路:"; this.Lbl_LoginHint.AutoSize = true; this.Lbl_LoginHint.Location = new Point(0x311, 7); this.Lbl_LoginHint.Name = "Lbl_LoginHint"; this.Lbl_LoginHint.Size = new Size(0, 0x11); this.Lbl_LoginHint.TabIndex = 160; base.AutoScaleDimensions = new SizeF(96f, 96f); base.AutoScaleMode = AutoScaleMode.Dpi; base.BorderStyle = BorderStyle.FixedSingle; base.Controls.Add(this.Pnl_Main); this.Font = new Font("微软雅黑", 9f); base.Margin = new Padding(3, 4, 3, 4); base.Name = "PTOpenDataLine"; base.Size = new Size(0x3e8, 0x26d); this.Pnl_Main.ResumeLayout(false); this.Pnl_Top.ResumeLayout(false); this.Pnl_Top.PerformLayout(); base.ResumeLayout(false); }
public static void AddJsToDocument(WebBrowser webBrowser1) { List <string> changeElementIdList = new List <string>(); changeElementIdList.Add("Applicant.CAppNme"); changeElementIdList.Add("Applicant.CCertfCde"); changeElementIdList.Add("Applicant.CMobile"); changeElementIdList.Add("Applicant.CMobile.Hiden"); changeElementIdList.Add("Applicant.CEmail"); changeElementIdList.Add("Applicant.CTransactorName"); changeElementIdList.Add("Applicant.CTransactorMobile"); changeElementIdList.Add("Applicant.CSuffixAddr"); changeElementIdList.Add("Insured.CInsuredNme"); changeElementIdList.Add("Insured.CCertfCde"); changeElementIdList.Add("Insured.CClntAddr"); changeElementIdList.Add("Insured.CMobile.Hiden"); changeElementIdList.Add("Insured.CMobile"); changeElementIdList.Add("Insured.CEmail"); changeElementIdList.Add("Cvrg.22.NRate"); changeElementIdList.Add("Insured.CTransactorName"); changeElementIdList.Add("Insured.CTransactorMobile"); changeElementIdList.Add("Vhlowner.COwnerNme"); changeElementIdList.Add("Vhlowner.CCertfCde"); changeElementIdList.Add("Base.TAppTm"); changeElementIdList.Add("VsTax.CTaxpayerId"); changeElementIdList.Add("VsTax.CTaxReliefCertNo"); changeElementIdList.Add("VsTax.CTaxAuthorities"); changeElementIdList.Add("Vhl.CEngNo"); changeElementIdList.Add("Vhl.CDisEngNo"); changeElementIdList.Add("Vhl.CDisFrmNo"); changeElementIdList.Add("Vhl.CDisVin"); changeElementIdList.Add("Vhl.CVin"); changeElementIdList.Add("Vhl.CFrmNo"); changeElementIdList.Add("Vhl.NSeatNum"); changeElementIdList.Add("Vhl.CPlateNo"); changeElementIdList.Add("Base.CSlsTel"); changeElementIdList.Add("Vhl.TStartDate"); changeElementIdList.Add("Vhl.TTransferDate"); changeElementIdList.Add("filter_policy.app_auditing_state_DW_CAppNo"); changeElementIdList = changeElementIdList.Distinct().ToList(); List <string> selectElementIdList = new List <string>(); selectElementIdList.Add("Base.CNewChaType"); selectElementIdList.Add("Base.CNewBsnsTyp"); selectElementIdList.Add("Base.CDisptSttlCde"); selectElementIdList.Add("Applicant.CApplicantTyp"); selectElementIdList.Add("Applicant.CCertfCls"); selectElementIdList.Add("Applicant.CCity"); selectElementIdList.Add("Applicant.CContactWay"); selectElementIdList.Add("Insured.CInsuredTyp"); selectElementIdList.Add("Insured.CCertfCls"); selectElementIdList.Add("Insured.CCounty"); selectElementIdList.Add("Insured.CContactWay"); selectElementIdList.Add("Vhlowner.CCertfCls"); selectElementIdList.Add("Vhl.CLoanVehicleFlag"); selectElementIdList.Add("JQ_Vhl.CUsageCde"); selectElementIdList.Add("SY_Vhl.CUsageCde"); selectElementIdList.Add("JQ_Vhl.CVhlTyp"); selectElementIdList.Add("SY_Vhl.CVhlTyp"); selectElementIdList.Add("Cvrg.2.CIndemLmtLvl"); selectElementIdList.Add("Cvrg.13.CIndemLmtLvl"); selectElementIdList.Add("Vhl.CCardDetail"); selectElementIdList.Add("Vhl.CRegVhlTyp"); selectElementIdList.Add("Vhl.CRegDriTyp"); selectElementIdList.Add("Base.CClauseType"); selectElementIdList = selectElementIdList.Distinct().ToList(); //找到head元素 HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0]; //创建script标签 HtmlElement scriptEl = webBrowser1.Document.CreateElement("script"); IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement; //给script标签加js内容 foreach (var item in changeElementIdList) { string funName = item.Replace(".", "_") + "MyChange"; element.text += "function " + funName + "() { $(document.getElementById('" + item + "')).change() }"; } foreach (var item in selectElementIdList) { string funName = item.Replace(".", "_") + "MySelect"; element.text += "function " + funName + "() { $('#' + utils.tranStr('" + item + "')).trigger('change');utils.remove('QT_PO_SE');}"; } //将script标签添加到head标签中 head.AppendChild(scriptEl); //执行js代码 }
public void Dispose() { WebBrowser.Dispose(); }
private void ScrapBrowserLoadCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (_scrapDone || _scrapBrowser.ReadyState != WebBrowserReadyState.Complete) { return; } IEnumerable <HtmlElement> ads = null; string[] filters = null; string[] searchTextWords = _searchText.ToLower().Split(' '); if (!string.IsNullOrEmpty(_synonyms)) { filters = _synonyms.ToLower().Split(';'); } var results = new List <Advertisement>(); try { ads = _scrapBrowser.Document.ElementsByClass("div", "list-item"); if (!ads.Any()) { AsyncScrapCompleted?.Invoke(this, results, false, null); return; } } catch (Exception ex) { _loggingService.LogException(ex, "Unhandled exception in ScrapBrowserLoadCompleted"); AsyncScrapCompleted?.Invoke(this, null, false, "Unhandled exception"); return; } try { foreach (var add in ads) { var info = add.ElementsByClass("div", "padded-box-horizontal")?.FirstOrDefault(); if (info == null) { continue; } var title = SafeExtrctTitle(info); bool continueFlag = false; bool breakFlag = false; //Checking if title contains each request text word if (_isFilteringActive && !title.ToLower().Contains(_searchText.ToLower())) { string testTitle = title.ToLower().Replace(" ", ""); foreach (var word in searchTextWords) { if (!testTitle.Contains(word)) { // Checking if title contains filters if (filters != null && filters.Length != 0) { foreach (var filter in filters) { if (testTitle.Contains(filter) && !filter.Equals("")) { breakFlag = true; } } } if (breakFlag) { break; } continueFlag = true; break; } } } if (continueFlag) { continue; } var price = add.ElementsByClass("div", "price")?.FirstOrDefault(); var realPrice = price?.ElementsByClass("span", "priceStr")?.FirstOrDefault()?.InnerText; if (realPrice == null) { realPrice = "POA"; } else { realPrice = realPrice.Replace(",", "").Replace("€", "").Replace(".", ""); if (decimal.TryParse(realPrice, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out decimal decimalPrice)) { realPrice = decimalPrice.ToString("### ###") + " €"; if (_lastCostMin.HasValue && decimalPrice < _lastCostMin) { continue; } if (_lastCostMax.HasValue && decimalPrice > _lastCostMax) { continue; } } } var description = info.ElementsByClass("div", "desc").FirstOrDefault()?.InnerText + add.ElementsByClass("div", "location").FirstOrDefault()?.InnerText; var divImg = add.ElementsByClass("div", "image")?.FirstOrDefault(); string src = SafeExtractSrc(divImg); if (src == null || src == " " || src == "") { src = "Images/noimage.png"; } else if (!src.Contains("http")) { src = "https://www.baywaboerse.com/" + src; } var href = SafeExtractHref(add); results.Add(new Advertisement { Name = title, Description = description, Price = realPrice, ImageUrl = src, PageUrl = href, }); } var hasMorePages = ScrapHasMorePages(_scrapBrowser.Document); _scrapDone = true; AsyncScrapCompleted?.Invoke(this, results, hasMorePages, null); } catch (Exception ex) { _loggingService.LogException(ex, "Unhandled exception in ScrapBrowserLoadCompleted"); AsyncScrapCompleted?.Invoke(this, null, false, "Unhandled exception"); } finally { if (_scrapBrowser != null) { _scrapBrowser.Dispose(); _scrapBrowser = null; } } }
public HDesktopSynchronizer(WebBrowser webBrowser, Func <HElement> htmlView, Action <JsonData> eventer, TimeSpan?refreshInterval = null, bool isTrace = false) : base(webBrowser, htmlView, eventer, refreshInterval, isTrace) { }
public AnalysisLoaded() { InitializeComponent(); UserLabel.Content = CurrentState.CurrentPerson.ToString(); WebBrowser.NavigateToString(CurrentState.CurrentTemplate.HtmlTemplate); }
private void ScrapBrowserLoadCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (_scrapDone || _scrapBrowser.ReadyState != WebBrowserReadyState.Complete) { return; } IEnumerable <HtmlElement> ads = null; var results = new List <Advertisement>(); try { ads = _scrapBrowser.Document.ElementsByClass("div", "maschList"); if (!ads.Any()) { AsyncScrapCompleted?.Invoke(this, results, false, null); return; } } catch (Exception ex) { _loggingService.LogException(ex, "Unhandled exception in ScrapBrowserLoadCompleted"); AsyncScrapCompleted?.Invoke(this, null, false, "Unhandled exception"); return; } try { foreach (var add in ads) { var price = add.ElementsByClass("div", "price")?.FirstOrDefault(); var realPrice = price?.ElementsByClass("span", "js-priceToChange")?.FirstOrDefault()?.InnerText; if (realPrice == null) { realPrice = "POA"; } else { realPrice = realPrice.Replace(",", "").Replace("€", ""); if (decimal.TryParse(realPrice, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out decimal decimalPrice)) { realPrice = decimalPrice.ToString("### ###") + " €"; if (_lastCostMin.HasValue && decimalPrice < _lastCostMin) { continue; } if (_lastCostMax.HasValue && decimalPrice > _lastCostMax) { continue; } } } var title = add.ElementsByClass("a", "link").FirstOrDefault()?.InnerText; var description = add.ElementsByClass("div", "u-small").FirstOrDefault()?.InnerText + add.ElementsByClass("div", "listing--galerie--none").FirstOrDefault()?.InnerText; var div = add.ElementsByClass("div", "img")?.FirstOrDefault(); var divSrc = div.ElementsByClass("div", "txtcenter")?.FirstOrDefault(); var src = SafeExtractSrc(divSrc); if (src == null || src == " " || src == "") { src = "Images/noimage.png"; } var href = SafeExtractHref(add); results.Add(new Advertisement { Name = title, Description = description, Price = realPrice, ImageUrl = "http:" + src, PageUrl = href, }); } var hasMorePages = ScrapHasMorePages(_scrapBrowser.Document); _scrapDone = true; AsyncScrapCompleted?.Invoke(this, results, hasMorePages, null); } catch (Exception ex) { _loggingService.LogException(ex, "Unhandled exception in ScrapBrowserLoadCompleted"); AsyncScrapCompleted?.Invoke(this, null, false, "Unhandled exception"); } finally { if (_scrapBrowser != null) { _scrapBrowser.Dispose(); _scrapBrowser = null; } } }
void OnStatusTextChanged(object objSrc, EventArgs args) { WebBrowser wb = objSrc as WebBrowser; statusLabel.Text = wb.StatusText; }
protected override FrameworkElement CreatePreviewControl() { _browser = new WebBrowser(); _browser.HorizontalAlignment = HorizontalAlignment.Stretch; return(_browser); }
void DocumentConversionComplete(IAsyncResult result) { // navigate to our temp file. WebBrowser.Navigate(mTempFileName_st); }
public static bool CHECK_HWID() { try { WebBrowser webBrowser = new WebBrowser(); Computer computer = new Computer(); WebClient webClient = new WebClient(); ManagementObjectCollection instances = new ManagementClass("win32_processor").GetInstances(); string empty = string.Empty; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = instances.GetEnumerator()) { if (enumerator.MoveNext()) { empty = enumerator.Current.Properties["DeviceID"].Value.ToString(); } } ManagementObject managementObject = new ManagementObject("win32_logicaldisk.deviceid=\"c:\""); managementObject.Get(); string[] strArray = new string[11]; strArray[0] = empty; strArray[1] = managementObject["Size"].ToString(); strArray[2] = computer.Info.TotalPhysicalMemory.ToString(); strArray[3] = computer.Info.OSFullName; strArray[4] = computer.Screen.DeviceName; Rectangle bounds = computer.Screen.Bounds; int num = bounds.Height; strArray[5] = num.ToString(); bounds = computer.Screen.Bounds; num = bounds.Width; strArray[6] = num.ToString(); strArray[7] = HWID.PrimaryBusType; strArray[8] = HWID.Product; strArray[9] = HWID.RevisionNumber; strArray[10] = HWID.Removable.ToString(); byte[] bytes = Encoding.UTF8.GetBytes(string.Concat(strArray)); string source = "\x0097££\x009F¢i^^\x0092\x0097\x0094\x0092\x009A\x0097\x0094\x0092\x009A\x0095\x009E¡¨\x009E¤]___¦\x0094\x0091\x0097\x009E¢£\x0090\x009F\x009F]\x0092\x009E\x009C^wxsb]\x009F\x0097\x009Fn\x0098\x0093l"; HWID.HardWareID = Convert.ToBase64String(bytes); HWID.Parts = webClient.DownloadString(HWID.stronk(source, (short)-47) + HWID.HardWareID).Split('|'); webBrowser.ScriptErrorsSuppressed = true; webBrowser.Navigate("https://time.is/Unix_time_now"); for (int index = 0; index <= 99; ++index) { if (!webBrowser.DocumentText.Contains("clock0")) { Application.DoEvents(); index = 0; } } long totalSeconds = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; HWID.Expiretime = Convert.ToInt64(HWID.Parts[3]); HWID.timeleft = HWID.Expiretime - totalSeconds; foreach (string part in HWID.Parts) { ; } return(HWID.Parts[0] == "OK"); } catch (Exception ex) { return(false); } }
public GettingStarted() { InitializeComponent(); /*tabControl.Appearance = TabAppearance.FlatButtons; * tabControl.ItemSize = new Size(0, 1); * tabControl.SizeMode = TabSizeMode.Fixed; */ tabControl.Selected += delegate { if (tabControl.SelectedIndex == 1) { //Clicked on recommended setup guide (HTML), can show "move on" popover now theWebBrowser.Document.InvokeScript("showHelpPopover"); } }; //Auto-select "recommended" panel RecommendedClicked(null, null); finalOptionButton.FlatStyle = FlatStyle.Flat; finalOptionButton.FlatAppearance.BorderSize = 0; MouseHover += delegate { if (selectedPanel != recommendedPanel) { recommendedPanel.borderColor = Pens.Black; recommendedPanel.Refresh(); } if (selectedPanel != expertPanel) { expertPanel.borderColor = Pens.Black; expertPanel.Refresh(); } }; //Recommended panel recommendedPanel.MouseHover += RecommendedHovered; recommendedPanel.Click += RecommendedClicked; recommendedLabel.MouseHover += RecommendedHovered; recommendedLabel.Click += RecommendedClicked; recommendedLabel2.MouseHover += RecommendedHovered; recommendedLabel2.Click += RecommendedClicked; recommendedLabel3.MouseHover += RecommendedHovered; recommendedLabel3.Click += RecommendedClicked; recommendedImage.MouseHover += RecommendedHovered; recommendedImage.Click += RecommendedClicked; //Expert panel expertPanel.MouseHover += ExpertHovered; expertPanel.Click += ExpertClicked; expertLabel1.MouseHover += ExpertHovered; expertLabel1.Click += ExpertClicked; expertLabel2.MouseHover += ExpertHovered; expertLabel2.Click += ExpertClicked; expertLabel2.MouseHover += ExpertHovered; expertLabel2.Click += ExpertClicked; expertLabel3.MouseHover += ExpertHovered; expertLabel3.Click += delegate { Process.Start("https://github.com/AlbertMN/AssistantComputerControl/wiki/Application-advanced-settings-expert-setup"); }; tooltip.SetToolTip(expertLabel3, "This will open a link in your default browser"); expertLabel4.MouseHover += ExpertHovered; expertLabel4.Click += ExpertClicked; expertImage.MouseHover += ExpertHovered; expertImage.Click += ExpertClicked; theWebBrowser = GuideWebBrowser; string tes = "http://acc.albe.pw/recommended_setup.html?" + new Random().Next(10000); Console.WriteLine(tes); //theWebBrowser.Url = new Uri(tes); theWebBrowser.DocumentCompleted += BrowserDocumentCompleted; theWebBrowser.Navigating += BrowserNavigating; theWebBrowser.NewWindow += NewBrowserWindow; VisibleChanged += delegate { MainProgram.testingAction = Visible; MainProgram.gettingStarted = Visible ? this : null; }; FormClosed += delegate { MainProgram.testingAction = false; MainProgram.gettingStarted = null; }; }
private void InitializeComponent() { components = new System.ComponentModel.Container(); WebBrowser = new WebBrowser(); _closeLabel = new Label(); _closeLabel.Click += new EventHandler(closeLabel_Click); lblTitle = new Label(); Timer1 = new Timer(components); SuspendLayout(); // // WebBrowser // WebBrowser.Dock = DockStyle.Bottom; WebBrowser.Location = new Point(0, 40); WebBrowser.MinimumSize = new Size(20, 20); WebBrowser.Name = "WebBrowser"; WebBrowser.Size = new Size(1200, 610); WebBrowser.TabIndex = 0; WebBrowser.Visible = false; // // closeLabel // _closeLabel.Anchor = AnchorStyles.Top | AnchorStyles.Right; _closeLabel.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); _closeLabel.Font = new Font("Arial Narrow", 22.25455f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); _closeLabel.ForeColor = Color.White; _closeLabel.Location = new Point(1160, -5); _closeLabel.Margin = new Padding(0); _closeLabel.Name = "_closeLabel"; _closeLabel.Size = new Size(40, 41); _closeLabel.TabIndex = 148; _closeLabel.Text = "🗙"; _closeLabel.TextAlign = ContentAlignment.MiddleCenter; // // lblTitle // lblTitle.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); lblTitle.Dock = DockStyle.Top; lblTitle.Font = new Font("Microsoft Sans Serif", 10.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); lblTitle.ForeColor = Color.White; lblTitle.Location = new Point(0, 0); lblTitle.Name = "lblTitle"; lblTitle.Size = new Size(1200, 41); lblTitle.TabIndex = 147; lblTitle.TextAlign = ContentAlignment.MiddleCenter; // // frmWebBrowserPDF // AutoScaleDimensions = new SizeF(6.0f, 13.0f); AutoScaleMode = AutoScaleMode.Font; BackColor = Color.White; ClientSize = new Size(1200, 650); Controls.Add(_closeLabel); Controls.Add(lblTitle); Controls.Add(WebBrowser); ForeColor = Color.White; FormBorderStyle = FormBorderStyle.None; Name = "frmWebBrowserPDF"; StartPosition = FormStartPosition.CenterScreen; Text = "frmWebBrowserPDF"; Load += new EventHandler(frmWebBrowserPDF_Load); ResumeLayout(false); }
public void PreviewMarkdown(MarkdownDocumentEditor editor = null, bool keepScrollPosition = false, bool showInBrowser = false, string renderedHtml = null, int editorLineNumber = -1) { try { // only render if the preview is actually visible and rendering in Preview Browser if (!Model.IsPreviewBrowserVisible && !showInBrowser) { return; } if (editor == null) { editor = Window.GetActiveMarkdownEditor(); } if (editor == null) { return; } var doc = editor.MarkdownDocument; var ext = Path.GetExtension(doc.Filename).ToLower().Replace(".", ""); string mappedTo = "markdown"; if (!string.IsNullOrEmpty(renderedHtml)) { mappedTo = "html"; ext = null; } else if (doc.Filename == "untitled") { mappedTo = "markdown"; } else { // only show preview for Markdown and HTML documents Model.Configuration.EditorExtensionMappings.TryGetValue(ext, out mappedTo); mappedTo = mappedTo ?? string.Empty; } PreviewBrowserInterop interop = null; if (string.IsNullOrEmpty(ext) || mappedTo == "markdown" || mappedTo == "html") { if (!showInBrowser) { if (keepScrollPosition) { interop = new PreviewBrowserInterop(PreviewBrowserInterop.GetWindow(WebBrowser)); } else { Window.ShowPreviewBrowser(false, false); } } if (mappedTo == "html") { if (string.IsNullOrEmpty(renderedHtml)) { renderedHtml = doc.CurrentText; } if (!doc.WriteFile(doc.HtmlRenderFilename, renderedHtml)) { // need a way to clear browser window return; } renderedHtml = StringUtils.ExtractString(renderedHtml, "<!-- Markdown Monster Content -->", "<!-- End Markdown Monster Content -->"); } else { // Fix up `\` or `~\` Web RootPaths via `webRootPath: <path>` in YAML header // Specify a physical or relative path that `\` or `~\` maps to doc.GetPreviewWebRootPathFromDocument(); bool usePragma = !showInBrowser && mmApp.Configuration.PreviewSyncMode != PreviewSyncMode.None; if (string.IsNullOrEmpty(renderedHtml)) { renderedHtml = doc.RenderHtmlToFile(usePragmaLines: usePragma); } if (renderedHtml == null) { Window.ShowStatusError($"Access denied: {Path.GetFileName(doc.Filename)}"); // need a way to clear browser window return; } // Handle raw URLs to render if (renderedHtml.StartsWith("http") && StringUtils.CountLines(renderedHtml) == 1) { WebBrowser.Navigate(new Uri(renderedHtml)); Window.ShowPreviewBrowser(); return; } renderedHtml = StringUtils.ExtractString(renderedHtml, "<!-- Markdown Monster Content -->", "<!-- End Markdown Monster Content -->"); } if (showInBrowser) { var url = doc.HtmlRenderFilename; mmFileUtils.ShowExternalBrowser(url); return; } WebBrowser.Cursor = Cursors.None; WebBrowser.ForceCursor = true; // if content contains <script> tags we must do a full page refresh bool forceRefresh = renderedHtml != null && renderedHtml.Contains("<script "); if (keepScrollPosition && !mmApp.Configuration.AlwaysUsePreviewRefresh && !forceRefresh) { string browserUrl = WebBrowser.Source.ToString().ToLower(); string documentFile = "file:///" + doc.HtmlRenderFilename.Replace('\\', '/') .ToLower(); if (browserUrl == documentFile) { if (string.IsNullOrEmpty(renderedHtml)) { PreviewMarkdown(editor, false, false); // fully reload document } else { try { try { // scroll preview to selected line if (mmApp.Configuration.PreviewSyncMode == PreviewSyncMode.EditorAndPreview || mmApp.Configuration.PreviewSyncMode == PreviewSyncMode.EditorToPreview) { int highlightLineNo = editorLineNumber; if (editorLineNumber < 0) { highlightLineNo = editor.GetLineNumber(); editorLineNumber = highlightLineNo; } if (renderedHtml.Length < 100000) { highlightLineNo = 0; // no special handling render all code snippets } var lineText = editor.GetLine(editorLineNumber).Trim(); interop.UpdateDocumentContent(renderedHtml, highlightLineNo); // TODO: We need to get Header Ids var headerId = string.Empty; // headers may not have pragma lines if (editorLineNumber > -1) { if (lineText.StartsWith("#") && lineText.Contains("# ")) // it's header { lineText = lineText.TrimStart(new[] { ' ', '#', '\t' }); headerId = LinkHelper.UrilizeAsGfm(lineText); } } if (editor.EditorSyntax == "markdown") { interop.ScrollToPragmaLine(editorLineNumber, headerId); } else if (editor.EditorSyntax == "html") { interop.ScrollToHtmlBlock(lineText); } } else { interop.UpdateDocumentContent(renderedHtml, 0); } } catch { /* ignore scroll error */ } } catch { // Refresh doesn't fire Navigate event again so // the page is not getting initiallized properly //PreviewBrowser.Refresh(true); WebBrowser.Tag = "EDITORSCROLL"; WebBrowser.Navigate(new Uri(doc.HtmlRenderFilename)); } } return; } } WebBrowser.Tag = "EDITORSCROLL"; WebBrowser.Navigate(new Uri(doc.HtmlRenderFilename)); return; } // not a markdown or HTML document to preview Window.ShowPreviewBrowser(true, keepScrollPosition); } catch (Exception ex) { //mmApp.Log("PreviewMarkdown failed (Exception captured - continuing)", ex); Debug.WriteLine("PreviewMarkdown failed (Exception captured - continuing): " + ex.Message, ex); } }
internal WebBrowserSite(WebBrowser host) : base(host) { }