当前位置: 首页>>代码示例>>C#>>正文


C# ProgressCallback.Invoke方法代码示例

本文整理汇总了C#中ProgressCallback.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressCallback.Invoke方法的具体用法?C# ProgressCallback.Invoke怎么用?C# ProgressCallback.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgressCallback的用法示例。


在下文中一共展示了ProgressCallback.Invoke方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Minimize

        /// <summary>
        /// Collects statistics on how much space savings minimizing will achieve, and (if outStream
        /// is not null) writes out the minimized cache file.
        /// </summary>
        public void Minimize(Settings settings, ProgressCallback progressCallback, Stream outStream,
            FileStream outStreamScans = null, FileStream outStreamPeaks = null, FileStream outStreamScores = null)
        {
            var writer = outStream == null ? null : new Writer(ChromatogramCache, outStream, outStreamScans, outStreamPeaks, outStreamScores);
            var statisticsCollector = new MinStatisticsCollector(this);
            bool readChromatograms = settings.NoiseTimeRange.HasValue || writer != null;

            var chromGroupHeaderToIndex =
                ChromGroupHeaderInfos
                    .Select((cghi, index) => new KeyValuePair<ChromGroupHeaderInfo5, int>(cghi, index))
                    .ToDictionary(kvp => kvp.Key, kvp=>kvp.Value);
            var chromGroups = new ChromatogramGroupInfo[ChromGroupHeaderInfos.Count];
            var transitionGroups = new List<TransitionGroupDocNode>[ChromGroupHeaderInfos.Count];
            foreach (var nodePep in Document.Molecules)
            {
                foreach (var nodeGroup in nodePep.TransitionGroups)
                {
                    ChromatogramGroupInfo[] groupInfos;
                    ChromatogramCache.TryLoadChromatogramInfo(nodePep, nodeGroup, _tolerance, out groupInfos);
                    foreach (var chromGroupInfo in groupInfos)
                    {
                        int headerIndex = chromGroupHeaderToIndex[chromGroupInfo.Header];
                        if (chromGroups[headerIndex] == null)
                        {
                            chromGroups[headerIndex] = chromGroupInfo;
                            transitionGroups[headerIndex] = new List<TransitionGroupDocNode>();
                        }
                        transitionGroups[headerIndex].Add(nodeGroup);
                    }
                }
            }

            for (int iHeader = 0; iHeader < ChromGroupHeaderInfos.Count; iHeader++)
            {
                var chromGroupInfo = chromGroups[iHeader];
                IList<TransitionGroupDocNode> transitionGroupDocNodes;
                if (chromGroupInfo == null)
                {
                    chromGroupInfo = ChromatogramCache.LoadChromatogramInfo(ChromGroupHeaderInfos[iHeader]);
                    transitionGroupDocNodes = new TransitionGroupDocNode[0];
                }
                else
                {
                    transitionGroupDocNodes = transitionGroups[iHeader];
                }
                if (readChromatograms)
                {
                    try
                    {
                        chromGroupInfo.ReadChromatogram(ChromatogramCache);
                    }
                    catch (Exception exception)
                    {
                        Trace.TraceWarning("Unable to read chromatogram {0}", exception); // Not L10N
                    }
                }
                MinimizedChromGroup minimizedChromGroup = MinimizeChromGroup(settings,
                    chromGroupInfo, transitionGroupDocNodes);
                statisticsCollector.ProcessChromGroup(minimizedChromGroup);
                if (progressCallback != null)
                {
                    progressCallback.Invoke(statisticsCollector.GetStatistics());
                }
                if (writer != null)
                {
                    writer.WriteChromGroup(chromGroupInfo, minimizedChromGroup);
                }
                // Null out the ChromGroup in our array so it can be garbage collected.
                chromGroups[iHeader] = null;
            }
            if (progressCallback != null)
            {
                progressCallback.Invoke(statisticsCollector.GetStatistics());
            }
            if (writer != null)
            {
                writer.WriteEndOfFile();
            }
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:83,代码来源:ChromCacheMinimizer.cs


注:本文中的ProgressCallback.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。