private void WindowsUpdatesConfigurationToUI(JObject root)
        {
            WindowsUpdatesDataContract.ReportedProperties reportedProperties = WindowsUpdatesDataContract.ReportedProperties.FromJsonObject(root);

            ReportedInstalled.Text         = reportedProperties.installed;
            ReportedApproved.Text          = reportedProperties.approved;
            ReportedFailed.Text            = reportedProperties.failed;
            ReportedInstallable.Text       = reportedProperties.installable;
            ReportedPendingReboot.Text     = reportedProperties.pendingReboot;
            ReportedLastScanTime.Text      = reportedProperties.lastScanTime;
            ReportedDeferUpgrade.IsChecked = reportedProperties.deferUpgrade;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve Windows Updates via device twin.
        /// </summary>
        private async void GetWindowsUpdateButton_ClickAsync(object sender, RoutedEventArgs e)
        {
            var twinResult = await _mainPage.GetTwinData(WindowsUpdatesDataContract.SectionName);

            if (twinResult != null)
            {
                WindowsUpdatesDataContract.ReportedProperties reportedProperties = WindowsUpdatesDataContract.ReportedProperties.FromJsonObject((JObject)twinResult);
                UpdateApproved.Text      = reportedProperties.approved;
                UpdateDeferUpgrade.Text  = reportedProperties.deferUpgrade.ToString();
                UpdateFailed.Text        = reportedProperties.failed;
                UpdateInstallable.Text   = reportedProperties.installable;
                UpdateInstalled.Text     = reportedProperties.installed;
                UpdateLastScanTime.Text  = reportedProperties.lastScanTime;
                UpdatePendingReboot.Text = reportedProperties.pendingReboot;
            }
        }
        // IClientPropertyHandler
        public async Task <JObject> GetReportedPropertyAsync()
        {
            Logger.Log("WindowsUpdatesHandler.GetReportedPropertyAsync()", LoggingLevel.Verbose);

            var request  = new Message.GetWindowsUpdatesRequest();
            var response = await _systemConfiguratorProxy.SendCommandAsync(request) as Message.GetWindowsUpdatesResponse;

            WindowsUpdatesDataContract.ReportedProperties reportedProperties = new WindowsUpdatesDataContract.ReportedProperties();

            reportedProperties.approved      = response.configuration.approved;
            reportedProperties.deferUpgrade  = response.configuration.deferUpgrade;
            reportedProperties.failed        = response.configuration.failed;
            reportedProperties.installable   = response.configuration.installable;
            reportedProperties.installed     = response.configuration.installed;
            reportedProperties.lastScanTime  = response.configuration.lastScanTime;
            reportedProperties.pendingReboot = response.configuration.pendingReboot;

            return(reportedProperties.ToJsonObject());
        }