public static void NavigateBack <TResult>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IActivityView <IViewModelWithResult <TResult> > fromView,
            ViewModelResultCode resultCode,
            [CanBeNull] TResult result,
            [CanBeNull] BackwardNavigationDelegate navigationStrategy = null)
            where TResult : ViewModelResultBase
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            var intent = new Intent();

            intent.PutViewModelResult(result);
            fromView.SetResult(resultCode.ToResult(), intent);
            (navigationStrategy ?? NavigationStrategy.Backward.Default()).Invoke(fromView);
        }
示例#2
0
        public static void NavigateBack <TResult>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IIosView <IViewModelWithResult <TResult> > fromView,
            ViewModelResultCode resultCode,
            [CanBeNull] TResult result,
            bool animated,
            [CanBeNull] BackwardNavigationDelegate navigationStrategy = null)
            where TResult : ViewModelResultBase
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            fromView.SetResult(resultCode, result);
            var navigationController = fromView.GetNavigationController();

            (navigationStrategy ?? NavigationStrategy.Backward.Default()).Invoke(navigationController, fromView, animated);
        }
 public ViewModelResultSetEventArgs(ViewModelResultCode resultCode, [CanBeNull] ViewModelResultBase result)
 {
     ResultCode = resultCode;
     Result     = result;
 }
 public static Result ToResult(this ViewModelResultCode resultCode)
 {
     return((Result)resultCode);
 }