Пример #1
0
        private void OpenPhoto(object sender, MouseButtonEventArgs e)
        {
            try
            {
                PhotoAlbumsResponse selectedAlbum = (PhotoAlbumsResponse)Albums.SelectedItem;
                PhotoItem           selected      = (PhotoItem)photoListBox.SelectedItem;
                if (selected != null)
                {
                    string userId;
                    if (UserNameOrIdForPhotoAlbums.Text == "")
                    {
                        userId = VkAccount.UserId;
                    }
                    else
                    {
                        userId = UserNameOrIdForPhotoAlbums.Text;
                    }
                    var users = General.GetUsersInfo(userId);

                    var PhotoWindow = new PhotoWindow();
                    PhotoWindow.Show();
                    PhotoWindow.PhotoBrowser.Navigate(String.Format(selected.UrlPhoto));
                    PhotoWindow.Title = String.Format("Photo of {0} {1} from {2}", users.response[0].first_name, users.response[0].last_name, selectedAlbum.PhotoAlbumTitle);
                }
            }
            catch (Exception) { }
        }
Пример #2
0
        private void OpenAlbum(object sender, MouseButtonEventArgs e)
        {
            photoListBox.ItemsSource = null;
            _photoList.Clear();
            string userId;

            if (UserNameOrIdForPhotoAlbums.Text == "")
            {
                userId = VkAccount.UserId;
            }
            else
            {
                userId = UserNameOrIdForPhotoAlbums.Text;
            }

            PhotoAlbumsResponse selectedAlbum = (PhotoAlbumsResponse)Albums.SelectedItem;

            if (selectedAlbum != null)
            {
                PhotoResults = Photos.LoadPhoto(userId, selectedAlbum.Aid);
                foreach (var item in PhotoResults.response)
                {
                    _photoList.Add(
                        new PhotoItem
                    {
                        UrlPhoto = item.Src_big
                    });
                }
                photoListBox.ItemsSource = _photoList;
            }
        }