Ejemplo n.º 1
0
        internal void Initialize(IServiceProvider services, RootComponentList rootComponents)
        {
            Services = services;

            MainWindow = new PhotinoWindow()
                         .SetTitle("Photino.Blazor App")
                         .SetUseOsDefaultLocation(false)
                         .SetWidth(1000)
                         .SetHeight(900)
                         .SetLeft(450)
                         .SetTop(100);

            MainWindow.RegisterCustomSchemeHandler(PhotinoWebViewManager.BlazorAppScheme, HandleWebRequest);

            // 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.
            string hostPage       = "index.html";
            var    contentRootDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot");
            var    fileProvider   = new PhysicalFileProvider(contentRootDir);

            var dispatcher   = new PhotinoDispatcher(MainWindow);
            var jsComponents = new JSComponentConfigurationStore();

            WindowManager  = new PhotinoWebViewManager(MainWindow, services, dispatcher, new Uri(PhotinoWebViewManager.AppBaseUri), fileProvider, jsComponents, hostPage);
            RootComponents = new BlazorWindowRootComponents(WindowManager, jsComponents);
            foreach (var component in rootComponents)
            {
                RootComponents.Add(component.Item1, component.Item2);
            }
        }
Ejemplo n.º 2
0
 internal BlazorWindowRootComponents(PhotinoWebViewManager manager, JSComponentConfigurationStore jsComponents)
 {
     _manager     = manager;
     JSComponents = jsComponents;
 }