My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
SILVERLIGHT CODE EXAMPLE created on Wednesday, May 05, 2010 permalink
Code base for asynchronously loading and caching dependent data in a Silverlight app
This code blackboxes the loading of various dependent text files and images for a Silverlight Application. You create DataLoaders which load as many text and image sources as you need. Each DataLoader has a OnLoadingComplete event which enables you to load dependent data, for instance, you can load a text file with a list of image file names in it, when that is finished loading, it will then load each image. All text and images are stored in IsolatedStorage and are held until they are refreshed. These text and images are accesses in one line by variable name via the DataManager, so after everything is loaded asynchronously, you can access all texts and images immediately via the DataManager. There is also an example of loading specific data only when needed for e.g. larged images which do not necessarily need to be loaded at the beginning. However, once loaded, it will remain in memory until deleted or refreshed. Also if a text or image does not exist, it will not generate an error but instead load a default image and empty string into the IsolatedStorage for that variable. The download is a Silverlight 3 project.
...

private void LoadApplicationData()
{
    DisableControls();
    DataLoader initialDataLoader = TheDataManager.CreateDataloader("initial");
    initialDataLoader.RegisterImage("noimage", "noimage.png".AddAbsoluteUrl());
    initialDataLoader.RegisterText("text1", "text1.txt".AddAbsoluteUrl());
    initialDataLoader.RegisterText("text2", "text2.txt".AddAbsoluteUrl());
    initialDataLoader.RegisterText("textdoesnotexist", "textdoesnotexist.txt".AddAbsoluteUrl());
    initialDataLoader.RegisterText("text3", "text3.txt".AddAbsoluteUrl());
    initialDataLoader.RegisterText("imageList", "imageList.txt".AddAbsoluteUrl());
    initialDataLoader.OnLoadingComplete += new DataLoader.LoadingComplete(initialDataLoader_OnLoadingComplete);
    initialDataLoader.OnDataItemLoaded += new DataLoader.DataItemLoaded(generalDataLoader_OnDataItemLoaded);
    initialDataLoader.BeginLoading();
}

void initialDataLoader_OnLoadingComplete(object obj, DataLoaderArgs args)
{
    LoadedText = DateTimeHelpers.GetCurrentDateTimeInStandardStringFormat() + ": Initial items loaded." +
        Environment.NewLine +
        Environment.NewLine +
        LoadedText;

    DataLoader imageDataLoader = TheDataManager.CreateDataloader("diagram");
    List<string> imageFileNames = TheDataManager.GetText("imageList").ConvertBlockToLines();
    foreach (var imageFileName in imageFileNames)
    {
        imageDataLoader.RegisterImage(imageFileName, imageFileName.AddAbsoluteUrl());
    }
    imageDataLoader.OnLoadingComplete += new DataLoader.LoadingComplete(imageDataLoader_OnLoadingComplete);
    imageDataLoader.OnDataItemLoaded += new DataLoader.DataItemLoaded(generalDataLoader_OnDataItemLoaded);
    imageDataLoader.BeginLoading();
}

void imageDataLoader_OnLoadingComplete(object obj, DataLoaderArgs args)
{
    AllDataIsLoaded();
}

private void AllDataIsLoaded()
{
    DisplayCurrentIsolatedStorageFiles();

    List<string> imageFileNames = TheDataManager.GetText("imageList").ConvertBlockToLines();

    WrapPanel wp = new WrapPanel();

    foreach (var imageFileName in imageFileNames)
    {
        Image image = TheDataManager.GetImage(imageFileName);
        image.Margin = new Thickness(5);
        wp.Children.Add(image);
    }

    MainContent = wp;

    NonExistentText = TheDataManager.GetText("textdoesnotexist");
    ExistentText = TheDataManager.GetText("text2");
    EnableControls();

    UpdateStatusMessage();
}

...
need markup?