當前位置: 首頁>>代碼示例>>C#>>正文


C# Controls.WebBrowser類代碼示例

本文整理匯總了C#中System.Windows.Controls.WebBrowser的典型用法代碼示例。如果您正苦於以下問題:C# WebBrowser類的具體用法?C# WebBrowser怎麽用?C# WebBrowser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WebBrowser類屬於System.Windows.Controls命名空間,在下文中一共展示了WebBrowser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Run

 public override void Run (WebBrowser webBrowser, Action callBack = null)
 {
     var Script = string.Format("$('{0}').click();", mJquerySelectObject);
     webBrowser.InvokeScript("execScript", new Object[] { Script, "JavaScript" });
     if (callBack != null)
         callBack();
 }
開發者ID:powerhai,項目名稱:Jinchen,代碼行數:7,代碼來源:ClickCommand.cs

示例2: BrowserMouseHelper

        public BrowserMouseHelper(WebBrowser browser)
        {
            _browser = browser;
            if (true)//browser.Source != null)
            {
                var border0 = VisualTreeHelper.GetChild(_browser, 0);
                var border1 = VisualTreeHelper.GetChild(border0, 0);
                var panZoom = VisualTreeHelper.GetChild(border1, 0);
                var grid = VisualTreeHelper.GetChild(panZoom, 0);
                border = VisualTreeHelper.GetChild(grid, 0) as Border;

                if (border != null)
                {
                    border.ManipulationStarted += Border_ManipulationStarted;
                    border.ManipulationDelta += Border_ManipulationDelta;
                    border.ManipulationCompleted += Border_ManipulationCompleted;
                    border.DoubleTap += Border_DoubleTap;
                    border.Hold += Border_Hold;
                    border.MouseLeftButtonDown += Border_MouseLeftButtonDown;
                }

                try
                {
                    _browser.InvokeScript("execScript", MinifiedMouseScript);
                }
                catch (Exception)
                {
                    Debug.WriteLine("BrowserHelper Failed to install mouse script in WebBrowser");
                }
            }
            browser.Loaded += new RoutedEventHandler(browser_Loaded);
        }
開發者ID:sanyaade-mobiledev,項目名稱:SujiQ,代碼行數:32,代碼來源:BrowserMouseHelper.cs

示例3: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 4 "..\..\DlgAuthentication.xaml"
     ((LinkedIn.NET.AuthorizeWindow)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);
     
     #line default
     #line hidden
     return;
     case 2:
     this.browser = ((System.Windows.Controls.WebBrowser)(target));
     
     #line 7 "..\..\DlgAuthentication.xaml"
     this.browser.Navigating += new System.Windows.Navigation.NavigatingCancelEventHandler(this.browser_Navigating);
     
     #line default
     #line hidden
     
     #line 7 "..\..\DlgAuthentication.xaml"
     this.browser.Navigated += new System.Windows.Navigation.NavigatedEventHandler(this.browser_Navigated);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
開發者ID:keithshort,項目名稱:HOPE,代碼行數:29,代碼來源:DlgAuthentication.g.cs

示例4: RunTabItem

        public RunTabItem (string header)
        {
            FrameName = "";
            this.Header = header; 
            WebBrowser = new WebBrowser();
            WebBrowser.ObjectForScripting = new ScriptHelper(WebBrowser); 
            this.Content = WebBrowser ;
            this.Style = Application.Current.MainWindow.FindResource("MainTabItemStyle") as Style;
            WebBrowser.Navigate("about:blank");
            
            
            var SID_SWebBrowserApp = new Guid("0002DF05-0000-0000-C000-000000000046");
            var serviceProvider = (IServiceProvider)WebBrowser.Document;

            var serviceGuid = SID_SWebBrowserApp;

            var iid = typeof(SHDocVw.IWebBrowser2).GUID;
            ////Here we will get a reference to the IWebBrowser2 interface
              ExBrowser = (SHDocVw.IWebBrowser2)serviceProvider.QueryService(ref serviceGuid, ref iid);
            ////To hook events we just need to do these casts
                Events2 = (SHDocVw.DWebBrowserEvents_Event)ExBrowser;
              Events = (SHDocVw.DWebBrowserEvents2_Event)ExBrowser;
              System.Runtime.InteropServices.Marshal.ReleaseComObject((object)serviceProvider);
            


        }
