本文整理汇总了C#中System.Windows.Controls.WebBrowser类的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser类的具体用法?C# WebBrowser怎么用?C# WebBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebBrowser类属于System.Windows.Controls命名空间,在下文中一共展示了WebBrowser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: WebBrowserEx
public WebBrowserEx()
{
_webBrowser = new WebBrowser();
AddVisualChild(_webBrowser);
// Create a binding between the
// HwndHostExtensions.CopyBitsBehaviorProperty on the child
// WebBrowser and the CopyBitsBehaviorProperty on this object.
Binding bindingCopyBitsBehavior = new Binding("CopyBitsBehavior");
bindingCopyBitsBehavior.Source = this;
bindingCopyBitsBehavior.Mode = BindingMode.TwoWay;
_webBrowser.SetBinding(HwndHostExtensions.CopyBitsBehaviorProperty, bindingCopyBitsBehavior);
// Create a binding between the
// WebBrowserExtensions.SuppressScriptErrorsProperty on the child
// WebBrowser and the SuppressScriptErrorsProperty on this object.
Binding bindingSuppressScriptErrors = new Binding("SuppressScriptErrors");
bindingSuppressScriptErrors.Source = this;
bindingSuppressScriptErrors.Mode = BindingMode.TwoWay;
_webBrowser.SetBinding(WebBrowserExtensions.SuppressScriptErrorsProperty, bindingSuppressScriptErrors);
// Create a binding between the
// WebBrowserExtensions.SuppressEraseBackgroundProperty on the child
// WebBrowser and the SuppressEraseBackgroundProperty on this object.
Binding bindingSuppressEraseBackground = new Binding("SuppressEraseBackground");
bindingSuppressEraseBackground.Source = this;
bindingSuppressEraseBackground.Mode = BindingMode.TwoWay;
_webBrowser.SetBinding(WebBrowserExtensions.SuppressEraseBackgroundProperty, bindingSuppressEraseBackground);
}
开发者ID:JazzFisch,项目名称:AnotherCombatManager,代码行数:29,代码来源:WebBrowserEx.cs
示例17: Page
public Page(string path, TextEditor viewer, WebBrowser webviewer) {
Viewer = viewer;
WebViewer = webviewer;
Root = path;
if (File.Exists(Root + @"\__page.cfg")) {
try
{
Config = JObject.Parse(File.ReadAllText(Root + @"\__page.cfg", Encoding.UTF8));
Title = (string) Config["title"] ?? path.Split('\\').Last();
}catch(Exception)
{
Config = new JObject();
Title = path.Split('\\').Last();
}
}
else
{
Config = new JObject();
Title = path.Split('\\').Last();
}
Childs = new List<Page>();
Item = new TreeViewItem { Header = Title };
Item.Selected += Click;
foreach (var dir in Directory.EnumerateDirectories(Root)) {
var p = new Page(dir, viewer, webviewer);
Childs.Add(p);
Item.Items.Add(p.Item);
}
}
开发者ID:averrin,项目名称:Ravenor.net,代码行数:29,代码来源:Tree.cs
示例18: OnUrlChangedImp
void OnUrlChangedImp(DependencyPropertyChangedEventArgs e)
{
if (e.NewValue == null && _wb == null)
return;
Uri result;
Uri.TryCreate((string)e.NewValue, UriKind.Absolute, out result);
if (result == null && _wb == null)
return;
if(result == null)
{
IsUnempty = false;
_wb.NavigateToString(empty_content);
_wb.Height = 0.0;
return;
}
if(_wb == null)
{
_wb = new WebBrowser(){Height= 330};
_wb.Navigating += OnNavigating;
LayoutRoot.Children.Clear();
LayoutRoot.Children.Add(_wb);
}
else
{
_wb.Height = 330.0;
}
IsUnempty = true;
_wb.Navigate(result.AbsoluteUri);
}
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:29,代码来源:EmbedVideoPlayerControl.xaml.cs
示例19: SetVideo
/// <summary>
/// Create Video Player.
/// </summary>
/// <param name="video"></param>
private void SetVideo(string video)
{
var profile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
if (profile != null)
{
var interfaceType = profile.NetworkAdapter.IanaInterfaceType;
if (interfaceType == 71)
{
//Wifi
_youTubeButton = new YouTubeButton {YouTubeID = _videoId};
_youTubeButton.Click += youTubeButton_Click;
LayoutRoot.Children.Clear();
LayoutRoot.Children.Add(_youTubeButton);
}
else
{
//Other
var web = new WebBrowser()
{
Height = 600,
IsScriptEnabled = true
};
web.NavigateToString(string.Format("<!doctype html>" +
"<html><head><title></title></head><body style=background-color:black;>" +
"<iframe height=\"600\" src=\"http://www.youtube.com/embed/{0}\" width=\"1000\"></iframe>" +
"</body></html>", video));
LayoutRoot.Children.Clear();
LayoutRoot.Children.Add(web);
}
}
}
开发者ID:ledgarl,项目名称:Samples,代码行数:39,代码来源:YouTubePlayer.xaml.cs
示例20: MyMapView_MapViewTapped
private async void MyMapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
{
MyMapView.Overlays.Items.Clear();
IEnumerable<KmlFeature> features = await (MyMapView.Map.Layers["kmlLayer"] as KmlLayer).HitTestAsync(MyMapView, e.Position);
if (features.Count() > 0)
{
if (!string.IsNullOrWhiteSpace(features.FirstOrDefault().BalloonStyle.FormattedText))
{
//Create WebBrowser to show the formatted text
var browser = new System.Windows.Controls.WebBrowser();
browser.NavigateToString(features.FirstOrDefault().BalloonStyle.FormattedText);
//Get the KmlPlacemark position
var featurePosition = (features.FirstOrDefault() as KmlPlacemark).Extent;
//Create ContentControl
var cControl = new ContentControl()
{
Content = browser,
MaxHeight = 500,
MaxWidth = 450
};
//Add the ContentControl to MapView.Overlays
MapView.SetViewOverlayAnchor(cControl, featurePosition.GetCenter());
MyMapView.Overlays.Items.Add(cControl);
}
}
}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:32,代码来源:KMLPopups.xaml.cs
注:本文中的System.Windows.Controls.WebBrowser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论