public static void NavigateForResult <TActivity, TParameters, TResult>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IAndroidView <IViewModelWithResultHandler> fromView,
            [CanBeNull] TParameters parameters,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TActivity : Activity, IActivityView <IViewModelWithParameters <TParameters> >, IActivityView <IViewModelWithResult <TResult> >
            where TParameters : ViewModelParametersBase
            where TResult : ViewModelResultBase
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            var activity           = fromView.GetActivity();
            var targetActivityType = typeof(TActivity);
            var intent             = new Intent(activity, targetActivityType);

            intent.PutViewModelParameters(parameters);
            var requestCode = RequestCode.Get <TResult>(activity, targetActivityType);

            (navigationStrategy ?? NavigationStrategy.Forward.Default()).Invoke(fromView, requestCode, intent);
        }
Esempio n. 2
0
 public static void testc()
 {
     NavigationServiceBase.Init(this.MainFrame);
     NotificationService.Init(this.NotificationDisplay);
     MsgBoxService.Init(this.MessageBoxDisplay);
     PopupService.Init(this.PopupDisplay);
 }
Esempio n. 3
0
        public DefaultViewModel()
        {
            this.BackCommand = new RelayCommand(delegate
            {
                this.OnBackPressed();
                NavigationServiceBase.GoBack();
            }
                                                );
            this.ShareCommand = new RelayCommand(delegate
            {
                this.Share();
            }
                                                 , () => this.CanShare);



            State = new GlobalState();
            try
            {
                FillSessionDataFromDB();
            }
            catch
            {
                AppDatabase.Current.RecreateSystemData();
                FillSessionDataFromDB();
            }
        }
Esempio n. 4
0
        public static void NavigateForResult <TViewController, TResult>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IIosView <IViewModelWithResultHandler> fromView,
            [NotNull] TViewController toView,
            bool animated,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TViewController : UIViewController, IIosView <IViewModelWithResult <TResult> >
            where TResult : ViewModelResultBase
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }
            if (toView == null)
            {
                throw new ArgumentNullException(nameof(toView));
            }

            toView.ResultSetWeakSubscribe(fromView.HandleResult);
            var navigationController = fromView.GetNavigationController();

            (navigationStrategy ?? NavigationStrategy.Forward.Default()).Invoke(navigationController, toView, animated);
        }
Esempio n. 5
0
        public static void Navigate <TViewController>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IIosView fromView,
            [NotNull] TViewController toView,
            bool animated,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TViewController : UIViewController
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }
            if (toView == null)
            {
                throw new ArgumentNullException(nameof(toView));
            }

            var navigationController = fromView.GetNavigationController();

            (navigationStrategy ?? NavigationStrategy.Forward.Default()).Invoke(navigationController, toView, animated);
        }
            internal XboxShellViewModelNowPlayingOverlayCoordinator(XboxShellView appShellView, NavigationServiceBase navigationService)
            {
                if (appShellView == null)
                {
                    throw new ArgumentNullException(nameof(appShellView));
                }
                parentShell = appShellView;
                parentShell.NowPlayingPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

                navManager = navigationService;

                backHandler = new EventHandler <NavigationManagerPreBackRequestedEventArgs>(async(o, e) =>
                {
                    if (isOverlayAnimating)
                    {
                        return;
                    }

                    if (IsOverlayVisible())
                    {
                        //hack to handle the back button.
                        e.Handled = true;
                        await HideOverlayAsync();
                    }
                });

                nowPlayingPage = parentShell.NowPlayingPanel.Children[0] as XboxNowPlayingPage;
            }
Esempio n. 7
0
            internal AppShellViewModelNowPlayingOverlayCoordinator(AppShellView appShellView)
            {
                if (appShellView == null)
                {
                    throw new ArgumentNullException(nameof(appShellView));
                }
                parentShell = appShellView;
                parentShell.NowPlayingPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

                navManager = WindowManager.GetNavigationManagerForCurrentView().GetNavigationServiceFromFrameLevel(FrameLevel.Two);
            }
        public static void NavigateBack(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IActivityView fromView,
            [CanBeNull] BackwardNavigationDelegate navigationStrategy = null)
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            (navigationStrategy ?? NavigationStrategy.Backward.Default()).Invoke(fromView);
        }
Esempio n. 9
0
        internal void SetNavigationService(NavigationServiceBase navService)
        {
            if (navService == null)
            {
                throw new ArgumentNullException(nameof(navService));
            }

            if (inlineNavigationService != null)
            {
                //unsubscribe from the previous nav service
                ((FrameNavigationService)inlineNavigationService).Navigated -= NepAppUIManager_Navigated;
            }

            inlineNavigationService = navService;
            ((FrameNavigationService)inlineNavigationService).Navigated += NepAppUIManager_Navigated;
        }
Esempio n. 10
0
        public MasterPage(bool goToSearch = false)
        {
            this.InitializeComponent();

            NavigationServiceBase.Init(this.MainFrame);
            NotificationService.Init(this.NotificationDisplay);
            MsgBoxService.Init(this.MessageBoxDisplay);
            PopupService.Init(this.PopupDisplay);


            if (goToSearch)
            {
                //this.MainFrame.Navigate(typeof(SearchResultsView));
                NavigationService.Navigate("SearchResultsView");
            }
            else
            {
                NavigationService.Navigate("SplashScreenView");
            }
        }
        public static void Navigate <TActivity>(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IAndroidView fromView,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TActivity : Activity, IActivityView <IViewModelWithoutParameters>
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            var activity           = fromView.GetActivity();
            var targetActivityType = typeof(TActivity);
            var intent             = new Intent(activity, targetActivityType);

            (navigationStrategy ?? NavigationStrategy.Forward.Default()).Invoke(fromView, null, intent);
        }
        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);
        }
Esempio n. 13
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 static void Navigate(
            [NotNull] this NavigationServiceBase navigationService,
            [NotNull] IAndroidView fromView,
            [NotNull] Type toViewType,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
        {
            if (navigationService == null)
            {
                throw new ArgumentNullException(nameof(navigationService));
            }
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }
            if (toViewType == null)
            {
                throw new ArgumentNullException(nameof(toViewType));
            }

            var activity = fromView.GetActivity();
            var intent   = new Intent(activity, toViewType);

            (navigationStrategy ?? NavigationStrategy.Forward.Default()).Invoke(fromView, null, intent);
        }