private void button2_Click(object sender, RoutedEventArgs e)
        {
            SearchEntity masha = new SearchEntity(Int32.Parse(textBox.Text));
            while (!masha.isReady)
                System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
            // now user is ready
            // user has also additional fields (if it is not hidden)
            UserDescription profile = masha.getDescription();

            // loading user's friend
            FriendsList mashas_friends = masha.getFriends();
            this.listBox1.Visibility = System.Windows.Visibility.Hidden;
            this.listBox2.Visibility = System.Windows.Visibility.Visible;
            this.listBox2.ItemsSource = mashas_friends.friends;
        }
 private Levels friendsList(SearchEntity masha, int i)
 {
     if (i <= 3)
     {
         Levels levels1 = new Levels(masha.getDescription(), new List<Levels>());
         foreach (UserDescription user in masha.getFriends())
         {
             SearchEntity tmp = new SearchEntity(user.id);
             while (!tmp.isReady)
                 System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
             levels1.friends.Add(friendsList(tmp, i + 1));
         }
         return levels1;
     }
     else
         return new Levels(masha.getDescription(), new List<Levels>());
 }
 private void profile(int id)
 {
     SearchEntity masha = new SearchEntity(id);
     while (!masha.isReady)
         System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.01)).Wait();
     UserDescription profile = masha.getDescription();
     FriendsList mashas_friends = masha.getFriends();
     List<UserDescription> descriptions = new List<UserDescription>();
     descriptions.Add(profile);
     List<string> strings = new List<string>();
     strings.Add(profile.firstName);
     this.listBox1.ItemsSource = descriptions;
     this.listBox1.Visibility = System.Windows.Visibility.Visible;
     this.listBox2.Visibility = System.Windows.Visibility.Hidden;
 }