コード例 #1
0
        ///<summary>
        /// Create a <see cref="PUTContent"/> object, that includes raw byte content.
        ///</summary>
        ///<param name="data">A byte[] array containing data to be sent to the server.</param>
        ///<returns>A <see cref="PUTContent"/> object encapsulating the byte array data, formatted for PUT requests.</returns>
        new public static PUTContent CreateBinaryBasedContent(byte[] data)
        {
            POSTContent post = POSTContent.CreateBinaryBasedContent(data);
            PUTContent  put  = new PUTContent();

            put.ByteContent = post.ByteContent;
            return(put);
        }
コード例 #2
0
        ///<summary>
        /// Create a <see cref="PUTContent"/> object, that is typically used for html forms.
        ///</summary>
        ///<param name="keyValuePairs">A <see cref="T:System.Collection.IDictionary"/> object containing key/value pairs for the http body.</param>
        ///<returns>A <see cref="PUTContent"/> object encapsulating the key/value pairs as a byte array, formatted for PUT requests.</returns>
        new public static PUTContent CreateWebFormData(IDictionary keyValuePairs)
        {
            POSTContent post = POSTContent.CreateWebFormData(keyValuePairs);
            PUTContent  put  = new PUTContent();

            put.ByteContent = post.ByteContent;
            return(put);
        }