開發者ID:powerhai,項目名稱:Jinchen,代碼行數:27,代碼來源:RunTabItem.cs

示例5: autorize

 public static void  autorize(WebBrowser _webBrowser)
 {
     string clientID = "4273691";
     string url = string.Format("http://oauth.vk.com/authorize?client_id={0}&scope=friends,audio&redirect_uri=https://oauth.vk.com/blank.html&display=popup&response_type=token", clientID);
     _webBrowser.Navigated += _webBrowser_Navigated;
     _webBrowser.Navigate(url);
 }
開發者ID:fargutvest,項目名稱:TriedStartUp,代碼行數:7,代碼來源:autorizeVK.cs

示例6: Start

        public void Start(WebBrowser browser, string userName, string password, int timeout)
        {
            this.Browser = browser;

            this.Browser.LoadCompleted -= Browser_LoadCompleted;
            this.Browser.LoadCompleted += Browser_LoadCompleted;

            this.UserName = userName;
            this.Password = password;

            this.ProgressMaxChanged(this, 0);
            this.ProgressValueChanged(this, 0);

            if (timeout > 0)
            {
                this.TimeoutEnabled = true;
                this.TimeoutTimer.Interval = timeout;
            }
            else
            {
                this.TimeoutEnabled = false;
            }

            this.Start();
        }
開發者ID:pine,項目名稱:PointMallScraper,代碼行數:25,代碼來源:PointMallApi.cs

示例7: Accelerometro

        public Accelerometro()
        {
            InitializeComponent();

            accelerometer = new Accelerometer();
            accelerometer.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100);
            accelerometer.Start();

            myFile = IsolatedStorageFile.GetUserStoreForApplication();

            if (!myFile.FileExists("Impo.txt"))
            {
                IsolatedStorageFileStream dataFile = myFile.CreateFile("Impo.txt");
                dataFile.Close();
            }

            Wb = new WebBrowser();
            Connesso = false;
            Carica();

            System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
            dt.Interval = new TimeSpan(0, 0, 0, 0, 250); // 500 Milliseconds
            dt.Tick += new EventHandler(dt_Tick);
            dt.Start();
        }
開發者ID:AndreaBruno,項目名稱:Macchinino,代碼行數:25,代碼來源:Accelerometro.xaml.cs

示例8: ThreadPageManager

 public ThreadPageManager(WebBrowser browser, ThreadPageContextMenuProvider threadMenu,
     SolidColorBrush foreground, SolidColorBrush background)
     : this(browser, threadMenu)
 {
     this._fg = foreground;
     this._bg = background;
 }
開發者ID:bootlegrobot,項目名稱:awful2,代碼行數:7,代碼來源:ThreadPageManager.cs

示例9: MarkdownPreviewToolWindow

        /// <summary>
        /// Standard constructor for the tool window.
        /// </summary>
        public MarkdownPreviewToolWindow()
            : base(null)
        {
            this.Caption = "Markdown Preview";
            this.BitmapResourceID = 301;
            this.BitmapIndex = 1;

            browser = new WebBrowser();
            browser.NavigateToString(EmptyWindowHtml);
            browser.LoadCompleted += (sender, args) =>
            {
                if (scrollBackTo.HasValue)
                {
                    var document = browser.Document as mshtml.IHTMLDocument2;

                    if (document != null)
                    {
                        var element = document.body as mshtml.IHTMLElement2;
                        if (element != null)
                        {
                            element.scrollTop = scrollBackTo.Value;
                        }
                    }
                }

                scrollBackTo = null;
            };
        }
開發者ID:andorardo,項目名稱:MarkdownMode,代碼行數:31,代碼來源:PreviewToolWindow.cs

示例10: PhoneApplicationPage_Loaded

        /// <summary>
        /// Page_Loaded event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            
            WebBrowser webBrowser = new WebBrowser();
           

            RowDefinition rdWebBrowser=new RowDefinition();
            RowDefinition rdProgressBar = new RowDefinition();

            rdProgressBar.Height = new GridLength(0.3, GridUnitType.Star);
            rdWebBrowser.Height = new GridLength(13, GridUnitType.Star);
            pgBar.Height = 10;
            pgBar.IsIndeterminate = true;
            pgBar.Visibility = Visibility.Visible;
            webBrowser.Navigate(new Uri(RxConstants.myLocalPharmacySupport, UriKind.Absolute));

            webBrowser.Navigated += new EventHandler<NavigationEventArgs>(NavigateHandler);
            webBrowser.Visibility = Visibility.Visible;
            webBrowser.Margin.Top.Equals(-12);
            webBrowser.IsScriptEnabled = true;
            
            ContentPanel.RowDefinitions.Insert(0, rdProgressBar);
            ContentPanel.RowDefinitions.Insert(1, rdWebBrowser);

            Grid.SetRow(pgBar, 0);
            Grid.SetRow(webBrowser, 1);

            ContentPanel.Children.Add(pgBar);
            ContentPanel.Children.Add(webBrowser);
           
        }
