protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (Service.Current.IsConnected) { DataContext = vm = new Vidyano.ViewModel.Pages.HomePage(this); await vm.Initialize(e.NavigationMode == NavigationMode.Back); } }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Back && Service.Current.IsConnected && e.SourcePageType == typeof(SignInPage)) e.Cancel = true; else if (vm != null) { vm.Dispose(); vm = null; } base.OnNavigatingFrom(e); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (PhoneApplicationFrameEx.NavigatePendingStateRestore()) return; if (Service.Current.IsConnected) { DataContext = vm = new Vidyano.ViewModel.Pages.HomePage(this); await vm.Initialize(e.NavigationMode == NavigationMode.Back); } base.OnNavigatedTo(e); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Back && Service.Current.IsConnected && e.Uri.OriginalString.Contains("SignInPage.xaml")) { Client.CurrentClient.SuspendCache(); Client.CurrentClient.Terminate(); } else if (vm != null) { vm.Dispose(); vm = null; } base.OnNavigatingFrom(e); }