/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { if (this.defaultViewModel.Competition != null) { this.defaultViewModel.Competition.SortTeams(); return; } var competition = e.NavigationParameter as Competition; if (competition == null) { var dialog = new MessageDialog("Invalid Competition Selected"); await dialog.ShowAsync(); return; } if (!competition.Matches.Any() || !competition.Teams.Any()) { competition = await CompetitionDataStorage.LoadCompetition(competition); competition.SortTeams(); } this.defaultViewModel.Competition = competition; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var team = e.NavigationParameter as Team; if (team == null) { var dialog = new MessageDialog("Invalid Team Selected"); await dialog.ShowAsync(); return; } this.defaultViewModel.Team = team; this.LoadCamera(); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { object navigationParameter; if (e.PageState != null && e.PageState.ContainsKey("SelectedItem")) { navigationParameter = e.PageState["SelectedItem"]; } var team = e.NavigationParameter as Team; if (team == null) { var dialog = new MessageDialog("Invalid Team Selected"); await dialog.ShowAsync(); return; } this.defaultViewModel.Team = team; if (this.defaultViewModel.Team.ImagePath != null) { var frcFolder = await KnownFolders.PicturesLibrary.CreateFolderAsync("FRC", CreationCollisionOption.OpenIfExists); var yearFolder = await frcFolder.CreateFolderAsync("2014", CreationCollisionOption.OpenIfExists); var imageFile = await yearFolder.GetFileAsync(this.defaultViewModel.Team.ImagePath); var bitmapImage = new BitmapImage(); await bitmapImage.SetSourceAsync(await imageFile.OpenReadAsync()); this.defaultViewModel.TeamImage = bitmapImage; } else { this.TeamImage.Source = new BitmapImage(); } // TODO: Assign a bindable group to this.DefaultViewModel["Group"] // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"] // TODO: Assign the selected item to this.flipView.SelectedItem }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { competition = e.NavigationParameter as Competition; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var crossroads = new Competition { Name = "Crossroads Regional", Location = "Terre Haute, IN", ImagePath = "Assets/Competitions/crossroads.jpg" }; var wisconsin = new Competition { Name = "Wisconsin Regional", Location = "Milwaukee, WI", ImagePath = "Assets/Competitions/wisconsin.jpg" }; //competition.Matches.Add(new Match { MatchNumber = 1, MatchType = MatchType.Practive }); //competition.Teams.Add(new Team { Number = 48, Name = "Delphi Corporation/Nordson XALOY & Warren G. Harding High School", ImagePath = null }); //competition.Teams.Add(new Team { Number = 71, Name = "School City of Hammond/Caterpillar/City of Hammond & School City of Hammond", ImagePath = null }); //competition.Teams.Add(new Team { Number = 128, Name = "American Electric Power/Grandview Heights Marble Cliff Education Foundation & Grandview Heights High School", ImagePath = null }); //competition.Teams.Add(new Team { Number = 537, Name = "Charger Robotics", ImagePath = null }); this.defaultViewModel.Competitions.Add(wisconsin); this.defaultViewModel.Competitions.Add(crossroads); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var team = e.NavigationParameter as Team; if (team == null) { return; } this.defaultViewModel.Team = team; var teamNumber = team.Number; var schedule = team.Competition.Matches.Where(m => m.Blue1.Number == teamNumber || m.Blue2.Number == teamNumber || m.Blue3.Number == teamNumber || m.Red1.Number == teamNumber || m.Red2.Number == teamNumber || m.Red3.Number == teamNumber); foreach (var match in schedule) { this.defaultViewModel.Schedule.Add(match); } }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var match = e.NavigationParameter as Match; if (match == null) { return; } this.defaultViewModel.Match = match; this.LoadMatches(0); }