Exemplo n.º 1
0
 public FormsFrameNavigationService(
     IPlatformNavigationService platformNavigationService,
     IContainer container)
 {
     _platformNavigationService = platformNavigationService;
     _container = container;
 }
 public FormsPageNavigationService(
     IContainer container,
     IPlatformNavigationService platformNavigationService)
 {
     _container = container;
     _platformNavigationService = platformNavigationService;
 }
Exemplo n.º 3
0
 public static IPlatformNavigationService SetAsWindowContent(this IPlatformNavigationService service, Window window, bool activate)
 {
     window.Content = service.GetXamlFrame();
     if (activate)
     {
         window.Activate();
     }
     return(service);
 }
Exemplo n.º 4
0
        public override void OnInitialized()
        {
            var frame = new Frame();

            NavigationService = Prism.Navigation.NavigationService
                                .Create(frame, Gestures.Back, Gestures.Forward, Gestures.Refresh);
            Window.Current.Content = frame;
            Window.Current.Activate();
        }
Exemplo n.º 5
0
 public PageNavigationService(
     IPlatformNavigationService platformNavigationService,
     IBackStackManager backStackManager,
     IContainer container)
 {
     _platformNavigationService = platformNavigationService;
     _backStackManager          = backStackManager;
     _container = container;
 }
Exemplo n.º 6
0
        internal FrameFacade(Frame frame, IPlatformNavigationService navigationService)
        {
            _frame = frame;
            _frame.ContentTransitions = new TransitionCollection();
            _frame.ContentTransitions.Add(new NavigationThemeTransition());
            _frame.RegisterPropertyChangedCallback(Frame.CanGoBackProperty, (s, p)
                                                   => CanGoBackChanged?.Invoke(this, EventArgs.Empty));
            _frame.RegisterPropertyChangedCallback(Frame.CanGoForwardProperty, (s, p)
                                                   => CanGoForwardChanged?.Invoke(this, EventArgs.Empty));

            _dispatcher        = frame.Dispatcher;
            _navigationService = navigationService;
        }
Exemplo n.º 7
0
        public PageNavigationServiceTests()
        {
            _viewModelStub      = new ViewModelStub();
            _platformNavService = Substitute.For <IPlatformNavigationService>();
            _backStackManager   = Substitute.For <IBackStackManager>();

            var serviceLocator = Substitute.For <IContainer>();

            serviceLocator.Resolve <ViewModelStub>().Returns(_viewModelStub);

            _pageNavigationService =
                new PageNavigationService(_platformNavService, _backStackManager, serviceLocator);
        }
Exemplo n.º 8
0
        internal FrameFacade(Frame frame, IPlatformNavigationService navigationService)
        {
            _frame = frame;
            _frame.ContentTransitions = new TransitionCollection
            {
                new NavigationThemeTransition()
            };
            _frame.RegisterPropertyChangedCallback(Frame.CanGoBackProperty, (s, p)
                                                   => CanGoBackChanged?.Invoke(this, EventArgs.Empty));
            _frame.RegisterPropertyChangedCallback(Frame.CanGoForwardProperty, (s, p)
                                                   => CanGoForwardChanged?.Invoke(this, EventArgs.Empty));

            _dispatcher        = frame.Dispatcher;
            _syncContext       = SynchronizationContext.Current;
            _navigationService = navigationService;
            _logger            = PrismApplicationBase.Current.Container.Resolve <ILoggerFacade>();
        }
Exemplo n.º 9
0
        public NavigationService([NotNull] NavigationServiceConfiguration configuration,
                                 [NotNull] IPlatformNavigationService platformNavigationService)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (platformNavigationService == null)
            {
                throw new ArgumentNullException("platformNavigationService");
            }

            Serializer                = configuration.Serializer;
            NavigationUriProvider     = configuration.NavigationUriProvider;
            PlatformNavigationService = platformNavigationService;
            Key = "NavigationContext";
            Debug.WriteLine("NavigationService::Ctor");
        }
