コード例 #1
0
ファイル: WinUIWebViewManager.cs プロジェクト: hevey/maui
 public WinUIWebViewManager(WebView2Control nativeWebView2, IWebView2Wrapper webview, IServiceProvider services, Dispatcher dispatcher, IFileProvider fileProvider, JSComponentConfigurationStore jsComponents, string hostPageRelativePath, string contentRootDir)
     : base(webview, services, dispatcher, fileProvider, jsComponents, hostPageRelativePath)
 {
     _nativeWebView2       = nativeWebView2;
     _hostPageRelativePath = hostPageRelativePath;
     _contentRootDir       = contentRootDir;
 }
コード例 #2
0
        /// <summary>
        /// Constructs an instance of <see cref="WebView2WebViewManager"/>.
        /// </summary>
        /// <param name="webview">A wrapper to access platform-specific WebView2 APIs.</param>
        /// <param name="services">A service provider containing services to be used by this class and also by application code.</param>
        /// <param name="dispatcher">A <see cref="Dispatcher"/> instance that can marshal calls to the required thread or sync context.</param>
        /// <param name="fileProvider">Provides static content to the webview.</param>
        /// <param name="hostPageRelativePath">Path to the host page within the <paramref name="fileProvider"/>.</param>
        public WebView2WebViewManager(IWebView2Wrapper webview, IServiceProvider services, Dispatcher dispatcher, IFileProvider fileProvider, string hostPageRelativePath)
            : base(services, dispatcher, new Uri(AppOrigin), fileProvider, hostPageRelativePath)
        {
            _webview = webview ?? throw new ArgumentNullException(nameof(webview));

            // Unfortunately the CoreWebView2 can only be instantiated asynchronously.
            // We want the external API to behave as if initalization is synchronous,
            // so keep track of a task we can await during LoadUri.
            _webviewReadyTask = InitializeWebView2();
        }
コード例 #3
0
 public WinUIWebViewManager(WebView2Control nativeWebView2, IWebView2Wrapper webview, IServiceProvider services, Dispatcher dispatcher, IFileProvider fileProvider, string hostPageRelativePath) : base(webview, services, dispatcher, fileProvider, hostPageRelativePath)
 {
     _nativeWebView2 = nativeWebView2;
 }