/// <summary> /// Constructs an instance of <see cref="BlazorWindow"/>. /// </summary> /// <param name="title">The window title.</param> /// <param name="hostPage">The path to the host page.</param> /// <param name="services">The service provider.</param> /// <param name="configureWindow">A callback that configures the window.</param> public BlazorWindow( string title, string hostPage, IServiceProvider services, Action <PhotinoWindowOptions>?configureWindow = null) { _window = new PhotinoWindow(title, options => { options.CustomSchemeHandlers.Add(PhotinoWebViewManager.BlazorAppScheme, HandleWebRequest); configureWindow?.Invoke(options); }, width: 1600, height: 1200, left: 300, top: 300); // 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(Path.GetFullPath(hostPage)) !; var hostPageRelativePath = Path.GetRelativePath(contentRootDir, hostPage); var fileProvider = new PhysicalFileProvider(contentRootDir); var dispatcher = new PhotinoDispatcher(_window); var jsComponents = new JSComponentConfigurationStore(); _manager = new PhotinoWebViewManager(_window, services, dispatcher, new Uri(PhotinoWebViewManager.AppBaseUri), fileProvider, jsComponents, hostPageRelativePath); RootComponents = new BlazorWindowRootComponents(_manager, jsComponents); }
internal BlazorWindowRootComponents(PhotinoWebViewManager manager, JSComponentConfigurationStore jsComponents) { _manager = manager; JSComponents = jsComponents; }