protected override Task OnCompleteAsync(string lockToken)
        {
            var customHeaders = PrepareCustomHeaders(
                CommonConstants.DeviceBoundPathCompleteTemplate.FormatInvariant(this.deviceId, lockToken),
                null,
                CommonConstants.CloudToDeviceOperation);

            var eTag = new ETagHolder {
                ETag = lockToken
            };

            return(this.httpClientHelper.DeleteAsync(
                       GetRequestUri(this.deviceId, CommonConstants.DeviceBoundPathTemplate + "/{0}".FormatInvariant(lockToken), null),
                       eTag,
                       ExceptionHandlingHelper.GetDefaultErrorMapping(),
                       customHeaders,
                       CancellationToken.None));
        }
Exemple #2
0
        protected override void OnReject(string lockToken)
        {
            var pathTemplate = new StringBuilder(CommonConstants.DeviceBoundPathRejectTemplate);

            Hashtable customHeaders = PrepareCustomHeaders(pathTemplate.Replace("{1}", lockToken).ToString(), null, CommonConstants.CloudToDeviceOperation);

            var eTag = new ETagHolder {
                ETag = lockToken
            };

            Hashtable fields = new Hashtable();

            fields.Add("reject", null);

            this.httpClientHelper.Delete(
                GetRequestUri(this.deviceId, CommonConstants.DeviceBoundPathTemplate + "/" + lockToken, fields),
                eTag,
                customHeaders);
        }
        protected override Task OnRejectAsync(string lockToken)
        {
            var customHeaders = PrepareCustomHeaders(
                CommonConstants.DeviceBoundPathRejectTemplate.FormatInvariant(this.deviceId, lockToken),
                null,
                CommonConstants.CloudToDeviceOperation);

            var eTag = new ETagHolder { ETag = lockToken };

            return this.httpClientHelper.DeleteAsync(
                GetRequestUri(this.deviceId, CommonConstants.DeviceBoundPathTemplate + "/{0}".FormatInvariant(lockToken), new Dictionary<string, string> { { "reject", null } }),
                eTag,
                ExceptionHandlingHelper.GetDefaultErrorMapping(),
                customHeaders,
                CancellationToken.None);
        }
        protected override void OnReject(string lockToken)
        {
            var pathTemplate = new StringBuilder(CommonConstants.DeviceBoundPathRejectTemplate);

            Hashtable customHeaders = PrepareCustomHeaders(pathTemplate.Replace("{1}", lockToken).ToString(), null, CommonConstants.CloudToDeviceOperation);

            var eTag = new ETagHolder { ETag = lockToken };

            Hashtable fields = new Hashtable();
            fields.Add("reject", null);

            this.httpClientHelper.Delete(
                GetRequestUri(this.deviceId, CommonConstants.DeviceBoundPathTemplate + "/" + lockToken, fields),
                eTag,
                customHeaders);
        }