Code snippet to call WCF RIA Methods

private void LoadExplorer(string path)
{
    Web.Services.ExplorerContext context = new Web.Services.ExplorerContext();
    EntityQuery<DirectoryInfoItem> query = context.EnumerateDirectoryQuery(path);
    Action<LoadOperation<DirectoryInfoItem>> completeProcessing = delegate(LoadOperation<DirectoryInfoItem> loadOp)
    {
        if (!loadOp.HasError)
        {
            // Perform actions required after request complete
            foreach (DirectoryInfoItem dirInfo in loadOp.Entities)
            {

            }
        }
        else
        {
            LogAndNotify(loadOp.Error);
            loadOp.MarkErrorAsHandled();
        }
    };
    LoadOperation<DirectoryInfoItem> loadOperation = context.Load(query, completeProcessing, null);
}

private void LogAndNotify(Exception error)
{
    ErrorWindow.CreateNew(error);
}
 

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>