Ejemplo n.º 1
0
        private static async Task <bool> CallClassicOnNavigatingFrom(object viewmodel, NavigationMode mode, Page sourcePage, object sourceParameter, Type targetType, object targetParameter, bool suspending)
        {
            var deferral            = new DeferralManager();
            var navigatingEventArgs = new Classic.NavigatingEventArgs(deferral)
            {
                Page                = sourcePage,
                PageType            = sourcePage?.GetType(),
                Parameter           = sourceParameter,
                NavigationMode      = mode,
                TargetPageType      = targetType,
                TargetPageParameter = targetParameter,
                Suspending          = suspending,
            };

            try
            {
                var vm = viewmodel as Classic.INavigatingAwareAsync;
                if (vm != null)
                {
                    await vm.OnNavigatingFromAsync(navigatingEventArgs);

                    await deferral.WaitForDeferralsAsync();
                }
            }
            catch
            {
                Debugger.Break();
            }
            return(navigatingEventArgs.Cancel);
        }
Ejemplo n.º 2
0
        private async Task <bool> NavingFromAsync(Classic.INavigatingAwareAsync viewmodel, Page page, object currentParameter, bool suspending, NavigationMode navigationMode, Type targetPageType, object targetParameter)
        {
            var deferral            = new DeferralManager();
            var navigatingEventArgs = new Classic.NavigatingEventArgs(deferral)
            {
                Page                = page,
                Parameter           = currentParameter,
                Suspending          = suspending,
                NavigationMode      = navigationMode,
                TargetPageType      = targetPageType,
                TargetPageParameter = targetParameter,
            };

            try
            {
                await viewmodel.OnNavigatingFromAsync(navigatingEventArgs);

                await deferral.WaitForDeferralsAsync();
            }
            catch
            {
                Debugger.Break();
            }
            return(navigatingEventArgs.Cancel);
        }
 public Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     if (galleryMetaInfo == null)
         BootStrapper.Current.SessionState["GalleryInfo"] = new GalleryMetaInfo { Gallery = Images, SelectedIndex = FlipViewIndex };
     else
         galleryMetaInfo.SelectedIndex = FlipViewIndex;
     return Task.CompletedTask;
 }
Ejemplo n.º 4
0
        public async Task <bool> NavingFromCancelsAsync(object viewmodel, NavigationMode mode, Page sourcePage, Type sourceType, object sourceParameter, Page targetPage, Type targetType, object targetParameter, bool suspending)
        {
            Services.NavigationService.NavigationService.DebugWrite();

            if (sourcePage == null)
            {
                return(false);
            }
            else if (viewmodel == null)
            {
                return(false);
            }
            else if (viewmodel is Classic.INavigatingAwareAsync)
            {
                var deferral            = new DeferralManager();
                var navigatingEventArgs = new Classic.NavigatingEventArgs(deferral)
                {
                    Page                = sourcePage,
                    PageType            = sourcePage?.GetType(),
                    Parameter           = sourceParameter,
                    NavigationMode      = mode,
                    TargetPageType      = targetType,
                    TargetPageParameter = targetParameter,
                    Suspending          = suspending,
                };
                try
                {
                    var vm = viewmodel as Classic.INavigatingAwareAsync;
                    await vm?.OnNavigatingFromAsync(navigatingEventArgs);

                    await deferral.WaitForDeferralsAsync();
                }
                catch
                {
                    Debugger.Break();
                }
                return(navigatingEventArgs.Cancel);
            }
            else if (viewmodel is Portable.IConfirmNavigationAsync)
            {
                var parameters = new Portable.NavigationParameters();
                parameters.Add("NavigationMode", mode.ToPrismNavigationMode());
                parameters.Add("SourceType", sourceType);
                parameters.Add("SourceParameter", sourceParameter);
                parameters.Add("TargetType", targetType);
                parameters.Add("TargetParameter", targetParameter);
                parameters.Add("Suspending", suspending);
                var vm = viewmodel as Portable.IConfirmNavigationAsync;
                return(!await vm?.CanNavigateAsync(parameters));
            }
            else
            {
                return(true);
            }
        }
 public override void OnNavigatingFrom(NavigatingEventArgs args)
 {
     try
     {
         ApplicationView view = ApplicationView.GetForCurrentView();
         view.ExitFullScreenMode();
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 6
0
 // before navigate (cancellable)
 bool NavigatingFrom(bool suspending)
 {
     var page = FrameFacade.Content as Page;
     if (page != null)
     {
         var dataContext = page.DataContext as INavigable;
         if (dataContext != null)
         {
             var args = new NavigatingEventArgs
             {
                 PageType = FrameFacade.CurrentPageType,
                 Parameter = FrameFacade.CurrentPageParam,
                 Suspending = suspending,
             };
             dataContext.OnNavigatingFrom(args);
             return !args.Cancel;
         }
     }
     return true;
 }
Ejemplo n.º 7
0
 private void FacadeNavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e)
 {
     var args = new NavigatingEventArgs(e);
     foreach (var handler in _navigatingEventHandlers)
     {
         handler(this, args);
     }
     e.Cancel = args.Cancel;
 }
Ejemplo n.º 8
0
 public virtual void OnNavigatingFrom(NavigatingEventArgs args) { /* nothing by default */ }
Ejemplo n.º 9
0
 public override async Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     args.Cancel = false;
     await Task.CompletedTask;
 }
