Ejemplo n.º 1
0
        private void OnTaskCompletedEvent(bool result)
        {
            TaskCompletedEventHandler handler = TaskCompletedEvent;

            if (handler != null)
            {
                handler(this, result);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Raised Task Completed, when the thread is done after the UI returns to normal.
        /// </summary>
        /// <param name="propertyName">The property that has a new value.</param>
        public void OnTaskCompleted(bool failed, object state, string message)
        {
            TaskCompletedEventHandler handler = this.TaskCompleted;

            if (handler != null)
            {
                var e = new TaskCompletedEventArgs()
                {
                    Failed  = failed,
                    State   = state,
                    Message = message
                };
                handler(this, e);
            }
        }
Ejemplo n.º 3
0
 public static Task RemoveTaskCompletedEventHandlerAsync(this IDataBase dataBase, TaskCompletedEventHandler handler)
 {
     return(dataBase.Dispatcher.InvokeAsync(() => dataBase.TaskCompleted -= handler));
 }
Ejemplo n.º 4
0
 public static Task AddTaskCompletedEventHandlerAsync(this IUserContext userContext, TaskCompletedEventHandler handler)
 {
     return(userContext.Dispatcher.InvokeAsync(() => userContext.TaskCompleted += handler));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Always runs the specified action in the UI thread after the main <see cref="DoWork"/> action runs
 /// and after the <see cref="Succeed"/> or <see cref="Fail"/> callbacks have ran, regardless of
 /// whether the main <c>DoWork</c> action succeeded or failed.
 /// </summary>
 /// <param name="finally">Action to run in the UI thread</param>
 /// <returns>Reference to this <c>TaskBuilder</c></returns>
 public TaskBuilder Finally(TaskCompletedEventHandler @finally)
 {
     _finally = @finally;
     return(this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Always runs the specified action in the UI thread after the main <see cref="DoWork"/> action runs
 /// and after the <see cref="Succeed"/> or <see cref="Fail"/> callbacks have ran, regardless of
 /// whether the main <c>DoWork</c> action succeeded or failed.
 /// </summary>
 /// <param name="finally">Action to run in the UI thread</param>
 /// <returns>Reference to this <c>TaskBuilder</c></returns>
 public TaskBuilder Finally(TaskCompletedEventHandler @finally)
 {
     _finally = @finally;
     return this;
 }