Exemplo n.º 10
0
        public NavViewEx()
        {
            DefaultStyleKey = typeof(NavigationView);

            if (win.ApplicationModel.DesignMode.DesignModeEnabled ||
                win.ApplicationModel.DesignMode.DesignMode2Enabled)
            {
                return;
            }

            Content     = _frame = new Frame();
            _dispatcher = _frame.Dispatcher;

            _frame.Navigated += (s, e) =>
            {
                if (TryFindItem(e.SourcePageType, out var item))
                {
                    SetSelectedItem(item);
                }
            };

            NavigationService = new NavigationService(_frame);

            ItemInvoked += (s, e) =>
            {
                SelectedItem = (e.IsSettingsInvoked) ? SettingsItem : Find(e.InvokedItem.ToString());
            };
            RegisterPropertyChangedCallback(IsPaneOpenProperty, (s, e) => UpdatePaneHeaders());

            Window.Current.CoreWindow.SizeChanged += (s, e) =>
            {
                UpdatePageHeader();
            };

            Loaded += (s, e) =>
            {
                UpdatePaneHeaders();
                UpdatePageHeader();
            };
        }
        public async Task HandleActionAsync(IMvxNavigationService navigationService, IAlertService alertService, IMvxMessenger messenger, FeedActionModel model, string actionType = null, string AreaGUID = null)
        {
            _navigationService         = navigationService;
            _alertService              = alertService;
            _messenger                 = messenger;
            _platformNavigationService = Mvx.Resolve <IPlatformNavigationService>();
            if (model == null)
            {
                return;
            }
            if ((model.ActionScreen == ActionTypeConstants.ChallengeActionType || actionType == ActionTypeConstants.ReferralAcceptedActionType ||
                 actionType == ActionTypeConstants.ItbCompletedActionType || actionType == ActionTypeConstants.CtacActionType) && model.ActionScreen != ActionTypeConstants.DialogActionType)
            {
                OpenChallengeDetailsScreenWithURL(model.ActionParamDict[ActionTypeConstants.ChallengeDetailURLActionParamDict]);
                return;
            }
            if (model.ActionScreen == ActionTypeConstants.RewardActionType)
            {
                await SL.Manager.GetRewardByUrl(model.ActionParamDict[ActionTypeConstants.RewardDetailURLActionParamDict], GetRewardByUrlComplete);

                return;
            }
            if (model.ActionScreen == ActionTypeConstants.RewardListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.REWARDS);
            }
            if (model.ActionScreen == ActionTypeConstants.ChallengeListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.CHALLENGES);
            }
            if (model.ActionScreen == ActionTypeConstants.FeedActionType)
            {
                string feedUrl = string.Empty;
                model.ActionParamDict.TryGetValue(ActionTypeConstants.FeedURLActionParamDict, out feedUrl);
                if ((actionType == ActionTypeConstants.AggChalcompActionType) || (actionType == ActionTypeConstants.AggCommitActionType))
                {
                    await LoadFeedByUrl(feedUrl);
                }
                else
                {
                    await LoadFeedByUrl(feedUrl, true);
                }
            }
            if (model.ActionScreen == ActionTypeConstants.WebActionType)
            {
                string url    = string.Empty;
                bool   gotUrl = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out url);
                if (gotUrl == false)
                {
                    url = model.WebRequestURL;
                }
                if (url == string.Empty)
                {
                    _alertService.ShowToast("There isn't url to open");
                }
                _platformNavigationService.NavigateToUrl(url);
            }
            if (model.ActionScreen == ActionTypeConstants.SettingsActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.MORE);
            }
            if (model.ActionScreen == ActionTypeConstants.ShareActionType)
            {
                if (!model.ActionParamDict.ContainsKey(ActionTypeConstants.ChallengeDetailURLActionParamDict))
                {
                    return;
                }

                OpenChallengeDetailsScreenWithURL(model.ActionParamDict[ActionTypeConstants.ChallengeDetailURLActionParamDict]);
            }
            if (model.ActionScreen == ActionTypeConstants.SwitchAreaActionType)
            {
                await SwitchAreaIfNeeded(AreaGUID);
            }
            if (model.ActionScreen == ActionTypeConstants.InviteActionType)
            {
                await SL.Manager.RefreshShareTemplate(model.ActionParamDict[ActionTypeConstants.ShareTemplateURLActionParamDict], SendInviteMessage);
            }
            if (model.ActionScreen == ActionTypeConstants.DialogActionType)
            {
                var dialogStyle = model.ActionParamDict[ActionTypeConstants.DialogStyleActionParamDict];
                _dialogSubmisionUrl = model.ActionParamDict[ActionTypeConstants.SubmissionURLActionParamDict];

                var message = model.ActionParamDict[ActionTypeConstants.CaptionActionParamDict];
                if (dialogStyle != string.Empty)
                {
                    if (dialogStyle == ActionTypeConstants.NoneDialogStyle)
                    {
                    }
                    if (dialogStyle == ActionTypeConstants.EntryDialogStyle)
                    {
                        var result = await _alertService.ShowAlertWithInput("", message, string.Empty, "Ok", "Cancel");

                        Dismissed(result);
                    }
                }
            }

            if (model.ActionScreen == ActionTypeConstants.IWebActionType && actionType == ActionTypeConstants.CtaiwActionType)
            {
                string actionUrl = string.Empty;
                bool   gotUrl    = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out actionUrl);
                if (string.IsNullOrEmpty(actionUrl))
                {
                    var firstUrl = model.ActionParamDict.Values.Count > 0 ? model.ActionParamDict.Values.FirstOrDefault() : string.Empty;
                    actionUrl = model.ActionParamDict[ActionTypeConstants.WebRequestURLActionParamDict] ?? firstUrl;
                }
                if (gotUrl == false)
                {
                    //url = model.WebRequestURL;
                }
                if (string.IsNullOrEmpty(actionUrl))
                {
                    _alertService.ShowToast("There isn't url to open");
                    return;
                }

                //actionUrl = "https://goo.gl/?link=" + actionUrl;
                await _navigationService.Navigate <WebViewModel>();

                _messenger.Publish <MessangerWebModel>(new MessangerWebModel(this, actionUrl, true));
                return;
            }

            if (model.ActionScreen == ActionTypeConstants.IWebActionType)
            {
                string url    = string.Empty;
                bool   gotUrl = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out url);
                if (gotUrl == false)
                {
                    url = model.WebRequestURL;
                }
                if (url == string.Empty)
                {
                    _alertService.ShowToast("There isn't url to open");
                }
                _platformNavigationService.NavigateToUrl(url);
            }
            if (model.ActionScreen == ActionTypeConstants.ScoreActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.POINTS);
            }
            if (model.ActionScreen == ActionTypeConstants.FriendListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.POINTS);
            }
        }
