Пример #1
0
        public async Task Put(CameraProperty cameraProperty, string value)
        {
            Uri uri = CreateUri(cameraProperty.UrlPath);

            using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri))
            {
                using (var response = await downloadHelper.SendToCamera(httpRequestMessage, Token).ConfigureAwait(false))
                {
                    var xmlDocument = await GetXMLDocumentFromResponse(response).ConfigureAwait(false);

                    XPathNavigator rootNavigator = xmlDocument.DocumentElement.CreateNavigator();

                    XPathNodeIterator childNodeIter = rootNavigator.Select(cameraProperty.XPathForGet.Path);
                    if (childNodeIter != null && childNodeIter.MoveNext())
                    {
                        childNodeIter.Current.SetValue(value);
                    }
                    else
                    {
                        throw new InvalidOperationException("Element not found in response");
                    }

                    using (HttpRequestMessage httpRequestMessage1 = new HttpRequestMessage(HttpMethod.Put, uri))
                    {
                        await downloadHelper.SendToCamera(httpRequestMessage1, Token, xmlDocument.OuterXml).ConfigureAwait(false);
                    }
                    await FetchPropertiesForCommonUri(uri, new CameraProperty[] { cameraProperty }).ConfigureAwait(false);
                }
            }
        }
 public CameraPropertyInfo(CameraProperty property, [AllowNull] string value)
 {
     Property = property;
     Value    = value;
 }
Пример #3
0
 private async Task Enqueue(CameraProperty cameraInfo, [AllowNull] string value)
 {
     Trace.WriteLine(Invariant($"[{CameraSettings.Name}]Property:{cameraInfo.Name} Value:{value ?? string.Empty}"));
     await Updates.EnqueueAsync(new CameraPropertyInfo(cameraInfo, value), Token).ConfigureAwait(false);
 }