Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Web;
  7. using SFDC;
  8.  
  9. namespace SfSoapCore
  10. {
  11. class Program
  12. {
  13. static string userName = "";
  14. static string password = "";
  15. static string securityToken = "";
  16. static SoapClient sc;
  17. static loginResponse lresp;
  18. static LoginResult lres;
  19. static LoginScopeHeader lsr = null;
  20.  
  21. static void Main(string[] args)
  22. {
  23. sc = new SoapClient();
  24. Run();
  25. }
  26.  
  27. static async void Run()
  28. {
  29. Task<loginResponse> loginTask = new Task<loginResponse>(SfLogin);
  30. loginTask.Start();
  31. lresp = await loginTask;
  32. lres = lresp.result;
  33. string serverUrl = lres.serverUrl;
  34. string sessionId = lres.sessionId;
  35. Console.WriteLine("Break");
  36. }
  37.  
  38. static async loginResponse SfLogin() //ERROR 'return type of an async method must be void, Task or Task<T>'
  39. {
  40. loginResponse lr = await sc.loginAsync(null, userName, password + securityToken);
  41. return lr;
  42. }
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement