Ejemplo n.º 1
0
 internal ProgressEventArgs(int progressId, DateTime startTime, IProgressReportSource source, string title, string details, ProgressEventArgsKind kind, ProgressEventArgsResult result)
 {
     ProgressId = progressId;
     StartTime  = startTime;
     FinishTime = startTime;
     Source     = source;
     Title      = title;
     Details    = details;
     Kind       = kind;
     Result     = result;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Reports a warning
        /// </summary>
        /// <param name="source"></param>
        /// <param name="title"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static int ReportWarning(this IProgressReportSource source, string title, ProgressEventArgsResult result = ProgressEventArgsResult.Normal)
        {
            if (ReferenceEquals(source.Progress, null) || source.Progress.Enabled == false)
            {
                return(-1);
            }

            var eventArgs =
                new ProgressEventArgs(
                    source.Progress.NextProgressId++,
                    DateTime.Now,
                    source,
                    title,
                    "",
                    ProgressEventArgsKind.Warning,
                    result
                    );

            return(source.Progress.OnProgressEvent(eventArgs));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reports the end of a process
        /// </summary>
        /// <param name="progressStartId"></param>
        /// <param name="source"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static int ReportFinish(this IProgressReportSource source, int progressStartId, ProgressEventArgsResult result = ProgressEventArgsResult.Normal)
        {
            if (ReferenceEquals(source.Progress, null) || source.Progress.Enabled == false)
            {
                return(-1);
            }

            var eventArgs =
                new ProgressEventArgs(
                    source.Progress.NextProgressId++,
                    DateTime.Now,
                    source,
                    "",
                    "",
                    ProgressEventArgsKind.Finish, result
                    );

            return(source.Progress.OnProgressEvent(eventArgs, progressStartId));
        }