示例#1
0
        private void ViewButton_Click(object sender, EventArgs e)
        {
            UsersCard userCard = (UsersCard)sender;

            CurrentUserCard        = userCard;
            ProfileView.Visibility = Visibility.Visible;
            ProfileView.IsExpanded = true;
            ProfileViewTitle.Text  = CurrentUserCard.User.username;
            BitmapImage imageBitmap = new BitmapImage(CurrentUserCard.User.profileImage);

            ProfileViewPicture.Source = imageBitmap;
            if (!ServerService.instance.isOffline())
            {
                if (SentRequests.Contains(userCard.User.id))
                {
                    FriendButton.IsEnabled = false;
                }
                else if (FriendsContainer.Children.Contains(userCard))
                {
                    FriendButton.IsChecked = true;
                    FriendButton.IsEnabled = true;
                }
                else
                {
                    FriendButton.IsChecked = false;
                    FriendButton.IsEnabled = true;
                }
            }
        }
示例#2
0
 public void LoadUsersExceptFriends(IRestResponse response)
 {
     if (response.StatusCode == HttpStatusCode.OK)
     {
         ConnectedUsersContainer.Children.Clear();
         JArray responseUsers = JArray.Parse(response.Content);
         for (int i = 0; i < responseUsers.Count; i++)
         {
             dynamic   data     = JObject.Parse(responseUsers[i].ToString());
             User      user     = new User((string)data["username"], (string)data["id"], (string)data["profileImage"]);
             UsersCard userCard = new UsersCard(user);
             userCard.ViewButtonClicked += ViewButton_Click;
             ConnectedUsersContainer.Children.Add(userCard);
         }
     }
 }