Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PublishStatus"/> class.
 /// </summary>
 /// <param name="stage">The publish stage.</param>
 /// <param name="statusText">The status text.</param>
 /// <param name="progress">The progress.</param>
 /// <param name="initiatorId">The initiator id.</param>
 public PublishStatus(PublishStage stage, string statusText, double progress, Guid initiatorId)
 {
     Stage = stage.ToString();
     StatusText = statusText;
     Progress = progress;
     InitiatorId = initiatorId;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationHandler"/> class.
 /// </summary>
 /// <param name="stage">The stage.</param>
 /// <param name="statusText">The status text.</param>
 /// <param name="progress">The progress.</param>
 /// <param name="initiatorId">The initiator identifier.</param>
 public NotificationHandler(PublishStage stage, string statusText, double progress, Guid initiatorId)
 {
     _stage = stage;
     _statusText = statusText;
     _startDate = DateTime.Now;
     _progress = progress;
     _initiatorId = initiatorId;
 }
Пример #3
0
        /// <summary>
        /// Reports the progress of operation and stage completed by an external executable.
        /// </summary>
        /// <param name="instanceId">The instance id.</param>
        /// <param name="publishStage">The publish stage.</param>
        /// <param name="progressCounter">The progress counter.</param>
        void IPublishingProgressService.ReportProgress(Guid instanceId, PublishStage publishStage, ProgressCounter progressCounter)
        {
            try
            {
                var publishRequest = PublishQueueProcessor.RequestTracker.Where(request => request.InstanceId == instanceId).FirstOrDefault();
                if (publishRequest != default(PublishRequest))
                {
                    switch (publishStage)
                    {
                    case PublishStage.NotStarted:
                        break;

                    case PublishStage.Initiating:
                        break;

                    case PublishStage.FetchingResourceItems:
                        break;

                    case PublishStage.ProcessingResourceItems:
                        publishRequest.CurrentStatus.ResourceItems = progressCounter;
                        break;

                    case PublishStage.CreatingImages:
                        publishRequest.CurrentStatus.Images = progressCounter;
                        break;

                    case PublishStage.CreatingDeepZoomImages:
                        publishRequest.CurrentStatus.DeepZoomImages = progressCounter;
                        break;

                    case PublishStage.CreatingDeepZoomCollection:
                        break;

                    case PublishStage.DeletingExistingCollection:
                        break;

                    case PublishStage.CopyingNewCollection:
                        break;

                    case PublishStage.CopyingExistingCollection:
                        break;

                    case PublishStage.PerformingCleanup:
                        break;

                    case PublishStage.Completed:
                        publishRequest.PublishingCallback = null;
                        break;

                    case PublishStage.AbortedOnError:
                        publishRequest.PublishingCallback = null;
                        break;

                    case PublishStage.AbortedOnDemand:
                        publishRequest.PublishingCallback = null;
                        break;
                    }

                    if (publishRequest.CurrentStatus.CurrentStage != publishStage)
                    {
                        publishRequest.CurrentStatus.CurrentStage = publishStage;
                        publishRequest.SaveToDatabase(false);
                    }
                }
            }
            catch (Exception e)
            {
                Globals.TraceMessage(System.Diagnostics.TraceEventType.Error, e.ToString(), string.Format(Properties.Messages.ExceptionInReportProgress, instanceId, publishStage));
            }
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationHandler"/> class.
 /// </summary>
 /// <param name="stage">The stage.</param>
 /// <param name="statusText">The status text.</param>
 /// <param name="progress">The progress.</param>
 public NotificationHandler(PublishStage stage, string statusText, Exception progress)
 {
     RuntimeHub.NotifyPublishStatus(new PublishStatus(_stage, _statusText, _progress, _initiatorId));
 }
Пример #5
0
        /// <summary>
        /// Notifies the canceled.
        /// </summary>
        /// <param name="stage">
        /// The stage.
        /// </param>
        /// <param name="initiatorId">
        /// The initiator identifier.
        /// </param>
        /// <returns>
        /// The <see cref="PublishStatus"/>.
        /// </returns>
        public static PublishStatus NotifyCanceled(PublishStage stage, Guid initiatorId)
        {
            var publishStatus = new PublishStatus(stage, "Canceled", 100, initiatorId);

            RuntimeHub.NotifyPublishStatus(publishStatus);

            return publishStatus;
        }
Пример #6
0
        /// <summary>
        /// Notifies the failure.
        /// </summary>
        /// <param name="stage">
        /// The stage.
        /// </param>
        /// <param name="statusText">
        /// The status text.
        /// </param>
        /// <param name="exception">
        /// The exception.
        /// </param>
        /// <returns>
        /// The <see cref="PublishStatus"/>.
        /// </returns>
        public PublishStatus NotifyFailure(PublishStage stage, string statusText, Exception exception)
        {
            var publishStatus = new PublishStatus(stage, statusText, exception, _initiatorId);

            var aggregateException = exception as AggregateException;
            if (aggregateException != null)
            {
                var aex = aggregateException;
                if (aex.InnerExceptions.Any() && aex.InnerExceptions[0] is ProcessCompilationException)
                {
                    var pex = (ProcessCompilationException)aex.InnerExceptions[0];
                    publishStatus.BuildFailure = new BuildFailure(pex.Error.ErrorText, pex.Error.Line, pex.ProcessName, pex.IsServerSide);
                }
            }

            RuntimeHub.NotifyPublishStatus(publishStatus);
            _isCompleted = true;

            return publishStatus;
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PublishStatus"/> class.
 /// </summary>
 /// <param name="stage">The publish stage.</param>
 /// <param name="statusText">The status text.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="initiatorId">The initiator id.</param>
 public PublishStatus(PublishStage stage, string statusText, Exception exception, Guid initiatorId)
     : this(stage, statusText, 0, initiatorId)
 {
     if (exception != null)
         Exception = exception.ToString();
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PublishStatus"/> class.
 /// </summary>
 public PublishStatus()
 {
     this.stageStartTime = new SortedDictionary <PublishStage, DateTime>();
     this.CurrentStage   = PublishStage.NotStarted;
 }