コード例 #1
0
        /// <summary>Gets the device status indicating if the device can be used with the system asynchronous.</summary>
        public async Task <Domain.Models.ResponseModels.RegisterDeviceModel> GetDeviceStatusAsync()
        {
            Acs.Domain.Models.RequestModels.RegisterDeviceModel deviceInfo = GetDeviceDetails();

            Domain.Models.ResponseModels.RegisterDeviceModel sd = await _authService.GetDeviceStatusAsync(deviceInfo);

            Settings.SetAuthorizationToken(sd.AuthToken);

            return(sd);
        }
コード例 #2
0
        /// <summary>Registers the device asynchronously.</summary>
        /// <returns>A Task<Domain.Models.ResponseModels.RegisterDeviceModel>.</returns>
        public async Task <Domain.Models.ResponseModels.RegisterDeviceModel> RegisterDeviceAsync()
        {
            Acs.Domain.Models.RequestModels.RegisterDeviceModel deviceInfo = GetDeviceDetails();

            // Register device and set AuthToken
            Domain.Models.ResponseModels.RegisterDeviceModel registerModel = await _authService.RegisterDeviceAsync(deviceInfo);

            Settings.SetAuthorizationToken(registerModel.AuthToken);

            return(registerModel);
        }
コード例 #3
0
        /// <summary>Helper method to obtain the disparate pieces of information about the device.</summary>
        private Acs.Domain.Models.RequestModels.RegisterDeviceModel GetDeviceDetails()
        {
            Settings.SetSerialNumber(CrossDevice.Hardware.DeviceId);

            Settings.SetDomainName(Constants.DefaultDomainName);
            Settings.SetApplicationId(Constants.DefaultApplicationId);
            Settings.SetVersion(CrossDevice.App.Version);

            Acs.Domain.Models.RequestModels.RegisterDeviceModel deviceInfo = new Acs.Domain.Models.RequestModels.RegisterDeviceModel();

            deviceInfo.SerialNumber = Settings.GetSerialNumber();
            deviceInfo.AuthToken    = Settings.GetAuthorizationToken();
            deviceInfo.DeviceName   = CrossDevice.Hardware.Manufacturer + " " + CrossDevice.Hardware.Model;
            deviceInfo.OS           = CrossDevice.Hardware.OperatingSystem;
            deviceInfo.Version      = CrossDevice.Hardware.OperatingSystemVersion;
            deviceInfo.Manufacturer = CrossDevice.Hardware.Manufacturer;
            deviceInfo.Model        = CrossDevice.Hardware.Model;

            return(deviceInfo);
        }
コード例 #4
0
        /// <summary>Allows the device's status to be changed changed asynchronous.</summary>
        public Task ChangeDeviceStatusAsync()
        {
            Acs.Domain.Models.RequestModels.RegisterDeviceModel deviceInfo = GetDeviceDetails();

            return(_authService.ChangeDeviceStatusAsync(deviceInfo));
        }