Playtomic.PResponse.Error C# (CSharp) Method

Error() public static method

public static Error ( int errorcode ) : PResponse
errorcode int
return PResponse
        public static PResponse Error(int errorcode)
        {
            return new PResponse {
                        success = false,
                        errorcode = errorcode
                    };
        }

Usage Example

コード例 #1
0
        /**
         * Rates a level
         * @param	levelid	String	The level id
         * @param	rating	Int		Rating from 1 - 10
         * @param	callback	Action<PResponse> Your callback function
         */
        public static void Rate(string levelid, int rating, Action <PResponse> callback)
        {
            if (rating < 1 || rating > 10)
            {
                callback(PResponse.Error(401));
                return;
            }

            var postdata = new Hashtable
            {
                { "levelid", levelid },
                { "rating", rating }
            };

            PRequest.GetResponse(SECTION, RATE, postdata, callback);
        }