Пример #1
0
        private static RowSourceInfo MakeRowSource <T>(SkylineDataSchema dataSchema, string name, Func <IEnumerable <T> > rowProvider)
        {
            var parentColumn = ColumnDescriptor.RootColumn(dataSchema, typeof(T));
            var viewInfo     = new ViewInfo(parentColumn, GetDefaultViewInfo(parentColumn).GetViewSpec().SetName(name));

            return(RowSourceInfo.DeferredRowSourceInfo(rowProvider, viewInfo));
        }
Пример #2
0
        public static ListViewContext CreateListViewContext(SkylineDataSchema dataSchema, string listName)
        {
            var listItemType         = ListItemTypes.INSTANCE.GetListItemType(listName);
            var rootColumn           = ColumnDescriptor.RootColumn(dataSchema, listItemType);
            var rowSourceConstructor = typeof(ListRowSource <>).MakeGenericType(listItemType)
                                       .GetConstructor(new[] { typeof(SkylineDataSchema) });
            // ReSharper disable PossibleNullReferenceException
            var rowSource = (IRowSource)rowSourceConstructor.Invoke(new object[] { dataSchema });
            // ReSharper restore PossibleNullReferenceException
            var rowSourceInfo = new RowSourceInfo(listItemType, rowSource, new[] { GetDefaultViewInfo(rootColumn) },
                                                  LIST_ROWSOURCE_PREFIX + listName, listName);

            return(new ListViewContext(dataSchema, listName, rowSourceInfo));
        }
Пример #3
0
        public static AuditLogForm MakeAuditLogForm(SkylineWindow skylineWindow)
        {
            var dataSchema = new SkylineDataSchema(skylineWindow, SkylineDataSchema.GetLocalizedSchemaLocalizer());
            var viewInfos  = new[]
            {
                CreateAuditLogViewInfo(dataSchema, AuditLogStrings.AuditLogForm_MakeAuditLogForm_Undo_Redo, @"TimeStamp", @"UndoRedoMessage"),
                CreateAuditLogViewInfo(dataSchema, AuditLogStrings.AuditLogForm_MakeAuditLogForm_Summary, @"TimeStamp", @"SummaryMessage"),
                CreateAuditLogViewInfo(dataSchema, AuditLogStrings.AuditLogForm_MakeAuditLogForm_All_Info, @"TimeStamp", @"Details!*.AllInfoMessage")
            };

            var rowSource     = new AuditLogRowSource(dataSchema);
            var rowSourceInfo = new RowSourceInfo(typeof(AuditLogRow), rowSource, viewInfos);
            var viewContext   = new SkylineViewContext(dataSchema, new[] { rowSourceInfo });

            return(new AuditLogForm(viewContext, viewInfos[2].Name));
        }
Пример #4
0
 public void AddRef()
 {
     if (Interlocked.Increment(ref _referenceCount) == 1)
     {
         _skylineDataSchema = new SkylineDataSchema(GroupComparisonModel.DocumentContainer,
                                                    SkylineDataSchema.GetLocalizedSchemaLocalizer());
         var viewInfo = new ViewInfo(_skylineDataSchema, typeof(FoldChangeRow), GetDefaultViewSpec(new FoldChangeRow[0]))
                        .ChangeViewGroup(ViewGroup.BUILT_IN);
         var rowSourceInfo = new RowSourceInfo(typeof(FoldChangeRow), new StaticRowSource(new FoldChangeRow[0]), new[] { viewInfo });
         ViewContext        = new GroupComparisonViewContext(_skylineDataSchema, new[] { rowSourceInfo });
         _container         = new Container();
         _bindingListSource = new BindingListSource(_container);
         _bindingListSource.SetViewContext(ViewContext, viewInfo);
         GroupComparisonModel.ModelChanged += GroupComparisonModelOnModelChanged;
         GroupComparisonModelOnModelChanged(GroupComparisonModel, new EventArgs());
     }
 }
Пример #5
0
        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;
        }
Пример #6
0
 private ListViewContext(SkylineDataSchema schema, string listName, RowSourceInfo rowSource)
     : base(schema, new[] { rowSource })
 {
     ListName     = listName;
     ListItemType = ListItemTypes.INSTANCE.GetListItemType(listName);
 }