예제 #1
0
 public virtual void Cancel(IImageLoaderTask task)
 {
     try
     {
         if ((task != null) && !task.IsCancelled && !task.IsCompleted)
             task.Cancel();
     }
     catch (Exception e)
     {
         Logger.Error(string.Format("Cancelling task failed: {0}", task?.Key), e);
     }
     finally
     {
         task?.Dispose();
         EvictStaleTasks();
     }
 }
예제 #2
0
		/// <summary>
		/// Cancels any pending work for the task.
		/// </summary>
		/// <param name="task">Image loading task to cancel</param>
		/// <returns><c>true</c> if this instance cancel task; otherwise, <c>false</c>.</returns>
		public void Cancel(IImageLoaderTask task)
		{
			try
			{
				if (task != null && !task.IsCancelled && !task.Completed)
				{
					task.Cancel();
				}
			}
			catch (Exception e)
			{
				_logger.Error("Exception occurent trying to cancel the task", e);
			}
			finally
			{
				if (task != null && task.IsCancelled)
					task.Parameters.Dispose(); // this will ensure we don't keep a reference due to callbacks
			}
		}
 public virtual void Cancel(IImageLoaderTask task)
 {
     try
     {
         if (task != null && !task.IsCancelled && !task.IsCompleted)
         {
             task.Cancel();
         }
     }
     catch (Exception e)
     {
         Logger.Error(string.Format("Cancelling task failed: {0}", task?.Key), e);
     }
     finally
     {
         task?.Dispose();
         EvictStaleTasks();
     }
 }
예제 #4
0
 /// <summary>
 /// Cancels any pending work for the task.
 /// </summary>
 /// <param name="task">Image loading task to cancel</param>
 /// <returns><c>true</c> if this instance cancel task; otherwise, <c>false</c>.</returns>
 public void Cancel(IImageLoaderTask task)
 {
     try
     {
         if (task != null && !task.IsCancelled && !task.Completed)
         {
             task.Cancel();
         }
     }
     catch (Exception e)
     {
         _logger.Error("Exception occurent trying to cancel the task", e);
     }
     finally
     {
         if (task != null && task.IsCancelled)
         {
             task.Parameters.Dispose();                     // this will ensure we don't keep a reference due to callbacks
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Cancel any loading work for the given ImageView
 /// </summary>
 /// <param name="task">Image loading task to cancel.</param>
 public void CancelWorkFor(IImageLoaderTask task)
 {
     task?.Cancel();
 }