コード例 #1
0
        /// <summary>
        /// Gets the resources using the Discovery protocol.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="parent">The parent.</param>
        /// <returns>The message identifier.</returns>
        public Task <long> GetResources(string uri, ResourceViewModel parent = null)
        {
            var  contentTypes = new string[0];
            long messageId;

            if (Model == null)
            {
                messageId = EtpExtender.GetResources(uri);
            }
            else if (Model.DiscoveryFunction == Functions.FindResources)
            {
                messageId = EtpExtender.FindResources(uri);
            }
            else if (Model.DiscoveryFunction == Functions.GetTreeResources)
            {
                messageId = EtpExtender.GetTreeResources(uri, Model.DiscoveryDepth, contentTypes);
            }
            else if (Model.DiscoveryFunction == Functions.GetGraphResources)
            {
                messageId = EtpExtender.GetGraphResources(uri, Model.DiscoveryScope, Model.GroupByType, Model.DiscoveryDepth, contentTypes);
            }
            else
            {
                messageId = EtpExtender.GetResources(uri);
            }

            return(Task.FromResult(messageId));
        }
コード例 #2
0
        /// <summary>
        /// Finds the resources using the DiscoveryQuery protocol.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="parent">The parent.</param>
        /// <returns>The message identifier.</returns>
        public Task <long> FindResources(string uri, ResourceViewModel parent = null)
        {
            var result = EtpExtender.FindResources(uri);

            return(Task.FromResult(result));
        }