/// <summary>
        /// Create a new instance of the TaskProgressMessage.
        /// </summary>
        /// <param name="completionPercentage"></param>
        /// <param name="elapsedMilliseconds"></param>
        /// <param name="activityMessage"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static TaskProgressMessage New(decimal completionPercentage, long elapsedMilliseconds = 0, string activityMessage = null, params object[] args)
        {
            var message = new TaskProgressMessage();

            if (activityMessage != null &&
                args != null)
            {
                activityMessage = string.Format(activityMessage, args);
            }

            message.SetProgress(completionPercentage, elapsedMilliseconds, activityMessage);

            return(message);
        }
        /// <summary>
        /// Determines if this message describes equivalent progress to another message.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool IsEquivalent(TaskProgressMessage obj)
        {
            var report = obj as TaskProgressMessage;

            if (report == null)
            {
                return(false);
            }

            if (CompletionPercentage == report.CompletionPercentage &&
                Message == report.Message &&
                Detail == report.Detail)
            {
                return(true);
            }

            return(false);
        }
 /// <summary>
 /// Send a notification to update the progress of the task.
 /// </summary>
 /// <param name="message"></param>
 public void UpdateTaskProgress(TaskProgressMessage message)
 {
     Clients.All.UpdateTaskProgress(message);
 }