Starting Silverlight Library for

If you are a blogger, you probably have heard of a site for storing your media files (images, video, audio).  As you can see from this interview on Channel 9, Photobucket has just released a new API.  If you know me by now, you would have guessed what opportunity I would see with this: a Silverlight 2 library of course.

Knowing that Microsoft has both CodePlex (for open source projects) and the MSDN Code Zone (for examples), you might be wondering why I posted it on Google Code.  Since there are already some Photobucket projects on Google code - it makes sense to put this project there as well.

I already have an experimental project up on my test website with some unit tests as well that use the Unit Test framework that you can download along with the Silverlight 2 Beta 1 control source code. 

I am looking for people who are interested in helping me complete and maintain this library, please go to the project and join in.

Here's what one of the unit test looks like:

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading;
using Microsoft.Silverlight.Testing;
using Photobucket;
using System.Resources;
using System.Windows.Controls;

namespace Test
    public class APITest : SilverlightTest
        /// <summary>
        /// Test the Photobucket.API.Search method
        /// </summary>
        [TestMethod, Asynchronous, Description("Search")]
        public void Search()
            m_api.Search("beach", 100, 10, 1, 0, 5, "images", true, delegate(object sender, Photobucket.SearchCompletedEventArgs args)
                EnqueueCallback(() => Assert.IsTrue(args.Succeeded, "Search API Call failed with {0}.", new object[] { args.StatusDescription }));


Here's what the demo app code looks like to do the search:

        void Search_Click(object sender, RoutedEventArgs e)
            var searchText = this.SearchText.Text;

            m_api.Search(searchText, 10, 10, 1, 0, 0, "images", true, new EventHandler<Photobucket.SearchCompletedEventArgs>(SearchReturned));

        void SearchReturned(object sender, Photobucket.SearchCompletedEventArgs args)
            if (args.Succeeded)
                Images.ItemsSource = args.PrimaryMedia;

Here's the XAML for the listbox that has its ItemsSource setin the code above (notice the Binding syntax):

            <ListBox x:Name="Images" Height="400">
                        <Grid Background="Gray" MouseLeftButtonDown="StartDraggingListItem" Tag="{Binding Url}">
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            <Image Grid.Row="0" Grid.RowSpan="2" Stretch="Uniform" Width="100" Height="100" Source="{Binding Thumb, Converter={StaticResource converter}}"/>
                            <TextBlock Grid.Row="1" Text="{Binding Title}" Foreground="White" FontSize="10"/>
Comments (3)

  1. OK, so first thing, I want to see this thing work.  I go to the and am perplexed.  New Page flashes at me, upload image flashes at me.  Makes me depressed I can’t figure it out.  (I even tried dragging and dropping to it).  Any ideas?

  2. Synergist says:


    I removed some of the UI that doesn’t work yet.  Enter a search team in the interface and press Search and you should see a list of image items which you can drag into the drawing surface.

Skip to main content