本文整理汇总了C#中Windows.UI.Xaml.Controls.WebView类的典型用法代码示例。如果您正苦于以下问题:C# WebView类的具体用法?C# WebView怎么用?C# WebView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebView类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了WebView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSchedule
public async Task<string> GetSchedule(string user)
{
StringBuilder sb = new StringBuilder();
try
{
UnityDataAccess uda = new UnityDataAccess();
// string sToken = await uda.GetToken(objUnityData.UnitySvcUser, objUnityData.UnitySvcPwd, user);
string strDate = DateTime.Now.ToString(@"MM/dd/yyyy");
string sJson = await uda.Magic("GetSchedule", objUnityData.UnityAppUser, objUnityData.UnityAppName, "", objUnityData.Token, strDate, "", "", "", "", "", "");
return sJson;
}
catch (Exception ex)
{
WebView wc = new WebView();
wc.NavigateToString(ex.Message);
Window.Current.Content = wc;
return "";
}
}
示例2: CheckingLoginByManualSuccess
public async void CheckingLoginByManualSuccess(WebView webView, bool isLoaded)
{
if (CheckInternetConnection() || isUserCancel)
return;
if (isLoaded)
{
NotifyDownloadStatus(DownloadStatus.LOADING, " ...");
bool success = await IsPageSuccess(webView);
if (success)
{
isReload = false;
NotifyCloseWebViewForm();
currentStep = STEP_ACCEPT;
NotifyDownloadStatus(DownloadStatus.PROCESSING, "60%");
browser.Navigate(new Uri(YAHOO_OAUTH2_URL));
return;
}
else
{
NotifyDownloadStatus(DownloadStatus.CONTINUE_LOGIN, "");
NotifyOpenWebViewForm();
System.Diagnostics.Debug.WriteLine("open form");
return;
}
}
}
示例3: NetWeb_DOMContentLoaded
private async void NetWeb_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
{
await NetWeb.InvokeScriptAsync("eval", new string[] { IPSource.IPHelper.GetDomain() });
NetWeb.DOMContentLoaded -= NetWeb_DOMContentLoaded;
await Task.Delay(2000);
await NetWeb.InvokeScriptAsync("eval", new string[] { IPSource.IPHelper.Script3 });
}
示例4: WebViewer_NavigationCompleted
private async void WebViewer_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
// Check if new location is redirect uri
if (args.Uri.AbsoluteUri.IndexOf(App.RedirectUri) == 0)
{
// Get parameters
var encoder = new WwwFormUrlDecoder(args.Uri.AbsoluteUri.Replace('#', '&')); // Replacing # with ? to make GetFirstValueByName() work
var accessToken = encoder.GetFirstValueByName("access_token");
var expires = encoder.GetFirstValueByName("expires");
if (!String.IsNullOrEmpty(accessToken))
{
// Success
App.AccessToken = accessToken;
App.Expires = expires;
Frame.GoBack();
var successDialog = new MessageDialog("Successfully logged in.", "Success!");
await successDialog.ShowAsync();
return;
}
// Show error message, if something went wrong
var errorDialog = new MessageDialog("Whoops, we could not log you in successfully. Sorry for that!", "Something went wrong...");
await errorDialog.ShowAsync();
Frame.GoBack();
}
}
示例5: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///SplitPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (NoelBlogReader.Common.LayoutAwarePage)this.FindName("pageRoot");
itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("itemsViewSource");
primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
contentViewBorder = (Windows.UI.Xaml.Controls.Border)this.FindName("contentViewBorder");
contentView = (Windows.UI.Xaml.Controls.WebView)this.FindName("contentView");
contentViewRect = (Windows.UI.Xaml.Shapes.Rectangle)this.FindName("contentViewRect");
itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
}
示例6: OnPrepareContent
/// <summary>
/// Called by the host when we should show content.
/// </summary>
/// <param name="post"></param>
public async void OnPrepareContent(Post post)
{
// So the loading UI
m_host.ShowLoading();
m_loadingHidden = false;
// Since some of this can be costly, delay the work load until we aren't animating.
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
{
lock(this)
{
if(m_isDestroyed)
{
return;
}
// Make the webview
m_webView = new WebView(WebViewExecutionMode.SeparateThread);
// Setup the listeners, we need all of these because some web pages don't trigger
// some of them.
m_webView.FrameNavigationCompleted += NavigationCompleted;
m_webView.NavigationFailed += NavigationFailed;
m_webView.DOMContentLoaded += DOMContentLoaded;
m_webView.ContentLoading += ContentLoading;
// Navigate
m_webView.Navigate(new Uri(post.Url, UriKind.Absolute));
ui_contentRoot.Children.Add(m_webView);
}
});
}
示例7: GoogleDownloadController
public GoogleDownloadController(AccountDB acc, AccountDownloadListener notify)
{
//browser = webBrowser;
browser = new WebView();
Init(acc, notify);
SetupWebBrowser();
}
示例8: Web_NavigationCompleted
private void Web_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
if (args.IsSuccess)
{
Value.Text = args.Uri.ToString();
}
}
示例9: loginWeb_NavigationStarting
private void loginWeb_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
{
if (args.Uri.AbsoluteUri.Contains("#"))
{
if (args.Uri.Fragment.StartsWith("#access_token="))
{
loginWeb.Stop();
string token = args.Uri.Fragment.Replace("#access_token=", string.Empty);
ApplicationData.Current.LocalSettings.Values[SharedStrings.AccessTokenKeyValue] = token;
SharedStrings.CurrentToken = token;
if (!fromMain)
{
if (!Frame.Navigate(typeof(MainPage)))
{
}
}
else
{
if (Frame.CanGoBack)
{
Frame.GoBack();
}
}
}
}
}
示例10: createWebView
internal async Task createWebView(Dictionary<string, object> options)
{
_browserWindow._window = await _browserWindow.createWindow(options);
string url;
if (options.ContainsKey(NKEBrowserOptions.kPreloadURL))
url = (string)options[NKEBrowserOptions.kPreloadURL];
else
url = NKEBrowserDefaults.kPreloadURL;
WebView webView = new WebView(WebViewExecutionMode.SeparateThread);
this.webView = webView;
_browserWindow.webView = webView;
_browserWindow._window.controls.Add(webView);
webView.Navigate(new Uri(url));
_browserWindow.context = await NKSMSWebViewContext.getScriptContext(_id, webView, options);
webView.NavigationStarting += WebView_NavigationStarting;
webView.NavigationCompleted += this.WebView_NavigationCompleted;
this.init_IPC();
this._type = NKEBrowserType.MSWebView.ToString();
if (options.itemOrDefault<bool>("NKE.InstallElectro", true))
await Renderer.addElectro(_browserWindow.context, options);
NKLogging.log(string.Format("+E{0} Renderer Ready", _id));
_browserWindow.events.emit("NKE.DidFinishLoad", _id);
}
示例11: OnDomContentLoaded
private async void OnDomContentLoaded(WebView sender,
WebViewDOMContentLoadedEventArgs args)
{
var model = Model;
await AutoFill(model.UserName, "username", "email", "login");
await AutoFill(model.Password, "password", "passwd");
}
示例12: MainPage
public MainPage()
{
WebView Navegador = new WebView();
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
Navegador.Navigate(new Uri("http://www.bing.com", UriKind.Absolute));
}
示例13: Browser_NavigationCompleted
private void Browser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
if (!args.IsSuccess)
{
Debug.WriteLine("Navigation to this page failed, check your internet connection.");
}
}
示例14: Web_OnNavigationStarting
private void Web_OnNavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
{
// WebView native object must be inserted in the OnNavigationStarting event handler
KeyHandler winRTObject = new KeyHandler();
// Expose the native WinRT object on the page's global object
Web.AddWebAllowedObject("NotifyApp", winRTObject);
}
示例15: EngagementPageOverlay
/// <summary>
/// Initializes a new instance of the <see cref="EngagementPageOverlay" /> class.
/// </summary>
public EngagementPageOverlay()
{
// Initialize the webview for notifications.
Banner = new WebView();
Banner.Name = BannerWebviewName;
Banner.Height = BannerHeight;
Banner.HorizontalAlignment = HorizontalAlignment.Stretch;
Banner.VerticalAlignment = VerticalAlignment.Top;
Banner.Visibility = Visibility.Collapsed;
// Initialize the webview for text\Web announcements and Polls.
Interstitial = new WebView();
Interstitial.Name = InterstitialWebviewName;
Interstitial.HorizontalAlignment = HorizontalAlignment.Stretch;
Interstitial.VerticalAlignment = VerticalAlignment.Stretch;
Interstitial.Visibility = Visibility.Collapsed;
// Initialize the webviews' container.
Container = new Grid();
Container.Name = OverlayContainerName;
// Add webviews to the container but leave the first index to the page's content.
Container.Children.Insert(1, Banner);
Container.Children.Insert(2, Interstitial);
}