コード例 #1
0
ファイル: SkylineGraphs.cs プロジェクト: lgatto/proteowizard
        private List<DockableForm> GetArrangeableGraphs(GroupGraphsOrder order, bool reversed)
        {
            List<DockPane> listPanes = dockPanel.Panes
                .Where(pane => !pane.IsHidden && pane.DockState == DockState.Document)
                .ToList();
            if (order == GroupGraphsOrder.Position)
            {
                listPanes.Sort((p1, p2) =>
                {
                    if (p1.Top != p2.Top)
                        return p1.Top - p2.Top;
                    return p1.Left - p2.Left;
                });
                if (reversed)
                    listPanes.Reverse();
            }

            var listGraphs = new List<DockableForm>();
            foreach (var pane in listPanes)
            {
                IEnumerable<IDockableForm> listForms = pane.Contents;
                if (order == GroupGraphsOrder.Position && reversed)
                    listForms = listForms.Reverse();
                foreach (DockableForm dockableForm in listForms)
                {
                    if (dockableForm.IsHidden || dockableForm.DockState != DockState.Document)
                        continue;
                    listGraphs.Add(dockableForm);
                }
            }

            if (order != GroupGraphsOrder.Position)
            {
                // Populate a dictionary with the desired document order
                var dictOrder = new Dictionary<DockableForm, int>();
                int iOrder = 0;
                if (_graphSpectrum != null)
                    dictOrder.Add(_graphSpectrum, iOrder++);
                if (_graphRetentionTime != null)
                    dictOrder.Add(_graphRetentionTime, iOrder++);
                if (_graphPeakArea != null)
                    dictOrder.Add(_graphPeakArea, iOrder++);
                if (DocumentUI.Settings.HasResults)
                {
                    var chromatograms = DocumentUI.Settings.MeasuredResults.Chromatograms.ToList();
                    if (order == GroupGraphsOrder.Acquired_Time)
                    {
                        chromatograms.Sort((c1, c2) =>
                        {
                            var time1 = GetRunStartTime(c1);
                            var time2 = GetRunStartTime(c2);
                            if (!time1.HasValue && !time2.HasValue)
                            {
                                return 0;
                            }
                            else if (!time1.HasValue)
                            {
                                return 1;
                            }
                            else if (!time2.HasValue)
                            {
                                return -1;
                            }
                            return time1.Value.CompareTo(time2.Value);
                        });
                    }
                    foreach (var chromatogramSet in chromatograms)
                    {
                        var graphChrom = GetGraphChrom(chromatogramSet.Name);
                        if (graphChrom != null)
                            dictOrder.Add(graphChrom, iOrder++);
                    }
                }
                // Make sure everything is represented, though it should
                // already be.
                foreach (var graph in listGraphs)
                {
                    int i;
                    if (!dictOrder.TryGetValue(graph, out i))
                        dictOrder.Add(graph, iOrder++);
                }

                // Sort the list of visible document panes by the document order
                // in the dictionary
                listGraphs.Sort((g1, g2) => dictOrder[g1] - dictOrder[g2]);
                if (reversed)
                    listGraphs.Reverse();
            }
            return listGraphs;
        }
コード例 #2
0
 public static GroupGraphsOrder GetEnum(string enumValue, GroupGraphsOrder defaultValue)
 {
     return(Helpers.EnumFromLocalizedString(enumValue, LOCALIZED_VALUES, defaultValue));
 }
コード例 #3
0
 public static string GetLocalizedString(this GroupGraphsOrder val)
 {
     return(LOCALIZED_VALUES[(int)val]);
 }
コード例 #4
0
 public static GroupGraphsOrder GetEnum(string enumValue, GroupGraphsOrder defaultValue)
 {
     return Helpers.EnumFromLocalizedString(enumValue, LOCALIZED_VALUES, defaultValue);
 }
コード例 #5
0
 private void RunGroupDlg(int numberOfGroups, DisplayGraphsType displayType, GroupGraphsType groupType, GroupGraphsOrder orderGraphs)
 {
     RunDlg <ArrangeGraphsGroupedDlg>(SkylineWindow.ArrangeGraphsGrouped, dlg =>
     {
         dlg.Groups      = numberOfGroups;
         dlg.DisplayType = displayType;
         dlg.GroupType   = groupType;
         dlg.GroupOrder  = orderGraphs;
         dlg.OkDialog();
     });
 }
コード例 #6
0
 private void RunGroupDlg(int numberOfGroups, DisplayGraphsType displayType, GroupGraphsType groupType, GroupGraphsOrder orderGraphs)
 {
     RunDlg<ArrangeGraphsGroupedDlg>(SkylineWindow.ArrangeGraphsGrouped, dlg =>
     {
         dlg.Groups = numberOfGroups;
         dlg.DisplayType = displayType;
         dlg.GroupType = groupType;
         dlg.GroupOrder = orderGraphs;
         dlg.OkDialog();
     });
 }