/// <summary> /// Updates the specified key. /// </summary> /// <param name="key">The task key.</param> /// <param name="message">The message.</param> /// <param name="isProcessing">if set to <c>true</c> [is processing].</param> /// <param name="type">The type.</param> public void Update(string key, string message, bool isProcessing, BusyTaskType type) { var task = this[key]; task.Message = message; task.IsProcessing = isProcessing; task.Type = type; this.OnPropertyChanged(new PropertyChangedEventArgs("AggregateMessage")); }
/// <summary> /// Update a task status with an exception message. /// </summary> /// <param name="key">The key.</param> /// <param name="exception">The exception.</param> /// <param name="message">The message.</param> /// <param name="isProcessing">if set to <c>true</c> [is processing].</param> /// <param name="type">The type.</param> protected void UpdateTask(string key, Exception exception, string message = null, bool isProcessing = false, BusyTaskType type = BusyTaskType.Error) { if (exception != null) { #if DEBUG UpdateTask(key, isProcessing, message ?? exception.Message, type); #else UpdateTask(key, isProcessing, message ?? "An error occured. ", type); #endif } else { UpdateTask(key, isProcessing, message, BusyTaskType.Default); } }
/// <summary> /// Update a task status. /// </summary> /// <param name="key"></param> /// <param name="isProcessing"></param> /// <param name="type"></param> /// <param name="message"></param> protected void UpdateTask(string key, string message = null, bool isProcessing = false, BusyTaskType type = BusyTaskType.Default) { var task = Tasks[key]; if (task != null) { Tasks.Update(key, message, isProcessing, type); } else { task = new BusyTask { Key = key, IsGlobal = false, IsProcessing = isProcessing, Message = message, }; Tasks.Add(task); } }