public void CloseBrowser(bool onlyIfIsAlternativeWindow = false) { if (!this.Visible || (onlyIfIsAlternativeWindow && !this.config.IsAlternativeWindow)) { return; } if (this.InvokeRequired) { this.BeginInvoke(new Action(() => this.CloseBrowser(onlyIfIsAlternativeWindow))); return; } this.Hide(); }