private void _webView2Control_BrowserCreated(object sender, EventArgs e) { _settingsComponent = new SettingsComponent(_environment, _webView2Control); _fileComponent = new FileComponent(this, _webView2Control); _processComponent = new ProcessComponent(this, _webView2Control); _scriptComponent = new ScriptComponent(this, _webView2Control); _controlComponent = new ControlComponent(this, navigationToolBar, _webView2Control); _viewComponent = new ViewComponent(this, _webView2Control); if (_onWebViewFirstInitialized != null) { _onWebViewFirstInitialized.Invoke(); _onWebViewFirstInitialized = null; } if (!string.IsNullOrEmpty(_initialUrl)) { _webView2Control.Navigate(_initialUrl); } if (_newWindowRequestedEventArgs != null) { _newWindowRequestedEventArgs.NewWindow = _webView2Control.InnerWebView2WebView; _newWindowRequestedEventArgs.Handled = true; _newWindowDeferral.Complete(); _newWindowRequestedEventArgs = null; _newWindowDeferral = null; } }
protected override void OnNewWindowRequested(NewWindowRequestedEventArgs e) { PopupForm popupForm = new PopupForm(WebView2Environment, e); popupForm.Show(); base.OnNewWindowRequested(e); }
private void _webView2Control_NewWindowRequested(object sender, NewWindowRequestedEventArgs e) { IWebView2Deferral deferral = e.GetDeferral(); MainForm newWindow = new MainForm(e, deferral); newWindow.Show(); }
protected virtual void OnNewWindowRequested(NewWindowRequestedEventArgs e) { if (NewWindowRequested != null) { NewWindowRequested(this, e); } }
public PopupWindow(WebView2Environment environment, NewWindowRequestedEventArgs args) : this() { // Save the environment so we can create the webview _environment = environment; _args = args; // Get a deferral since we have to wait for the window creation to finish _deferral = _args.GetDeferral(); }
private async void OnNewWindowRequested(object sender, NewWindowRequestedEventArgs e) { var viewModel = await CreateNewTerminalWindow().ConfigureAwait(true); if (e.ShowProfileSelection) { await viewModel.AddConfigurableTerminal().ConfigureAwait(true); } else { viewModel.AddTerminal(); } }
protected override void OnClosed(EventArgs e) { if (_childWebView != null) { _childWebView.BrowserCreated -= _childWebView_BrowserCreated; _childWebView.DocumentTitleChanged -= _childWebView_DocumentTitleChanged; _childWebView.Dispose(); } _environment = null; _args = null; base.OnClosed(e); }
private async void OnNewWindowRequested(object sender, NewWindowRequestedEventArgs e) { await CreateNewTerminalWindow(string.Empty, e.ShowProfileSelection).ConfigureAwait(true); }
private async void OnNewWindowRequested(object sender, NewWindowRequestedEventArgs e) { ShellProfile profile = null; switch (e.Action) { case NewWindowAction.StartDefaultLocalTerminal: break; case NewWindowAction.ShowProfileSelection: profile = await _dialogService.ShowProfileSelectionDialogAsync(); if (profile == null) { // Nothing to do if user cancels. return; } break; case NewWindowAction.ShowSshProfileSelection: profile = await _dialogService.ShowSshProfileSelectionDialogAsync(); if (profile == null) { // Nothing to do if user cancels. return; } break; case NewWindowAction.ShowCustomCommandDialog: profile = await _dialogService.ShowCustomCommandDialogAsync(); if (profile == null) { // Nothing to do if user cancels. return; } break; case NewWindowAction.ShowSshInfoDialog: profile = await _dialogService.ShowSshConnectionInfoDialogAsync(); if (profile == null) { // Nothing to do if user cancels. return; } break; case NewWindowAction.StartLocalTerminal: profile = _settingsService.GetShellProfile(e.ProfileId); break; case NewWindowAction.StartSshTerminal: profile = _settingsService.GetSshProfile(e.ProfileId); break; default: throw new NotImplementedException("this ProfileSelection not implemented yet"); } var viewModel = await CreateNewTerminalWindow().ConfigureAwait(true); if (profile == null) { await viewModel.AddLocalTabAsync(); } else { await viewModel.AddTerminalAsync(profile); } }
private async void OnNewWindowRequested(object sender, NewWindowRequestedEventArgs e) { var viewModel = await CreateNewTerminalWindowAsync().ConfigureAwait(false); await viewModel.AddTabAsync(e.Profile).ConfigureAwait(false); }
public MainForm(NewWindowRequestedEventArgs args, IWebView2Deferral deferral) : this(string.Empty, null) { _newWindowRequestedEventArgs = args; _newWindowDeferral = deferral; }