開發者ID:EdytaSzkiladz,項目名稱:MyLocalPharmacy,代碼行數:36,代碼來源:SupportPage.xaml.cs

示例11: TridentBrowser

        public TridentBrowser()
        {
            Child = r_Browser = new WebBrowser();
            r_Browser.Navigated += (s, e) => SuppressScriptError();

            r_Browser.LoadCompleted += (s, e) => ExtractFlash();
        }
開發者ID:XHidamariSketchX,項目名稱:ProjectDentan,代碼行數:7,代碼來源:TridentBrowser.cs

示例12: GetUrlContentImageList

        public static void GetUrlContentImageList(object state)
        {
            //HttpWebRequest
            //httpclient
            //WebClient
            var url = "http://image.baidu.com/";
            var client = new HttpClient();
            var uri = new Uri(url);
            var task = client.GetStringAsync(uri);
            var result = task.Result;

            var s = new WebBrowser();
            s.Source = uri;

            //var webclient = new WebClient();
            //webclient.DownloadFile()

            //var request = HttpWebRequest.Create("");
            //request.BeginGetResponse()

            //var xmlDoc = XDocument.Parse(result);
            //var elemetns = xmlDoc.Elements();
            //var stringList = new List<string>();
            //foreach (var element in elemetns) {
            //	var list = GetImageElement(element);
            //	stringList.AddRange(list);
            //}
        }
開發者ID:0811112150,項目名稱:HappyDayHistory,代碼行數:28,代碼來源:WebPictureFactory.cs

示例13: LoginPage

 public LoginPage()
 {
     InitializeComponent();
     //Initialize _webBrowser
     _webBrowser = new WebBrowser();
     this.Loaded += new RoutedEventHandler(MainPage_Loaded);
 }
開發者ID:mderazon,項目名稱:dobberman,代碼行數:7,代碼來源:LoginPage.xaml.cs

示例14: CreateHtmlView

 /// <summary>
 /// 創建Html視圖
 /// </summary>
 /// <param name="url">絕對URL</param>
 /// <returns></returns>
 public static UIElement CreateHtmlView(string url)
 {
     UIElement view = null;
     //var errorPage = HostAddress.Host() + "NavigateError.htm";
     if (Application.Current.IsRunningOutOfBrowser)
     {
         view = new WebBrowser() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch };
         try
         {
             /*下麵這樣寫的原因是因為WebBrowser中URI不支持中文參數 ,所以先將URL編碼*/
             var taskUrl = new Uri(url, UriKind.Absolute);
             (view as WebBrowser).Navigate(new Uri(taskUrl.AbsoluteUri, UriKind.Absolute));
         }
         catch
         {
             view = new TextBlock { Text = "對不起,係統無法找到您需要導航的頁麵", Foreground = new SolidColorBrush() { Color = Colors.Red } };
         }
     }
     else
     {
         view = new XamHtmlViewer() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch };
         try
         {
             (view as XamHtmlViewer).SourceUri = new Uri(url, UriKind.Absolute);
         }
         catch
         {
             view = new TextBlock { Text = "對不起,係統無法找到您需要導航的頁麵", Foreground = new SolidColorBrush() { Color = Colors.Black }, FontSize = 13 };
         }
     }
     return view;
 }
開發者ID:SaintLoong,項目名稱:PD,代碼行數:37,代碼來源:HtmlView.cs

示例15: LogInWindow

 public LogInWindow(WebBrowser wBroser)
 {
     Width = 500;
     Height = 400;
     Title = "LogIn to Last.fm";
     AddChild(wBroser);
 }
開發者ID:gricore,項目名稱:GrigLastfmApi,代碼行數:7,代碼來源:LogInWindow.cs


注:本文中的System.Windows.Controls.WebBrowser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。