public AuditLogForm(SkylineViewContext viewContext) : base(viewContext, AuditLogStrings.AuditLogForm_AuditLogForm_Audit_Log) { InitializeComponent(); _skylineWindow = viewContext.SkylineDataSchema.SkylineWindow; _clearLogButton = new ToolStripButton(AuditLogStrings.AuditLogForm_AuditLogForm_Clear_log); _enableAuditLogging = new CheckBox { Text = AuditLogStrings.AuditLogForm_AuditLogForm_Enable_audit_logging, Checked = Settings.Default.AuditLogging, BackColor = Color.Transparent }; var checkBoxHost = new ToolStripControlHost(_enableAuditLogging) { Alignment = ToolStripItemAlignment.Right }; NavBar.BindingNavigator.Items.Add(_clearLogButton); NavBar.BindingNavigator.Items.Add(checkBoxHost); if (!string.IsNullOrEmpty(Settings.Default.AuditLogView)) { var viewName = ViewName.Parse(Settings.Default.AuditLogView); if (viewName.HasValue) { DataboundGridControl.ChooseView(viewName.Value); } } }
private void UpdateViewContext() { RememberActiveView(); IRowSource rowSource = null; Type rowType = null; string builtInViewName = null; if (_selectedIdentityPaths.Count == 1) { var identityPath = _selectedIdentityPaths[0]; if (identityPath.Length == 2) { rowSource = new PeptideResultList(new Peptide(_dataSchema, identityPath)); rowType = typeof(PeptideResult); builtInViewName = "Peptide Results"; // Not L10N } else if (identityPath.Length == 3) { rowSource = new PrecursorResultList(new Precursor(_dataSchema, identityPath)); rowType = typeof(PrecursorResult); builtInViewName = "Precursor Results"; // Not L10N } else if (identityPath.Length == 4) { rowSource = new TransitionResultList(new Transition(_dataSchema, identityPath)); rowType = typeof(TransitionResult); builtInViewName = "Transition Results"; // Not L10N } } else { // ReSharper disable PossibleMultipleEnumeration var pathLengths = _selectedIdentityPaths.Select(path => path.Length).Distinct().ToArray(); if (pathLengths.Length == 1) { var pathLength = pathLengths[0]; if (pathLength == 3) { rowSource = new MultiPrecursorResultList(_dataSchema, _selectedIdentityPaths.Select(idPath => new Precursor(_dataSchema, idPath))); rowType = typeof(MultiPrecursorResult); builtInViewName = "Multiple Precursor Results"; // Not L10N } if (pathLength == 4) { rowSource = new MultiTransitionResultList(_dataSchema, _selectedIdentityPaths.Select(idPath => new Transition(_dataSchema, idPath))); rowType = typeof(MultiTransitionResult); builtInViewName = "Multiple Transition Results"; // Not L10N } } // ReSharper restore PossibleMultipleEnumeration } if (rowSource == null) { rowSource = new ReplicateList(_dataSchema); rowType = typeof(Replicate); builtInViewName = "Replicates"; // Not L10N } var parentColumn = ColumnDescriptor.RootColumn(_dataSchema, rowType); var builtInViewSpec = SkylineViewContext.GetDefaultViewInfo(parentColumn).GetViewSpec() .SetName(builtInViewName).SetRowType(rowType); if (null == BindingListSource.ViewContext || !BindingListSource.ViewContext.GetViewSpecList(ViewGroup.BUILT_IN.Id).ViewSpecs.Contains(builtInViewSpec)) { var oldViewContext = BindingListSource.ViewContext as ResultsGridViewContext; if (null != oldViewContext) { oldViewContext.RememberColumnWidths(DataGridView); } Debug.Assert(null != builtInViewName); var builtInView = new ViewInfo(parentColumn, builtInViewSpec).ChangeViewGroup(ViewGroup.BUILT_IN); var rowSourceInfo = new RowSourceInfo(rowSource, builtInView); var viewContext = new ResultsGridViewContext(_dataSchema, new[] { rowSourceInfo }); ViewInfo activeView = null; string activeViewName; if (Settings.Default.ResultsGridActiveViews.TryGetValue(rowSourceInfo.Name, out activeViewName)) { activeView = viewContext.GetViewInfo(ViewName.Parse(activeViewName)); } activeView = activeView ?? builtInView; BindingListSource.SetViewContext(viewContext, activeView); } BindingListSource.RowSource = rowSource; }