public void FillBuildReport([CanBeNull] GitRevision revision) { SetSelectedRevision(revision); _tabControl.SuspendLayout(); try { var buildResultPageEnabled = IsBuildResultPageEnabled(); var buildInfoIsAvailable = !string.IsNullOrEmpty(revision?.BuildStatus?.Url); if (buildResultPageEnabled && buildInfoIsAvailable) { if (_buildReportTabPage == null) { CreateBuildReportTabPage(_tabControl); } _buildReportTabPage.Controls.Clear(); SetTabPageContent(revision); var isFavIconMissing = _buildReportTabPage.ImageIndex < 0; if (isFavIconMissing || _tabControl.SelectedTab == _buildReportTabPage) { LoadReportContent(revision, isFavIconMissing); } if (!_tabControl.Controls.Contains(_buildReportTabPage)) { _tabControl.Controls.Add(_buildReportTabPage); } } else { if (_buildReportTabPage != null && _buildReportWebBrowser != null && _tabControl.Controls.Contains(_buildReportTabPage)) { _buildReportWebBrowser.Stop(); _buildReportWebBrowser.Document.Write(string.Empty); _tabControl.Controls.Remove(_buildReportTabPage); } } } finally { _tabControl.ResumeLayout(); } }
public void FillBuildReport([CanBeNull] GitRevision revision) { if (_selectedGitRevision != null) { _selectedGitRevision.PropertyChanged -= RevisionPropertyChanged; } _selectedGitRevision = revision; if (_selectedGitRevision != null) { _selectedGitRevision.PropertyChanged += RevisionPropertyChanged; } _tabControl.SuspendLayout(); try { var buildInfoIsAvailable = !string.IsNullOrEmpty(revision?.BuildStatus?.Url); if (buildInfoIsAvailable) { if (_buildReportTabPage == null) { CreateBuildReportTabPage(_tabControl); } var isFavIconMissing = _buildReportTabPage.ImageIndex < 0; if (isFavIconMissing || _tabControl.SelectedTab == _buildReportTabPage) { try { if (revision.BuildStatus.ShowInBuildReportTab) { _url = null; _buildReportWebBrowser.Navigate(revision.BuildStatus.Url); } else { _url = revision.BuildStatus.Url; _buildReportWebBrowser.Navigate("about:blank"); } if (isFavIconMissing) { _buildReportWebBrowser.Navigated += BuildReportWebBrowserOnNavigated; } } catch { // No propagation to the user if the report fails } } if (!_tabControl.Controls.Contains(_buildReportTabPage)) { _tabControl.Controls.Add(_buildReportTabPage); } } else { if (_buildReportTabPage != null && _tabControl.Controls.Contains(_buildReportTabPage)) { _buildReportWebBrowser.Stop(); _buildReportWebBrowser.Document.Write(string.Empty); _tabControl.Controls.Remove(_buildReportTabPage); } } } finally { _tabControl.ResumeLayout(); } }