Ejemplo n.º 10
0
        private void FacadeNavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e)
        {
            DebugWrite();

            object parameter = null;
            try
            {
                parameter = SerializationService.Deserialize(e.Parameter?.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your parameter must be serializable. If it isn't, then use SessionState.", ex);
            }
            var args = new NavigatingEventArgs(e, Content as Page, parameter);
            if (NavigationModeHint != NavigationMode.New)
                args.NavigationMode = NavigationModeHint;
            NavigationModeHint = NavigationMode.New;
            foreach (var handler in _navigatingEventHandlers)
            {
                handler(this, args);
            }
            e.Cancel = args.Cancel;
        }
 public override async Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     //args.Parameter = Recipe;
     //args.Cancel = false;
     SessionState.Add("UpdatedRecipe", Recipe);
     await Task.CompletedTask;
 }
Ejemplo n.º 12
0
 public override async void OnNavigatingFrom(NavigatingEventArgs args)
 {
     await ExecuteSaveCommand();
 }
 public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     _beaconManagementService.StopAdvertising();
     return base.OnNavigatingFromAsync(args);
 }
Ejemplo n.º 14
0
 public override void OnNavigatingFrom(NavigatingEventArgs args)
 {
     base.OnNavigatingFrom(args);
 }
Ejemplo n.º 15
0
        public override async Task OnNavigatingFromAsync(NavigatingEventArgs args)
        {
          

            await base.OnNavigatingFromAsync(args);
        }
Ejemplo n.º 16
0
        public override void OnNavigatingFrom(NavigatingEventArgs args)        {

            mediaElement.Source = null;
            base.OnNavigatingFrom(args);
        }
Ejemplo n.º 17
0
 public void RaiseNavigating(NavigatingEventArgs e)
 {
     Navigating?.Invoke(this, e);
     // for backwards compat
     FrameFacadeInternal.RaiseNavigating(e);
 }
Ejemplo n.º 18
0
 public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     return base.OnNavigatingFromAsync(args);
 }
