protected override async void OnNavigatedTo(NavigationEventArgs e) { if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } friend = NavigationService.GetNavigationData().ElementAt(1) as LFCUser; auth = NavigationService.GetNavigationData().ElementAt(0) as LFCAuth; client = new Client.Client(auth); NameBlock.Text = friend.Name; RealNameBlock.Text = friend.RealName; UserImg.Source = new BitmapImage(new Uri(friend.ImgMedium, UriKind.RelativeOrAbsolute)); profileProgress.IsIndeterminate = true; friends = await client.userGetFriends(friend.Name); FriendBlock.Content = "Друзей: " + friends.Count; var score = await client.userMusicCompare(auth.UserName, friend.Name); profileProgress.IsIndeterminate = false; Music_Slider.Value = (int)(double.Parse(score) * 100); MusciBlock.Text = "Музыкальная совместимость " + (int)(double.Parse(score) * 100) + "%"; }
async void Main_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (Main.SelectedIndex) { case 1: // друзья friendProgress.IsIndeterminate = true; friends = await client.userGetFriends(auth.UserName); friendsList.ItemsSource = friends; if (friends.Count == 0) { MessageBox.Show("У тебя нет друзей :("); } friendProgress.IsIndeterminate = false; break; case 2: // рупор ruporProgress.IsIndeterminate = true; try { shouts = await client.userGetShouts(auth.UserName); ruporList.ItemsSource = shouts; } catch (NullReferenceException err) { MessageBox.Show("Empty!"); Console.Write(err.StackTrace); } //if (shouts.Count == 0) MessageBox.Show("Empty!"); ruporProgress.IsIndeterminate = false; break; } }
async void Friend_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (FriendPanorama.SelectedIndex) { case 0: profileProgress.IsIndeterminate = true; NameBlock.Text = friend.Name; RealNameBlock.Text = friend.RealName; UserImg.Source = new BitmapImage(new Uri(friend.ImgMedium, UriKind.RelativeOrAbsolute)); friends = await client.userGetFriends(friend.Name); profileProgress.IsIndeterminate = false; FriendBlock.Content = "Друзей: " + friends.Count; break; case 1: // рупор ruporProgress.IsIndeterminate = true; try { shouts = await client.userGetShouts(friend.Name); ruporList.ItemsSource = shouts; } catch (NullReferenceException err) { Console.Write(err.StackTrace); } if (shouts.Count == 0) { MessageBox.Show("Этому пользователю никто не пишет :("); } ruporProgress.IsIndeterminate = false; break; case 2: // друзья friendProgress.IsIndeterminate = true; friends = await client.userGetFriends(friend.Name); friendsList.ItemsSource = friends; if (friends.Count == 0) { MessageBox.Show("У этого пользователя нет друзей :("); } friendProgress.IsIndeterminate = false; break; } }