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


C# Workspace.SetTaskScheduler方法代码示例

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


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

示例1: TestChromatogramGenerator

        public void TestChromatogramGenerator()
        {
            String dbPath = Path.Combine(TestContext.TestDir, "test" + Guid.NewGuid() + ".tpg");
            using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory(dbPath, SessionFactoryFlags.CreateSchema))
            {
                using (var session = sessionFactory.OpenSession())
                {
                    session.BeginTransaction();
                    DbWorkspace dbWorkspace = new DbWorkspace
                    {
                        TracerDefCount = 1,
                    };
                    session.Save(dbWorkspace);
                    DbTracerDef dbTracerDef = TracerDef.GetN15Enrichment();
                    dbTracerDef.Workspace = dbWorkspace;
                    dbTracerDef.Name = "Tracer";

                    session.Save(dbTracerDef);
                    session.Save(new DbSetting
                                     {
                                         Workspace = dbWorkspace,
                                         Name = SettingEnum.data_directory.ToString(),
                                         Value = GetDataDirectory()
                                     });
                    session.Transaction.Commit();
                }
            }
            Workspace workspace = new Workspace(dbPath);
            workspace.SetTaskScheduler(TaskScheduler.Default);
            var dbMsDataFile = new DbMsDataFile
                {
                    Name = "20090724_HT3_0",
                };
            using (var session = workspace.OpenWriteSession())
            {
                session.BeginTransaction();
                session.Save(dbMsDataFile);
                session.Transaction.Commit();
            }
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            var msDataFile = workspace.MsDataFiles.FindByKey(dbMsDataFile.GetId());
            Assert.IsTrue(MsDataFileUtil.InitMsDataFile(workspace, msDataFile));
            DbPeptide dbPeptide;
            using (var session = workspace.OpenWriteSession())
            {
                session.BeginTransaction();
                dbPeptide = new DbPeptide
                {
                    Protein = "TestProtein",
                    Sequence = "YLAAYLLLVQGGNAAPSAADIK",
                    FullSequence = "K.YLAAYLLLVQGGNAAPSAADIK.A",
                };
                session.Save(dbPeptide);
                var searchResult = new DbPeptideSpectrumMatch
                {
                    Peptide = dbPeptide,
                    MsDataFile = session.Load<DbMsDataFile>(msDataFile.Id),
                    PrecursorCharge = 3,
                    RetentionTime = 20.557 * 60,
                };
                session.Save(searchResult);
                session.Transaction.Commit();
            }
            var peptide = new Peptide(workspace, dbPeptide);
            var peptideAnalysis = peptide.EnsurePeptideAnalysis();
            peptideAnalysis.IncChromatogramRefCount();
            var peptideFileAnalysis = PeptideFileAnalysis.EnsurePeptideFileAnalysis(peptideAnalysis, msDataFile);
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            peptideAnalysis.IncChromatogramRefCount();
            var chromatogramGenerator = new ChromatogramGenerator(workspace);
            chromatogramGenerator.Start();
            while (peptideFileAnalysis.ChromatogramSet == null)
            {
                Thread.Sleep(100);
            }
            var chromatogramDatas = peptideFileAnalysis.GetChromatograms();
            Assert.IsFalse(chromatogramDatas.Chromatograms.Count == 0);
            chromatogramGenerator.Stop();
            while (chromatogramGenerator.IsThreadAlive)
            {
                Thread.Sleep(100);
            }
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:83,代码来源:ChromatogramGeneratorTest.cs

示例2: CreateWorkspace

        protected Workspace CreateWorkspace(string path, DbTracerDef dbTracerDef)
        {
            using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory(path, SessionFactoryFlags.CreateSchema))
            {
                using (var session = sessionFactory.OpenSession())
                {
                    var transaction = session.BeginTransaction();
                    var dbWorkspace = new DbWorkspace
                    {
                        ModificationCount = 1,
                        TracerDefCount = dbTracerDef == null ? 0 : 1,
                        SchemaVersion = WorkspaceUpgrader.CurrentVersion,
                    };
                    session.Save(dbWorkspace);
                    if (dbTracerDef != null)
                    {
                        dbTracerDef.Workspace = dbWorkspace;
                        dbTracerDef.Name = "Tracer";
                        session.Save(dbTracerDef);
                    }

                    var modification = new DbModification
                    {
                        DeltaMass = 57.021461,
                        Symbol = "C",
                        Workspace = dbWorkspace
                    };
                    session.Save(modification);
                    transaction.Commit();
                }

            }
            var workspace = new Workspace(path);
            workspace.SetTaskScheduler(TaskScheduler.Default);
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            return workspace;
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:37,代码来源:BaseTest.cs

示例3: TestPeakFinder

        // TODO(nicksh): 2013-10-03: Re-enable this test once it reliably passes
        //[TestMethod]
        public void TestPeakFinder()
        {
            String dbPath = Path.Combine(TestContext.TestDir, "PeakFinderTest.tpg");
            using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory(dbPath, SessionFactoryFlags.CreateSchema))
            {
                using (var session = sessionFactory.OpenSession())
                {
                    session.BeginTransaction();
                    DbWorkspace dbWorkspace = new DbWorkspace
                    {
                        TracerDefCount = 1,
                        SettingCount = 2,
                        SchemaVersion = WorkspaceUpgrader.CurrentVersion
                    };
                    session.Save(dbWorkspace);
                    DbTracerDef dbTracerDef = TracerDef.GetD3LeuEnrichment();
                    dbTracerDef.Workspace = dbWorkspace;
                    dbTracerDef.Name = "Tracer";

                    session.Save(dbTracerDef);
                    session.Save(new DbSetting
                                     {
                                         Workspace = dbWorkspace,
                                         Name = SettingEnum.data_directory.ToString(),
                                         Value = GetDataDirectory()
                                     });
                    session.Save(new DbSetting
                                     {
                                         Workspace = dbWorkspace,
                                         Name = SettingEnum.mass_accuracy.ToString(),
                                         Value = "100000"
                                     });
                    session.Transaction.Commit();
                }
            }
            Workspace workspace = new Workspace(dbPath);
            workspace.SetTaskScheduler(TaskScheduler.Default);
            workspace.DatabasePoller.LoadAndMergeChanges(null);

            foreach (var peakFinderPeptide in peptides)
            {
                AddPeptide(workspace, peakFinderPeptide);
            }
            while (true)
            {
                string statusMessage;
                int progress;
                workspace.ChromatogramGenerator.GetProgress(out statusMessage, out progress);
                if ("Idle" == statusMessage)
                {
                    break;
                }
                Thread.Sleep(100);
            }
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            var exceptions = new List<Exception>();
            foreach (var peptide in peptides)
            {
                try
                {
                    TestPeptide(workspace, peptide);
                }
                catch (Exception exception)
                {
                    exceptions.Add(exception);
                    Trace.TraceError("{0}:{1}", peptide.PeptideSequence, exception);
                }
            }
            CollectionAssert.AreEqual(new Exception[0], exceptions);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:72,代码来源:PeakFinderTest.cs


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