public void ShowPreview() { var viewContext = GetViewContext(false); var viewInfo = viewContext.GetViewInfo(SelectedViewName); var form = new DocumentGridForm(viewContext) { ViewInfo = viewInfo, Text = Resources.ExportLiveReportDlg_ShowPreview_Preview__ + viewInfo.Name, ShowViewsMenu = false, }; form.Show(Owner); }
public override void Preview(Control owner, ViewInfo viewInfo) { string title; if (string.IsNullOrEmpty(viewInfo.Name)) { title = Resources.DocumentGridViewContext_Preview_Preview_New_Report; } else { title = string.Format(Resources.DocumentGridViewContext_Preview_Preview___0_, viewInfo.Name); } var dialog = new DocumentGridForm(this) { ViewInfo = viewInfo, ShowViewsMenu = false, Text = title, }; dialog.ShowDialog(owner); }
void documentGrid_FormClosed(object sender, FormClosedEventArgs e) { _documentGridForm = null; }
private void DestroyDocumentGrid() { if (null != _documentGridForm) { _documentGridForm.FormClosed -= documentGrid_FormClosed; _documentGridForm.Close(); _documentGridForm = null; } }
private DocumentGridForm CreateDocumentGrid() { Assume.IsNull(_documentGridForm); _documentGridForm = new DocumentGridForm(this); _documentGridForm.FormClosed += documentGrid_FormClosed; if (!string.IsNullOrEmpty(Settings.Default.DocumentGridView)) { var viewName = ViewName.Parse(Settings.Default.DocumentGridView); if (viewName.HasValue) { _documentGridForm.DataboundGridControl.ChooseView(viewName.Value); } } return _documentGridForm; }
public void ShowDocumentGrid(bool show) { if (show) { if (_documentGridForm != null && !Program.SkylineOffscreen) { _documentGridForm.Activate(); } else { _documentGridForm = _documentGridForm ?? CreateDocumentGrid(); if (_documentGridForm != null) { var rectFloat = GetFloatingRectangleForNewWindow(); _documentGridForm.Show(dockPanel, rectFloat); } } } else { if (_documentGridForm != null) { _documentGridForm.Close(); } } }
private void EnsureTruncatedPrecursorsView(DocumentGridForm documentGrid) { bool hasTruncatedPrecursorsView = false; RunUI(() => hasTruncatedPrecursorsView = null != documentGrid.BindingListSource.ViewContext.GetViewInfo( PersistedViews.MainGroup.Id.ViewName(TRUNCATED_PRECURSORS_VIEW_NAME))); if (!hasTruncatedPrecursorsView) AddTruncatedPrecursorsView(documentGrid, false); }
private void AddTruncatedPrecursorsView(DocumentGridForm documentGrid, bool initialTestExecution) { RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Precursors)); WaitForCondition(() => (documentGrid.RowCount > 0)); // Let it initialize var viewEditor = ShowDialog<ViewEditor>(documentGrid.NavBar.CustomizeView); RunUI(() => { viewEditor.ViewName = TRUNCATED_PRECURSORS_VIEW_NAME; viewEditor.ChooseColumnsTab.RemoveColumns(2, viewEditor.ChooseColumnsTab.ColumnCount); Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Parse("Replicates!*"))); viewEditor.ChooseColumnsTab.AddSelectedColumn(); viewEditor.ChooseColumnsTab.ExpandPropertyPath( PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*"), true); // Make the view editor bigger so that these expanded nodes can be seen in the next screenshot viewEditor.Height = Math.Max(viewEditor.Height, 529); Assert.IsTrue( viewEditor.ChooseColumnsTab.TrySelect( PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*.Value.CountTruncated"))); viewEditor.ChooseColumnsTab.AddSelectedColumn(); }); if (initialTestExecution) PauseForScreenShot<ViewEditor.ChooseColumnsView>("Customize View form", 17); RunUI(() => { viewEditor.ActivatePropertyPath( PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*.Value.CountTruncated")); viewEditor.TabControl.SelectTab(1); int iFilter = viewEditor.ViewInfo.Filters.Count; viewEditor.FilterTab.AddSelectedColumn(); viewEditor.FilterTab.SetFilterOperation(iFilter, FilterOperations.OP_IS_GREATER_THAN); viewEditor.FilterTab.SetFilterOperand(iFilter, 0.ToString()); }); if (initialTestExecution) PauseForScreenShot<ViewEditor.ChooseColumnsView>("Customize View - Filter tab", 18); OkDialog(viewEditor, viewEditor.OkDialog); var pathTruncated = PropertyPath.Parse("Results!*.Value.CountTruncated"); int expectedItems = 148; if (IsFullData) expectedItems = initialTestExecution ? 222 : 221; try { WaitForConditionUI(1000, () => documentGrid.RowCount == expectedItems && documentGrid.FindColumn(pathTruncated) != null); } catch (AssertFailedException) { RunUI(() => Assert.AreEqual(expectedItems, documentGrid.RowCount)); } RunUI(() => { var columnTruncated = documentGrid.FindColumn(pathTruncated); documentGrid.DataGridView.Sort(columnTruncated, ListSortDirection.Descending); FormEx.GetParentForm(documentGrid).Size = new Size(514, 315); }); if (initialTestExecution) PauseForScreenShot<DocumentGridForm>("Document Grid", 19); }
public DataGridViewColumn FindDocumentGridColumn(DocumentGridForm documentGrid, string colName) { WaitForConditionUI(() => documentGrid.IsComplete && documentGrid.FindColumn(PropertyPath.Parse(colName)) != null); return documentGrid.FindColumn(PropertyPath.Parse(colName)); }
public void EnableDocumentGridColumns(DocumentGridForm documentGrid, string viewName, int expectedRows, string[] colNames) { RunUI(() => documentGrid.ChooseView(viewName)); WaitForCondition(() => (documentGrid.RowCount == expectedRows)); // Let it initialize RunDlg<ViewEditor>(documentGrid.NavBar.CustomizeView, viewEditor => { foreach (var colName in colNames) { Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Parse(colName))); viewEditor.ChooseColumnsTab.AddSelectedColumn(); } viewEditor.ViewName = viewName; viewEditor.OkDialog(); }); }