Exemple #1
0
        /// <summary>
        /// Called when the sync is over
        /// </summary>
        public virtual async Task <SyncContext> EndSessionAsync(SyncContext context)
        {
            // already ended
            lock (this)
            {
                if (!this.syncInProgress)
                {
                    return(context);
                }
            }

            context.SyncStage = SyncStage.EndSession;

            // Progress & interceptor
            var sessionArgs = new SessionEndArgs(context, null, null);

            this.ReportProgress(context, sessionArgs);
            await this.InterceptAsync(sessionArgs);

            lock (this)
            {
                this.syncInProgress = false;
            }

            return(context);
        }
Exemple #2
0
        /// <summary>
        /// Called when the sync is over
        /// </summary>
        public virtual async Task <SyncContext> EndSessionAsync(SyncContext context,
                                                                CancellationToken cancellationToken, IProgress <ProgressArgs> progress = null)
        {
            context.SyncStage = SyncStage.EndSession;

            // Progress & interceptor
            var sessionArgs = new SessionEndArgs(context, null, null);

            this.ReportProgress(context, progress, sessionArgs);
            await this.InterceptAsync(sessionArgs).ConfigureAwait(false);


            return(context);
        }
Exemple #3
0
        /// <summary>
        /// Called when the sync is over
        /// </summary>
        public async Task EndSessionAsync(CancellationToken cancellationToken = default, IProgress <ProgressArgs> progress = null)
        {
            if (!this.StartTime.HasValue)
            {
                this.StartTime = DateTime.UtcNow;
            }

            // Get context or create a new one
            var ctx = this.GetContext();

            ctx.SyncStage = SyncStage.EndSession;

            // Progress & interceptor
            var sessionArgs = new SessionEndArgs(ctx, null, null);

            await this.InterceptAsync(sessionArgs, cancellationToken).ConfigureAwait(false);

            this.ReportProgress(ctx, progress, sessionArgs);
        }