private async Task UpdateInfoAsync() { try { await _updateSemaphore.WaitAsync(); InfoCollection.Clear(); string nl = Environment.NewLine; var cred = DevicePortalUtil.GetCredential(); if (cred != null) { var ring = await DevicePortalUtil.GetFlightRingAsync(cred.UserName, cred.Password); if (ring != null) { CurrentFlightRing = ring; } var telemetryLevelOutput = await DevicePortalUtil.GetTelemetryLevelAsync(cred.UserName, cred.Password); if (telemetryLevelOutput != DevicePortalUtil.InvalidTelemetryValue) { InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("TelemetryLevelText") + ": ", DevicePortalUtil.TelemetryLevelToFriendlyName(telemetryLevelOutput))); } } else { App.LogService.Write("Credential is null", Windows.Foundation.Diagnostics.LoggingLevel.Warning); } } finally { _updateSemaphore.Release(); } }
private async Task <bool> UpdatePrivacyLevelAsync(int level) { var cred = DevicePortalUtil.GetCredential(); if (cred != null) { if (await DevicePortalUtil.SetTelemetryLevelAsync(cred.UserName, cred.Password, level)) { _previousLevel = level; return(true); } } return(false); }
private async Task UpdateInfoAsync() { var cred = DevicePortalUtil.GetCredential(); if (cred == null) { return; } var packages = await DevicePortalUtil.GetInstalledPackagesAsync(cred.UserName, cred.Password); if (packages != null) { Items = packages.InstalledPackages.Where(x => x.AppListEntry == 0).ToList(); } }
public async Task SetUpVM() { IsBasicLevelSelected = false; IsFullLevelSelected = false; SetTelemetryLevelResult = string.Empty; var cred = DevicePortalUtil.GetCredential(); if (cred != null) { _previousLevel = await DevicePortalUtil.GetTelemetryLevelAsync(cred.UserName, cred.Password); if (_previousLevel == DevicePortalUtil.BasicTelemetryValue) { IsBasicLevelSelected = true; } else if (_previousLevel == DevicePortalUtil.FullTelemetryValue) { IsFullLevelSelected = true; } } }
private async void UpdateFlightRing() { if (CurrentFlightRing is string ring) { var cred = DevicePortalUtil.GetCredential(); if (cred == null) { return; } var output = await DevicePortalUtil.SetFlightRingAsync(cred.UserName, cred.Password, ring); if (output?.ExitCode == 0) { PageService.ShowNotification(string.Format(Common.GetLocalizedText("FlightingRingChange"), ring)); await UpdateInfoAsync(); } else { PageService.ShowNotification(Common.GetLocalizedText("FlightingRingError")); } } }
private async Task UpdateInfoAsync() { var cred = DevicePortalUtil.GetCredential(); if (cred == null) { return; } var osInfo = await DevicePortalUtil.GetOsInfoAsync(cred.UserName, cred.Password); if (osInfo != null) { string nl = Environment.NewLine; InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("ComputerNameText") + ": ", osInfo.ComputerName)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("LanguageText") + ": ", osInfo.Language)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("OSEditionText") + ": ", osInfo.OsEdition)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("OSEditionIDText") + ": ", osInfo.OsEditionId)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("OSVersionText") + ": ", osInfo.OsVersion)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("PlatformText") + ": ", osInfo.Platform)); } }
private async Task <bool> UpdatePrivacyLevelAsync(int level, bool promptUser = true) { // Return false if we're not signed in and we're not allowed to prompt the user if (!promptUser && !await DevicePortalUtil.IsSignedInAsync()) { return(false); } // Prompt the user for credentials if not logged in if (await LoginPopupControl.SignInAsync(Common.GetLocalizedText("PrivacySignInDescription"))) { var cred = DevicePortalUtil.GetCredential(); if (cred != null) { if (await DevicePortalUtil.SetTelemetryLevelAsync(cred.UserName, cred.Password, level)) { _previousLevel = level; return(true); } } } return(false); }
private async Task UpdateInfoAsync() { string nl = Environment.NewLine; var cred = DevicePortalUtil.GetCredential(); if (cred != null) { InfoCollection.Clear(); var status = await DevicePortalUtil.GetWindowsUpdateStatusAsync(cred.UserName, cred.Password); if (status != null) { InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("LastCheckedText"), status.LastCheckTime)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("LastUpdatedText"), status.LastUpdateTime)); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("UpdatedStateText"), DevicePortalUtil.GetUpdateState(status.UpdateState))); InfoCollection.Add(new InfoDisplayData(Common.GetLocalizedText("StatusMessageText"), status.UpdateStatusMessage)); // UpdateStatusMessage is not localized } } else { App.LogService.Write("Credential is null", Windows.Foundation.Diagnostics.LoggingLevel.Warning); } }