Beispiel #1
0
        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);
            }
        }
 public FlightingPageVM() : base()
 {
     FlightRings = DevicePortalUtil.GetRings().ToList();
 }