public static void BeginRequest <T>(string uri, T state, WebAPIRequestSend <T> send, WebAPIRequestReceive <T> receive) { try { CSOptions.ToConsole("Requesting: {0}", uri); var request = (HttpWebRequest)WebRequest.Create(uri); request.UserAgent = "VitaNexCore/" + VitaNexCore.Version + " " + CSOptions.Service.FullName; // ReSharper disable once AssignNullToNotNullAttribute request.Proxy = null; request.Credentials = null; if (send != null) { send(request, state); } if (RequestSend != null) { RequestSend(request, state); } RequestUtility.BeginGetResponse(request, state, receive); } catch (Exception e) { CSOptions.ToConsole(e); } }
public static void BeginRequest <T>(string uri, T state, WebAPIRequestSend <T> send, WebAPIRequestReceive <T> receive) { VitaNexCore.TryCatch( () => { CSOptions.ToConsole("Requesting: {0}", uri); var request = (HttpWebRequest)WebRequest.Create(uri); request.Proxy = null; request.Credentials = null; if (send != null) { send(request, state); } if (RequestSend != null) { RequestSend(request, state); } RequestUtility.BeginGetResponse(request, state, receive); }, CSOptions.ToConsole); }
public static void BeginRequest( string url, object state, WebAPIRequestSend <object> send, WebAPIRequestReceive <object> receive) { BeginRequest <object>(url, state, send, receive); }
public static void BeginRequest <T>(Uri uri, T state, WebAPIRequestSend <T> send, WebAPIRequestReceive <T> receive) { BeginRequest(uri.ToString(), state, send, receive); }