protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); SmallProfiler.PrintLine("StartPage - OnNavigatedTo"); #if DEBUG Bootstrapper.Current.Container.Resolve <IApplicationSettingsService>().SetSetting("ApiKey", "2IPsBtr.EBOluTYUi2mwwz86RkWKNHr6"); AsanaStateService.Initialize(); #endif if (AsanaStateService.IsSetApiKey) { ExNavigationService.Navigate <MainPage>(); return; } if (AsanaStateService.IsSetAuthToken) { if (NetworkHelper.IsNetworkAvailableNew()) { var response = await new AsanaRespository().GetUser("me"); if (AsanaClient.ProcessResponse(response, true)) { ExNavigationService.Navigate <MainPage>(); } else { ExNavigationService.Navigate <LoginNewPage>(); } } else { ExNavigationService.Navigate <MainPage>(); } } else { ExNavigationService.Navigate <LoginNewPage>(); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { ExNavigationService.ClearNavigationHistory(); base.OnNavigatedTo(e); SmallProfiler.PrintLine("MainPage - OnNavigatedTo"); if (!SettingsService.CurrentUserId.HasValue) { var item = pivot.Items.Cast <PivotItem>().FirstOrDefault(x => x.Name == "myTasksPivotItem"); if (item != null) { myTasksPivotItemBackup = item; pivot.Items.Remove(item); } } else { var item = pivot.Items.Cast <PivotItem>().FirstOrDefault(x => x.Name == "myTasksPivotItem"); if (item == null) { pivot.Items.Insert(1, myTasksPivotItemBackup); } } //ApplicationRatingNotificationServiceFromNokia.Show(LayoutRoot); //MainViewModel model = ViewModelCache.GetModel<MainViewModel>("MainPage"); //DataContext = model; //if(e.NavigationMode == NavigationMode.Back) //{ // MainPage_Loaded(this, new RoutedEventArgs()); //} }