コード例 #1
0
ファイル: SyncRelationship.cs プロジェクト: yvanam/SyncPro
        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
ファイル: SyncRelationship.cs プロジェクト: yvanam/SyncPro
        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);
        }