예제 #1
0
        void HandleNavigating(object sender, NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.Back)
            {
                return;
            }

            ProcessDataContext(e,
                               (navigationAware, eventArgs, parent) =>
            {
                if (eventArgs.Cancel)
                {
                    return;
                }

                var mode = Translate(e.NavigationMode);
                var args = new NavigatingArgs(e.SourcePageType, mode);

                var messenger = Dependency.Resolve <IMessenger>();
                messenger.PublishAsync(new NavigatingMessage(args));

                navigationAware.HandleNavigatingFrom(args);
                if (eventArgs.Cancel)
                {
                    parent?.ActivateViewModel((ViewModelBase)navigationAware);
                }
            });
        }
예제 #2
0
        void HandleNavigating(object sender, NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == BuiltInNavigation.NavigationMode.Back)
            {
                return;
            }

            ProcessDataContext(e,
                               (navigationAware, eventArgs, parent) =>
            {
                if (eventArgs.Cancel)
                {
                    return;
                }

                var mode = Translate(e.NavigationMode);
                var args = new NavigatingArgs(e.Uri, mode, true, e.IsNavigationInitiator, e.ExtraData, e);

                var messenger = Dependency.Resolve <IMessenger>();
                messenger.PublishAsync(new NavigatingMessage(args));

                navigationAware.HandleNavigatingFrom(args);

                if (eventArgs.Cancel)
                {
                    parent?.ActivateViewModel((ViewModelBase)navigationAware);
                }
            });
        }