internal bool TryGetResponseContentInternal(string uri, bool allowFallbackOnHostPage, out int statusCode, out string statusMessage, out Stream content, out IDictionary <string, string> headers) { var defaultResult = TryGetResponseContent(uri, allowFallbackOnHostPage, out statusCode, out statusMessage, out content, out headers); var hotReloadedResult = StaticContentHotReloadManager.TryReplaceResponseContent(_contentRootRelativeToAppRoot, uri, ref statusCode, ref content, headers); return(defaultResult || hotReloadedResult); }
private void StartWebViewCoreIfPossible() { if (!RequiredStartupPropertiesSet || _webviewManager != null) { return; } if (PlatformView == null) { throw new InvalidOperationException($"Can't start {nameof(BlazorWebView)} without platform web view instance."); } // We assume the host page is always in the root of the content directory, because it's // unclear there's any other use case. We can add more options later if so. var contentRootDir = Path.GetDirectoryName(HostPage !) ?? string.Empty; var hostPageRelativePath = Path.GetRelativePath(contentRootDir, HostPage !); var fileProvider = VirtualView.CreateFileProvider(contentRootDir); _webviewManager = new TizenWebViewManager( this, NativeWebView, Services !, new MauiDispatcher(Services !.GetRequiredService <IDispatcher>()), fileProvider, VirtualView.JSComponents, contentRootDir, hostPageRelativePath); StaticContentHotReloadManager.AttachToWebViewManagerIfEnabled(_webviewManager); VirtualView.BlazorWebViewInitializing(new BlazorWebViewInitializingEventArgs()); VirtualView.BlazorWebViewInitialized(new BlazorWebViewInitializedEventArgs { WebView = NativeWebView, }); if (RootComponents != null) { foreach (var rootComponent in RootComponents) { // Since the page isn't loaded yet, this will always complete synchronously _ = rootComponent.AddToWebViewManagerAsync(_webviewManager); } } _webviewManager.Navigate("/"); }