public int GetXmlAsync(string path, CodecHttpClientRequestCallback callback) { var r = new CodecRequest(_address, string.Format("/getxml?location={0}", path.StartsWith("/") ? path : "/" + path), _sessionId); DispatchAsync(r, callback); return(r.Id); }
public int PutXmlAsync(string xml, CodecHttpClientRequestCallback callback) { var r = new CodecRequest(_address, "/putxml", _sessionId) { RequestType = RequestType.Post, ContentString = xml }; DispatchAsync(r, callback); return(r.Id); }
private void DispatchAsync(CodecRequest request, CodecHttpClientRequestCallback callback) { Lock.Enter(); Callbacks[request] = callback; Lock.Leave(); //CrestronConsole.PrintLine("Queuing request id:{0}", request.Id); RequestQueue.Enqueue(request); if (_dispatchThread == null || _dispatchThread.ThreadState == Thread.eThreadStates.ThreadFinished) { _dispatchThread = new Thread(DispatchThreadProcess, null) { Name = "CodecHttpClient Process Thread", Priority = Thread.eThreadPriority.HighPriority }; } }