private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (mainpivot.SelectedIndex) { case 0: { if (!IsChatLoaded) { List <Chat> chats = await ContentServ.GetChatsAsync(); ls_chat.ItemsSource = chats; IsChatLoaded = true; } } break; case 1: { if (!IsWissLoaded) { List <Wisper> wiss = await ContentServ.GetWisperAsync(); ls_wiss.ItemsSource = wiss; IsWissLoaded = true; } } break; case 2: { if (!IsNotiLoaded) { List <Notify> notis = await ContentServ.GetNotiAsync(); ls_noti.ItemsSource = notis; IsNotiLoaded = true; } } break; case 3: { if (!PraiseLoaded) { List <PraiseMe> notis = await ContentServ.GetPraiseListAsync(); ls_prme.ItemsSource = notis; PraiseLoaded = true; } } break; } }
private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { TextBlock txt = this.FindName(string.Format("h{0}", mainpivot.SelectedIndex)) as TextBlock; for (int i = 0; i < mainpivot.Items.Count; i++) { TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock; temp.Foreground = new SolidColorBrush(Colors.LightGray); } txt.Foreground = new SolidColorBrush(Colors.White); switch (mainpivot.SelectedIndex) { case 0: { if (!IsChatLoaded) { List <Chat> chats = await ContentServ.GetChatsAsync(); ls_chat.ItemsSource = chats; IsChatLoaded = true; } } break; case 1: { if (!IsWissLoaded) { List <Wisper> wiss = await ContentServ.GetWisperAsync(); ls_wiss.ItemsSource = wiss; IsWissLoaded = true; } } break; case 2: { if (!IsNotiLoaded) { List <Notify> notis = await ContentServ.GetNotiAsync(); ls_noti.ItemsSource = notis; IsNotiLoaded = true; } } break; } }