예제 #1
0
        /// <summary>
        /// Call Get on application and initialize communication resource
        /// </summary>
        /// <param name="endpointId">The application endpoint's sip id</param>
        /// <param name="loggingContext"><see cref="LoggingContext"/> to be used for logging all related events.</param>
        public async Task RefreshAndInitializeAsync(string endpointId, LoggingContext loggingContext = null)
        {
            await this.RefreshAsync(loggingContext).ConfigureAwait(false);

            if (this.PlatformResource.Applications != null)
            {
                Uri baseUri         = UriHelper.GetBaseUriFromAbsoluteUri(this.PlatformResource.Applications.Href);
                Uri applicationsUri = new Uri(this.PlatformResource.Applications.Href);
                if (!string.IsNullOrEmpty(endpointId))
                {
                    applicationsUri = UriHelper.AppendQueryParameterOnUrl(applicationsUri.ToString(), Constants.EndpointId, endpointId, false);
                }

                #pragma warning disable CS0618 // Type or member is obsolete
                Applications = new Applications(RestfulClient, null, baseUri, applicationsUri, this);
                await Applications.RefreshAndInitializeAsync(loggingContext).ConfigureAwait(false);

                #pragma warning restore CS0618 // Type or member is obsolete
            }
            else
            {
                throw new RemotePlatformServiceException("Retrieved DiscoverResource doesn't have link to ApplicationsResource.");
            }
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Application"/> class.
 /// </summary>
 /// <param name="restfulClient">The restful client.</param>
 /// <param name="resource">The resource.</param>
 /// <param name="baseUri">The base URI.</param>
 /// <param name="resourceUri">The resource URI.</param>
 /// <param name="parent">The parent.</param>
 internal Application(IRestfulClient restfulClient, ApplicationResource resource, Uri baseUri, Uri resourceUri, Applications parent)
     : base(restfulClient, resource, baseUri, resourceUri, parent)
 {
 }