The status of the task is always "Pending activation." The result of the task = "". I don’t understand why ... Thanks for your help. The user interface calls the GetDocLibs method.
public class ServerFunctions
{
public static List<BdeskDocLib> GetDocLibs(bool onlyDocLibPerso)
{
string xmlContent = GetXml();
List<BdeskDocLib> result = BdeskDocLib.GetListFromXml(xmlContent, onlyDocLibPerso);
return result;
}
private static String GetXml()
{
Task<String>task=requesteur.Query(dataRequestParam);
task.Wait();
xmlResult = task.Result;
return xmlResult;
}
}
public class DataRequest
{
public Task<String> Query(DataRequestParam dataRequestParam)
{
try
{
WebClient web = new WebClient();
if (!string.IsNullOrEmpty(dataRequestParam.AuthentificationLogin))
{
System.Net.NetworkCredential account = new NetworkCredential(dataRequestParam.AuthentificationLogin, dataRequestParam.AuthentificationPassword);
web.Credentials = account;
}
return web.DownloadStringTaskAsync(dataRequestParam.TargetUri).ConfigureAwait(false);
}
catch(WebException we)
{
MessageBox.Show(we.Message);
return null;
}
}
}
source
share