Example #1
0
        public static void CatchErrors(this IAsyncContinuation continuation, Action action, Action final)
        {
#if SILVERLIGHT && !WIN8
            Deployment.Current.Dispatcher.BeginInvoke(() =>
             {
#endif
                 try
                 {
                     action();
                 }
                 catch (Exception ex)
                 {
                     if (ExceptionUtilities.IsCatchable(ex))
                     {
                         continuation.Fail(ex);
                     }
                 }
                 finally
                 {
                     if (final != null)
                     {
                         CatchErrors(continuation, final);
                     }
                 }
#if SILVERLIGHT && !WIN8
             });
#endif
        }
Example #2
0
 public static void CatchErrors(this IAsyncContinuation continuation, Action action, Action final)
 {
     try
     {
         action();
     }
     catch (Exception ex)
     {
         if (ExceptionUtilities.IsCatchable(ex))
         {
             continuation.Fail(ex);
         }
     }
     finally
     {
         if (final != null)
         {
             CatchErrors(continuation, final);
         }
     }
 }