Call WCF RIA Methods

Code snippet to call WCF RIA Methods

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

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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s