Пример #1
0
        public AnalyzeJob BeginAnalyzeJob(bool startJob)
        {
            if (this.ActiveJob != null)
            {
                throw new InvalidOperationException("An ActiveJob is already present.");
            }

            AnalyzeJob newJob = new AnalyzeJob(this);

            newJob.Started  += this.JobStarted;
            newJob.Finished += this.JobFinished;

            if (startJob)
            {
                newJob.Start();
            }

            return(newJob);
        }
Пример #2
0
        public JobBase BeginSyncJob(
            SyncTriggerType syncTriggerType,
            AnalyzeRelationshipResult previousResult)
        {
            if (this.ActiveJob != null)
            {
                throw new InvalidOperationException("An ActiveJob is already present.");
            }

            if (previousResult == null)
            {
                AnalyzeJob newAnalyzeJob = new AnalyzeJob(this);

                newAnalyzeJob.ContinuationJob = new SyncJob(this, newAnalyzeJob.AnalyzeResult)
                {
                    TriggerType = syncTriggerType
                };

                newAnalyzeJob.Started  += this.JobStarted;
                newAnalyzeJob.Finished += this.JobFinished;

                newAnalyzeJob.ContinuationJob.Started  += this.JobStarted;
                newAnalyzeJob.ContinuationJob.Finished += this.JobFinished;

                newAnalyzeJob.Start();

                return(newAnalyzeJob);
            }

            SyncJob newJob = new SyncJob(this, previousResult)
            {
                TriggerType = syncTriggerType
            };

            newJob.Started  += this.JobStarted;
            newJob.Finished += this.JobFinished;

            newJob.Start();

            return(newJob);
        }