Ejemplo n.º 19
0
        public async Task<bool> NavingFromCancelsAsync(object viewmodel, NavigationMode mode, Page sourcePage, Type sourceType, object sourceParameter, Page targetPage, Type targetType, object targetParameter, bool suspending)
        {
            Services.NavigationService.NavigationService.DebugWrite();

            if (sourcePage == null)
            {
                return false;
            }
            else if (viewmodel == null)
            {
                return false;
            }
            else if (viewmodel is Classic.INavigatingAwareAsync)
            {
                var deferral = new DeferralManager();
                var navigatingEventArgs = new Classic.NavigatingEventArgs(deferral)
                {
                    Page = sourcePage,
                    PageType = sourcePage?.GetType(),
                    Parameter = sourceParameter,
                    NavigationMode = mode,
                    TargetPageType = targetType,
                    TargetPageParameter = targetParameter,
                    Suspending = suspending,
                };
                try
                {
                    var vm = viewmodel as Classic.INavigatingAwareAsync;
                    await vm?.OnNavigatingFromAsync(navigatingEventArgs);
                    await deferral.WaitForDeferralsAsync();
                }
                catch
                {
                    Debugger.Break();
                }
                return navigatingEventArgs.Cancel;
            }
            else if (viewmodel is Portable.IConfirmNavigationAsync)
            {
                var parameters = new Portable.NavigationParameters();
                parameters.Add("NavigationMode", mode.ToPrismNavigationMode());
                parameters.Add("SourceType", sourceType);
                parameters.Add("SourceParameter", sourceParameter);
                parameters.Add("TargetType", targetType);
                parameters.Add("TargetParameter", targetParameter);
                parameters.Add("Suspending", suspending);
                var vm = viewmodel as Portable.IConfirmNavigationAsync;
                return !await vm?.CanNavigateAsync(parameters);
            }
            else
            {
                return true;
            }
        }
Ejemplo n.º 20
0
 private void FacadeNavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e)
 {
     var args = new NavigatingEventArgs(e, Content as Page);
     if (NavigationModeHint != NavigationMode.New)
         args.NavigationMode = NavigationModeHint;
     NavigationModeHint = NavigationMode.New;
     foreach (var handler in _navigatingEventHandlers)
     {
         handler(this, args);
     }
     e.Cancel = args.Cancel;
 }
Ejemplo n.º 21
0
 public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     args.Cancel = false;
     return Task.CompletedTask;
 }
Ejemplo n.º 22
0
        private void FacadeNavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e)
        {
            DebugWrite();

            var parameter = SerializationService.Deserialize(e.Parameter?.ToString());
            var args = new NavigatingEventArgs(e, Content as Page, parameter);
            if (NavigationModeHint != NavigationMode.New)
                args.NavigationMode = NavigationModeHint;
            NavigationModeHint = NavigationMode.New;
            foreach (var handler in _navigatingEventHandlers)
            {
                handler(this, args);
            }
            e.Cancel = args.Cancel;
        }
 public Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     return Task.CompletedTask;
 }
Ejemplo n.º 24
0
 public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     _dispatcherTimer.Stop();
     return Task.CompletedTask;
 }
Ejemplo n.º 25
0
 public override void OnNavigatingFrom(NavigatingEventArgs args)
 {
     args.Cancel = false;
 }
Ejemplo n.º 26
0
 public override async Task OnNavigatingFromAsync(NavigatingEventArgs args)
 {
     args.Cancel = false;
     // Stops map timer
     GameClient.ToggleUpdateTimer(false);
     GameClient.MapPokemonUpdated -= GameClientOnMapPokemonUpdated;
     await Task.CompletedTask;
 }
Ejemplo n.º 27
0
        private async void FacadeNavigatingCancelEventHandler(object sender, NavigatingCancelEventArgs e)
        {
            DebugWrite();

            object parameter = null;
            try
            {
                parameter = SerializationService.Deserialize(e.Parameter?.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your parameter must be serializable. If it isn't, then use SessionState.", ex);
            }
            var deferral = new DeferralManager();
            var args = new NavigatingEventArgs(deferral, e, Content as Page, parameter);
            if (NavigationModeHint != NavigationMode.New)
                args.NavigationMode = NavigationModeHint;
            NavigationModeHint = NavigationMode.New;
            _navigatingEventHandlers.ForEach(x => x(this, args));
            await deferral.WaitForDeferralsAsync();
            e.Cancel = args.Cancel;
        }
        public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
        {
            _watcher.Received -= Watcher_Received;
            foreach (var beacon in BeaconsList)
                beacon.PropertyChanged -= Beacon_PropertyChanged;

            return base.OnNavigatingFromAsync(args);
        }