protected virtual void OnBeforeEnvironmentCreated(BeforeEnvironmentCreatedEventArgs e) { if (BeforeEnvironmentCreated != null) { BeforeEnvironmentCreated(this, e); } }
protected override void CreateHandle() { base.CreateHandle(); if (!DesignMode) { if (_webViewEnvironment == null) { BeforeEnvironmentCreatedEventArgs eventArgs = new BeforeEnvironmentCreatedEventArgs(); OnBeforeEnvironmentCreated(eventArgs); string browserExecutableFolder = eventArgs.BrowserExecutableFolder ?? string.Empty; string userDataFolder = eventArgs.UserDataFolder ?? string.Empty; string browserArguments = eventArgs.BrowserArguments ?? string.Empty; //WebView2Loader.CreateEnvironmentWithDetails(string.Empty, string.Empty, string.Empty, OnWebView2EnvironmentCreated); WebView2Loader.CreateEnvironmentWithDetails(browserExecutableFolder, userDataFolder, browserArguments, OnWebView2EnvironmentCreated); } else { _webViewEnvironment.CreateWebView(Handle, OnWebViewCreated); } } }