Ejemplo n.º 1
0
 public static bool CancelNavigation(NavigationRequest navigationRequest)
 {
     Guard.ArgumentNotNull(navigationRequest, "navigationRequest");
     if (navigationRequest.Token == null || navigationRequest.Token.IsDisposed)
     {
         return(false);
     }
     else
     {
         navigationRequest.Token.Dispose();
         return(true);
     }
 }
Ejemplo n.º 2
0
        public static IDisposable Navigate(NavigationRequest navigationRequest, Action <ResponseStatus> statusCallback)
        {
            Guard.ArgumentNotNull(navigationRequest, "navigationRequest");

            var _defaultHandler = NavigationService.DefaultNavigationHandler;

            if (_defaultHandler == null)
            {
                statusCallback.Notify(ResponseStatus.HandlerNotFound);
                throw new NavigationException(NO_DEFAULT_HANDLERFOUND, ResponseStatus.HandlerNotFound, navigationRequest);
            }

            return(Navigate(navigationRequest, NavigationService.DefaultNavigationHandler, statusCallback));
        }
Ejemplo n.º 3
0
        public static void Resolve(NavigationRequest navigationRequest, Action <NavigationResponse> responseCallback)
        {
            Guard.ArgumentNotNull(navigationRequest, "navigationRequest");
            Guard.ArgumentNotNull(responseCallback, "responseCallback");

            // NOTE_: if the response is a navigation response, we send that else we wrap it in a navigation response
            // this is done because the api expects this.. we need this though, because if an error occurs we will
            // get back UrlResponse not NavigationResponse.. so..
            RoutingService.Resolve(navigationRequest, (r) =>
            {
                if (typeof(NavigationResponse).IsAssignableFrom(r.GetType()))
                {
                    responseCallback((NavigationResponse)r);
                }
                else
                {
                    responseCallback(new NavigationResponse(r));
                }
            });
        }
Ejemplo n.º 4
0
 public static void ProcessNavigationLifecycle(NavigationRequest request, ISupportNavigationLifecycle supporter,
                                               ISupportNavigationViewLifecycle viewSupporter, Action <bool> supporterCallback, Action viewSupporterCallback)
 {
     // we check if our current page supports ISupportNavigation, if so we defer to it
     if (supporter != null)
     {
         supporter.Closing((b) =>
         {
             supporterCallback(b);
             if (b)
             {
                 if (viewSupporter != null)
                 {
                     viewSupporter.Closing(request, () =>
                     {
                         viewSupporterCallback();
                     });
                 }
                 else
                 {
                     viewSupporterCallback();
                 }
             }
         });
     }
     else
     {
         supporterCallback(true);
         if (viewSupporter != null)
         {
             viewSupporter.Closing(request, () =>
             {
                 viewSupporterCallback();
             });
         }
         else
         {
             viewSupporterCallback();
         }
     }
 }
Ejemplo n.º 5
0
 public NavigationResponse(NavigationRequest request, ResponseStatus status, Object content,
                           ParametersCollection responseParameters)
     : this(request, status, content, responseParameters, null)
 {
 }
Ejemplo n.º 6
0
 public NavigationResponse(NavigationRequest request, ResponseStatus status, Object content,
                           ParametersCollection responseParameters, Exception exception)
     : base(request, status, content, responseParameters, exception)
 {
 }
Ejemplo n.º 7
0
 public NavigationException(string message, ResponseStatus status, NavigationRequest request, Exception innerException)
     : base(message, innerException)
 {
     _status  = status;
     _request = request;
 }
Ejemplo n.º 8
0
 public NavigationException(string message, ResponseStatus status, NavigationRequest request)
     : this(message, status, request, null)
 {
 }
Ejemplo n.º 9
0
 public static IDisposable Navigate(NavigationRequest navigationRequest, INavigationHandler navigationHandler)
 {
     return(Navigate(navigationRequest, navigationHandler, null));
 }
Ejemplo n.º 10
0
 public static IDisposable Navigate(NavigationRequest navigationRequest)
 {
     return(Navigate(navigationRequest, (Action <ResponseStatus>)null));
 }