Exemplo n.º 1
0
        private static async void FinishCreatingAsyncVoid(BackButton backButton, Frame frame, NavigationService service)
        {
            await Task.CompletedTask;

            // TODO: add this feature back in if you can figure out the reason for an err
            // await ClearExpiredCacheAsync(service);

            service.BackButtonHandling = backButton;

            if (backButton == BackButton.Attach)
            {
                frame.RegisterPropertyChangedCallback(Frame.CanGoBackProperty, (s, args)
                                                      => GestureService.UpdateBackButton(service.CanGoBack));
                Central.Messenger.Subscribe <Messages.BackRequestedMessage>(frame, async m =>
                {
                    await service.GoBackAsync();
                });
            }

            if (!Instances.Any())
            {
                Default = service;
            }
            Instances.Register(service);

            Central.Messenger.Send(new Messages.NavigationServiceCreatedMessage
            {
                NavigationService  = service,
                BackButtonHandling = backButton,
                IsDefault          = Default == service,
                Dispatcher         = service.GetDispatcher()
            });
        }