本文整理汇总了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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例8: ThreadPageManager
public ThreadPageManager(WebBrowser browser, ThreadPageContextMenuProvider threadMenu,
SolidColorBrush foreground, SolidColorBrush background)
: this(browser, threadMenu)
{
this._fg = foreground;
this._bg = background;
}
示例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;
};
}
示例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);
}
示例11: TridentBrowser
public TridentBrowser()
{
Child = r_Browser = new WebBrowser();
r_Browser.Navigated += (s, e) => SuppressScriptError();
r_Browser.LoadCompleted += (s, e) => ExtractFlash();
}
示例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);
//}
}
示例13: LoginPage
public LoginPage()
{
InitializeComponent();
//Initialize _webBrowser
_webBrowser = new WebBrowser();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
示例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;
}
示例15: LogInWindow
public LogInWindow(WebBrowser wBroser)
{
Width = 500;
Height = 400;
Title = "LogIn to Last.fm";
AddChild(wBroser);
}