private void btnSelect_Click(object sender, RoutedEventArgs e) { if (trvSeasons.SelectedItem != null) { if (trvSeasons.SelectedItem.GetType().Name == "Game") { /// using cast on trvSeasons.SelectedItem Retrosheet_RetrieveData.TreeViewModels.Game item = (Retrosheet_RetrieveData.TreeViewModels.Game)trvSeasons.SelectedItem; //MessageBox.Show("Item selected: " + item.GameDesc + " " + item.GameID, Title); Retrosheet_PlayBall_PlayByPlay PlayPage = new Retrosheet_PlayBall_PlayByPlay(item.GameID); this.NavigationService.Navigate(PlayPage); btnSelect.Content = "Select Game"; } else { MessageBox.Show("No game selected", Title); } } else { MessageBox.Show("No item selected", Title); } }
private void trvSeasons_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (trvSeasons.SelectedItem != null) { if (trvSeasons.SelectedItem.GetType().Name == "Game") { btnSelect.Content = "Please wait..."; Retrosheet_RetrieveData.TreeViewModels.Game item = (Retrosheet_RetrieveData.TreeViewModels.Game)trvSeasons.SelectedItem; //lblGameSelection.Content = "Item selected: " + item.GameDesc + " " + item.GameID; MessageBox.Show("Game selected: " + item.GameDesc + " " + "\r\nClick OK to load game", Title); Retrosheet_PlayBall_PlayByPlay PlayPage = new Retrosheet_PlayBall_PlayByPlay(item.GameID); btnSelect.Content = "Select Game"; this.NavigationService.Navigate(PlayPage); } } }