protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); DataContext = new MainPageViewModel(App.Event); if ((DataContext as MainPageViewModel).ShowAgenda) Carousel.SelectedIndex = 1; }
void client_GetEventCompleted(object sender, GetEventCompletedEventArgs e) { if (e.Error == null) { AgendaServiceRef.Event v = e.Result.Body.GetEventResult; App.Event.Tracks.Clear(); foreach (Track t in v.Tracks) App.Event.Tracks.Add(t.ToModelTrack()); App.Event.Speakers.Clear(); foreach (Speaker s in v.Speakers) App.Event.Speakers.Add(s.ToModelSpeaker()); App.Event.Sessions.Clear(); foreach (Session s in v.Sessions) App.Event.Sessions.Add(s.ToModelSession()); App.Event.Agenda.Clear(); foreach (AgendaItem a in v.Agenda) App.Event.Agenda.Add(a.ToModelAgendaItem()); DataContext = new MainPageViewModel(App.Event); if ((DataContext as MainPageViewModel).ShowAgenda) Carousel.SelectedIndex = 1; } else { MessageBox.Show("Refresh failed."); } }