Пример #1
0
        /// <summary>
        /// Get the user profile information from the server
        /// </summary>
        /// <returns>User profile data as a model object</returns>
        private async Task <AccountApiModel> GetUserProfileAsync()
        {
            var settingsApi        = new SettingsApi();
            var accountDetailsJson = await settingsApi.GetUserProfileJsonAsync();

            return(!string.IsNullOrWhiteSpace(accountDetailsJson) ?
                   DeserializeUserAccountDetails(accountDetailsJson) : new AccountApiModel());
        }
Пример #2
0
        /// <summary>
        /// Get the user license type and the expiration date
        /// </summary>
        /// <returns>A KeyValuePair with the license type as the key and license expiration date as the value</returns>
        private async Task <KeyValuePair <LicenseType, string> > GetLicenseInfoAsync()
        {
            // License type
            LicenseType licenseType = await new LicenseController().GetUserLicenseTypeAsync();

            // License expiration date
            var settingsApi        = new SettingsApi();
            var licenseDetailsJson = await settingsApi.GetLicenseDetailsJsonAsync();

            // check for invalid return type after license request
            // check the length because personal license will return "[]" - empty json array
            var expirationDate = !string.IsNullOrWhiteSpace(licenseDetailsJson) && licenseDetailsJson.Length > 3 ?
                                 DeserializeLicenseDetails(licenseDetailsJson).expires : string.Empty;

            return(new KeyValuePair <LicenseType, string>(licenseType, expirationDate));
        }