Exemplo n.º 12
0
 public override void OnInitialized()
 {
     NavigationService = Prism.Navigation.NavigationService.Create(Gesture.Back, Gesture.Forward, Gesture.Refresh);
     NavigationService.SetAsWindowContent(Window.Current, activate: true);
 }
 internal static void SetNavigationService(this INavigationParameters parameters, IPlatformNavigationService service)
 {
     if ((parameters as INavigationParametersInternal).ContainsKey(nameof(NavigationService)))
     {
         (parameters as INavigationParametersInternal).Remove(nameof(NavigationService));
     }
     (parameters as INavigationParametersInternal).Add(nameof(NavigationService), service);
 }
Exemplo n.º 14
0
 internal static void SetNavigationService(this INavigationParameters parameters, IPlatformNavigationService service)
 {
     (parameters as INavigationParametersInternal).Add(nameof(NavigationService), service);
 }
Exemplo n.º 15
0
 public override void OnInitialized()
 {
     NavigationService = Prism.Navigation.NavigationService.Create(new Frame(), Gestures.Back, Gestures.Forward, Gestures.Refresh);
     NavigationService.SetAsWindowContent(Window.Current, true);
 }
Exemplo n.º 16
0
 public static Frame GetXamlFrame(this IPlatformNavigationService service)
 {
     return(((service as IPlatformNavigationService2).FrameFacade as IFrameFacade2).Frame);
 }
Exemplo n.º 17
0
 public override void OnInitialized()
 {
     NavigationService      = NavigationFactory.Create(Gesture.Back, Gesture.Forward, Gesture.Refresh);
     Window.Current.Content = NavigationService.GetXamlFrame();
     Window.Current.Activate();
 }
Exemplo n.º 18
0
 public static async Task <INavigationResult> NavigateAsync(this IPlatformNavigationService service, string path, params (string Name, string Value)[] parameters)
Exemplo n.º 19
0
 public NavigationService(IPlatformNavigationService platformNavigationService)
     : this(new NavigationServiceConfiguration(), platformNavigationService)
 {
 }
 public PlatformNotificationServiceImpl(IPlatformNavigationService nav)
 {
     this.nav = nav;
 }