コード例 #3
0
        ///<summary>
        /// Create a <see cref="PUTContent"/> object, that includes text content, typically used for JSON, XML, or plan text.
        ///</summary>
        ///<param name="content">String data that will be sent to the server.</param>
        ///<returns>A <see cref="PUTContent"/> object encapsulating the string data, formatted for PUT requests.</returns>
        new public static PUTContent CreateTextBasedContent(string content)
        {
            POSTContent post = POSTContent.CreateTextBasedContent(content);
            PUTContent  put  = new PUTContent();

            put.ByteContent = post.ByteContent;
            return(put);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: michboon/comp2014
 void button_ButtonPressed(Button sender, Button.ButtonState state)
 {
     sensorState = (sensorState.Equals("0")) ? "1" : "0";
     Debug.Print(sensorState);
     PUTContent emptyPut = new PUTContent();
     Gadgeteer.Networking.HttpRequest req = HttpHelper.CreateHttpPutRequest("http://" + rpi + ":9090/gadgeteer/state/" + sensorState + "/", emptyPut, null);
     req.SendRequest();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: kingaM/RoboHome
        void pollState()
        {
            while (true)
            {
                String newState = (pir.SensorStillActive) ? "1" : "0";

                if (!newState.Equals(sensorState))
                {
                    sensorState = newState;
                    Debug.Print(sensorState);
                    PUTContent emptyPut = new PUTContent();
                    Gadgeteer.Networking.HttpRequest req = HttpHelper.CreateHttpPutRequest("http://" + rpi + ":9090/gadgeteer/state/" + sensorState + "/", emptyPut, null);
                    req.SendRequest();
                }
                Thread.Sleep(1000);
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: michboon/comp2014
 void pollLight()
 {
     while (true)
     {
         double lightPercent = lightSensor.ReadLightSensorPercentage();
         Debug.Print(lightPercent.ToString());
         String newState = (lightPercent >= 50) ? "1" : "0";
         Debug.Print(newState);
         if (!sensorState.Equals(newState))
         {
             sensorState = newState;
             Debug.Print(sensorState);
             PUTContent emptyPut = new PUTContent();
             Gadgeteer.Networking.HttpRequest req = HttpHelper.CreateHttpPutRequest("http://" + rpi + ":9090/gadgeteer/state/" + sensorState + "/", emptyPut, null);
             req.SendRequest();
         }
         Thread.Sleep(1000);
     }
 }
コード例 #7
0
ファイル: HttpHelper.cs プロジェクト: EmiiFont/MyShuttle_RC
 /// <summary>
 /// Create an Http PUT request.
 /// </summary>
 /// <param name="Url">The Url of the web server to which the request will be sent.</param>
 /// <param name="Content">The <see cref="PUTContent"/> object to be sent to the Url.</param>
 /// <param name="ContentType">The MIME-Type of the message.</param>
 /// <returns>An <see cref="HttpRequest"/> object that can be used to make PUT request.</returns>
 public static HttpRequest CreateHttpPutRequest(string Url, PUTContent Content, string ContentType)
 {
     return new HttpRequest(HttpRequest.RequestMethod.PUT, Url, Content, ContentType, null, null);
 }
コード例 #8
0
 /// <summary>
 /// Create an Http PUT request.
 /// </summary>
 /// <param name="url">The Url of the web server to which the request will be sent.</param>
 /// <param name="content">The <see cref="PUTContent"/> object to be sent to the Url.</param>
 /// <param name="contentType">The MIME-Type of the message.</param>
 /// <returns>An <see cref="HttpRequest"/> object that can be used to make PUT request.</returns>
 public static HttpRequest CreateHttpPutRequest(string url, PUTContent content, string contentType)
 {
     return(new HttpRequest(HttpRequest.RequestMethod.PUT, url, content, contentType, null, null));
 }
コード例 #9
0
ファイル: HttpContent.cs プロジェクト: EmiiFont/MyShuttle_RC
 ///<summary>
 /// Create a <see cref="PUTContent"/> object, that includes raw byte content.
 ///</summary>
 ///<param name="data">A byte[] array containing data to be sent to the server.</param>
 ///<returns>A <see cref="PUTContent"/> object encapsulating the byte array data, formatted for PUT requests.</returns>
 new public static PUTContent CreateBinaryBasedContent(byte[] data)
 {
     POSTContent post = POSTContent.CreateBinaryBasedContent(data);
     PUTContent put = new PUTContent();
     put.byteContent = post.byteContent;
     return put;
 }
コード例 #10
0
ファイル: HttpContent.cs プロジェクト: EmiiFont/MyShuttle_RC
 ///<summary>
 /// Create a <see cref="PUTContent"/> object, that includes text content, typically used for JSON, XML, or plan text.
 ///</summary>
 ///<param name="content">String data that will be sent to the server.</param>
 ///<returns>A <see cref="PUTContent"/> object encapsulating the string data, formatted for PUT requests.</returns>
 new public static PUTContent CreateTextBasedContent(string content)
 {
     POSTContent post = POSTContent.CreateTextBasedContent(content);
     PUTContent put = new PUTContent();
     put.byteContent = post.byteContent;
     return put;
 }
コード例 #11
0
ファイル: HttpContent.cs プロジェクト: EmiiFont/MyShuttle_RC
 ///<summary>
 /// Create a <see cref="PUTContent"/> object, that is typically used for html forms. 
 ///</summary>
 ///<param name="keyValuePairs">A <see cref="T:System.Collection.IDictionary"/> object containing key/value pairs for the http body.</param>
 ///<returns>A <see cref="PUTContent"/> object encapsulating the key/value pairs as a byte array, formatted for PUT requests.</returns>
 new public static PUTContent CreateWebFormData(IDictionary keyValuePairs)
 {
     POSTContent post = POSTContent.CreateWebFormData(keyValuePairs);
     PUTContent put = new PUTContent();
     put.byteContent = post.byteContent;
     return put;
 }
コード例 #12
0
 /// <summary>
 /// Create an Http PUT request.
 /// </summary>
 /// <param name="Url">The Url of the web server to which the request will be sent.</param>
 /// <param name="Content">The <see cref="PUTContent"/> object to be sent to the Url.</param>
 /// <param name="ContentType">The MIME-Type of the message.</param>
 /// <returns>An <see cref="HttpRequest"/> object that can be used to make PUT request.</returns>
 public static HttpRequest CreateHttpPutRequest(string Url, PUTContent Content, string ContentType)
 {
     return(new HttpRequest(HttpRequest.RequestMethod.PUT, Url, Content, ContentType, null, null));
 }