예제 #1
0
파일: XClient.cs 프로젝트: Dimidx/xbmc-json
        public void GetData(string method, object args, XClientResponseReceived internalCallback, XDataReceived userCallback)
        {
            var requestState = new XRequestState
            {
                InternalCallback = internalCallback,
                UserCallback     = userCallback,
                JsonRequest      = BuildJsonPost(method, args),
                Request          = (HttpWebRequest)WebRequest.Create(_Settings.XJsonInterfaceAddress)
            };

            requestState.Request.Credentials = new NetworkCredential(_Settings.UserName, _Settings.Password);
            requestState.Request.ContentType = "application/json";
            requestState.Request.Method      = "POST";
            requestState.Request.BeginGetRequestStream(ResponseStreamReceived, requestState);
        }
예제 #2
0
        public void GetData(string method, object args, XClientResponseReceived internalCallback, XDataReceived userCallback)
        {
            var requestState = new XRequestState
                                   {
                                       InternalCallback = internalCallback,
                                       UserCallback = userCallback,
                                       JsonRequest = BuildJsonPost(method, args),
                                       Request = (HttpWebRequest) WebRequest.Create(mSettings.XJsonInterfaceAddress),
                                       RequestOperation = method
                                   };

            requestState.Request.Credentials = new NetworkCredential(mSettings.UserName, mSettings.Password);
            requestState.Request.ContentType = "application/json";
            requestState.Request.Method = "POST";
            requestState.Request.BeginGetRequestStream(ResponseStreamReceived, requestState);
        }