private void NavigationView_Navigate(string navItemTag, NavigationTransitionInfo transitionInfo) { //App.SurveyBenefitCollection.FinalBenefitList[pageNumber] = CurrentBenefitCollection; //Debug.WriteLine("Page Number = " + pageNumber); Type _page = null; if (navItemTag == "settings") { //_page = typeof(SettingsPage); } else { //var item = _pages.FirstOrDefault(p => p.Tag.Equals(navItemTag)); _page = typeof(SurveyPages.SurveyPage1); } // Get the page type before navigation so you can prevent duplicate // entries in the backstack. var preNavPageType = CurrentPageFrame.CurrentSourcePageType; // Only navigate if the selected page isn't currently loaded. if (!(_page is null) && !Type.Equals(preNavPageType, _page)) { CurrentPageFrame.Navigate(_page, null, transitionInfo); } }
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { if (args.SelectedItemContainer != null) { switch (args.SelectedItemContainer.Tag) { case "Page1": var navItemTag = args.SelectedItemContainer.Tag.ToString(); NavigationView_Navigate(navItemTag, args.RecommendedNavigationTransitionInfo); break; case "Page2": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage2)); break; case "Page3": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage3)); break; case "Page4": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage4)); break; case "Page5": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage5)); break; case "Page6": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage6)); break; case "Page7": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage7)); break; case "Page8": CurrentPageFrame.Navigate(typeof(SurveyPages.SurveyPage8)); break; case "FinalBenefitPage": CurrentPageFrame.Navigate(typeof(SurveyPages.FinalBenefitPage)); break; case "EssayQuestionPage": CurrentPageFrame.Navigate(typeof(SurveyPages.EssayQuestionPage)); break; } } }
public async void CreateSurveyFolder(object sender, RoutedEventArgs e) { App.surveyFolder = await DownloadsFolder.CreateFolderAsync(SurveyNameInput.Text, CreationCollisionOption.FailIfExists); //ApplicationData.Current.LocalFolder.CreateFolderAsync(SurveyNameInput.Text, CreationCollisionOption.FailIfExists); App.surveyFile = await App.surveyFolder.CreateFileAsync(SurveyNameInput.Text + ".json", CreationCollisionOption.ReplaceExisting); App.assetsFolder = await App.surveyFolder.CreateFolderAsync("Assets", CreationCollisionOption.FailIfExists); /*folderPicker.FileTypeFilter.Add("*"); * folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; * App.surveyFolder = await folderPicker.PickSingleFolderAsync();*/ if (App.surveyFolder != null) { CurrentPageFrame.Navigate(typeof(SurveyPages.TitlePage)); } }
public async void OpenSurveyFile(object sender, RoutedEventArgs e) { folderPicker.FileTypeFilter.Add("*"); folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Downloads; App.surveyFolder = await folderPicker.PickSingleFolderAsync(); /*fileOpenPicker.FileTypeFilter.Add(".json"); * fileOpenPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Downloads; * StorageFile jsonFile = await fileOpenPicker.PickSingleFileAsync();*/ App.surveyFile = await App.surveyFolder.GetFileAsync(App.surveyFolder.Name + ".json"); App.assetsFolder = await App.surveyFolder.GetFolderAsync("Assets"); //App.surveyFolder = await jsonFile.GetParentAsync(); if (App.surveyFolder == null) { Debug.WriteLine("Survey Folder is null"); } var stream = System.IO.WindowsRuntimeStreamExtensions.AsStreamForRead(await App.surveyFile.OpenAsync(FileAccessMode.Read)); //App.surveyFolder = await StorageFolder.GetFolderFromPathAsync(jsonFile.Path.Remove(jsonFile.Path.Length - jsonFile.Name.Length)); if (stream != null) { DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(ObservableCollection <ObservableCollection <Benefit> >)); App.SurveyBenefitCollection.FinalBenefitList = deserializer.ReadObject(stream) as ObservableCollection <ObservableCollection <Benefit> >; CurrentPageFrame.Navigate(typeof(SurveyPages.TitlePage)); } else { Debug.WriteLine("NULL"); } }