public static TimeServiceState AsState(this TimeServiceDataContract.ReportedProperties reportedProperties)
        {
            TimeServiceState state = new TimeServiceState();

            state.enabled          = reportedProperties.enabled == TimeServiceDataContract.JsonYes;
            state.startup          = reportedProperties.startup == TimeServiceDataContract.JsonAuto ? ServiceStartup.Auto : ServiceStartup.Manual;
            state.started          = reportedProperties.started == TimeServiceDataContract.JsonYes;
            state.settingsPriority = PolicyHelpers.SettingsPriorityFromString(reportedProperties.sourcePriority);
            return(state);
        }
        public async Task SetTimeServiceAsync(TimeServiceState userDesiredState)
        {
            // Construct the request and send it...
            Message.Policy policy = new Message.Policy();
            policy.source           = Message.PolicySource.Local;
            policy.sourcePriorities = userDesiredState.settingsPriority == SettingsPriority.Local ? _priorityLocal : _priorityRemote;

            Message.TimeServiceData data = new Message.TimeServiceData();
            data.enabled = userDesiredState.enabled ? TimeServiceDataContract.JsonYes : TimeServiceDataContract.JsonNo;
            data.startup = userDesiredState.startup == ServiceStartup.Auto ? TimeServiceDataContract.JsonAuto : TimeServiceDataContract.JsonManual;
            data.started = userDesiredState.started ? TimeServiceDataContract.JsonYes : TimeServiceDataContract.JsonNo;
            data.policy  = policy;

            var setRequest = new Message.SetTimeServiceRequest(data);

            await this._systemConfiguratorProxy.SendCommandAsync(setRequest);

            // Get the current state....
            TimeServiceDataContract.ReportedProperties reportedProperties = await GetTimeServiceAsync();

            await this._callback.ReportPropertiesAsync(PropertySectionName, reportedProperties.ToJsonObject());
        }
 public async Task SetTimeServiceAsync(TimeServiceState desiredState)
 {
     await _timeServiceHandler.SetTimeServiceAsync(desiredState);
 }