public Task LoadBrowserUri(string uri) { Uri = uri; if (HelpViewWrapper == null) { IsViewAvailable = false; } else { IsViewAvailable = true; HelpViewWrapper.WebBrowser.NavigationService.NavigationFailed += (sender, args) => { ResourcePath = FileHelper.GetFullPath(StringResources.Uri_Studio_PageNotAvailable); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(ResourcePath); HelpViewWrapper.CircularProgressBarVisibility = Visibility.Collapsed; HelpViewWrapper.WebBrowserVisibility = Visibility.Visible; }); }; HelpViewWrapper.WebBrowser.LoadCompleted += (sender, args) => Execute.OnUIThread(() => { HelpViewWrapper.CircularProgressBarVisibility = Visibility.Collapsed; HelpViewWrapper.WebBrowserVisibility = Visibility.Visible; }); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(Uri); }); } return(Task.FromResult(true)); }
void SetupFailedNavigationEvent() { HelpViewWrapper.WebBrowser.NavigationService.NavigationFailed += (sender, args) => { ResourcePath = FileHelper.GetFullPath(StringResources.Uri_Studio_PageNotAvailable); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(ResourcePath); HelpViewWrapper.CircularProgressBarVisibility = Visibility.Collapsed; HelpViewWrapper.WebBrowserVisibility = Visibility.Visible; }); }; }
public Task LoadBrowserUri(string uri) { Uri = uri; if (HelpViewWrapper == null) { IsViewAvailable = false; } else { IsViewAvailable = true; SetupFailedNavigationEvent(); SetupLoadCompletedEvent(); SetupNavigationCompletdEvent(); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(Uri); }); } return(Task.FromResult(true)); }
public async Task LoadBrowserUri(string uri) { Uri = uri; if (HelpViewWrapper == null) { IsViewAvailable = false; } else { IsViewAvailable = true; //_network.HasConnectionAsync(uri).ContinueWith(task => //{ //var hasConnection = task.Result; var hasConnection = await _network.HasConnectionAsync(uri); if (hasConnection) { HelpViewWrapper.WebBrowser.Navigated += (sender, args) => SuppressJavaScriptsErrors(HelpViewWrapper.WebBrowser); HelpViewWrapper.WebBrowser.LoadCompleted += (sender, args) => Execute.OnUIThread(() => { HelpViewWrapper.CircularProgressBarVisibility = Visibility.Collapsed; HelpViewWrapper.WebBrowserVisibility = Visibility.Visible; }); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(Uri); }); } else { ResourcePath = FileHelper.GetFullPath(StringResources.Uri_Studio_PageNotAvailable); Execute.OnUIThread(() => { HelpViewWrapper.Navigate(ResourcePath); HelpViewWrapper.CircularProgressBarVisibility = Visibility.Collapsed; HelpViewWrapper.WebBrowserVisibility = Visibility.Visible; }); } //}); } }