I have got the code that using WCF, requests data from the server.
For Example:
    public static Company LoadCompanyInfo(Guid session)
    {
        var client = new QualerServiceClient("QualerService");
        return client.GetCompanyInfo(session);
    }
I need to make my wpf application to run these code asynchronously.
I try:
    public static Company LoadCompanyInfoAsync(Guid session)
    {
        var client = new QualerServiceClient("QualerService");
        client.BeginGetCompanyInfo(session, new AsyncCallback(EndLoadCompanyInfoAsync), client);
        // How to Get Data from AsyncCallback function?
        return null;
    }
    private static void EndLoadCompanyInfoAsync(IAsyncResult r)
    {
        var client = r.AsyncState as QualerServiceClient;
        var result = client.EndGetCompanyInfo(r);
        // how to return the result value ??
    }
But I don't know how to return data from callback function.
I have got methods:
BeginGetCompanyInfo and EndGetCompanyInfo
GetCompanyInfoAsync
and event:
- GetCompanyInfoCompleted.
 
Quastions:
How can I get the data from the callback method?
What is the difference between
GetCompanyInfoAsyncandBegin\End?Best Practices: How can execute a method asynchronously, so that the GUI of my WPF App is not freezes?