Ejemplo n.º 1
0
 private void Window_Initialized(object sender, EventArgs e)
 {
     if (WindowsVersion.GetOSCompleteVersion() >= Version.Parse(@"6.4"))
     {
         _isWin10 = true;
     }
     Reflesh();
 }
Ejemplo n.º 2
0
        private void Reflesh()
        {
            WindowsVersionLabel.Content = string.Format(@"版本:{0}", WindowsVersion.GetOSCompleteVersion());
            //Windows Update
            if (!_isWin10 && !Reg.Exist(Win10UpdateKey, WinUpdateValue))
            {
                ChooseUpdateBox.SelectedIndex = 0;
            }
            else
            {
                var type = Convert.ToInt32(Reg.Read(Win10UpdateKey, WinUpdateValue));                //如果键值不存在 type==0
                if (type <= 4 && type >= 1)
                {
                    ChooseUpdateBox.SelectedIndex = type - 1;
                }

                /*else
                 * {
                 *      ChooseUpdateBox.IsEnabled = false;
                 * }*/
            }
            //Auto Install Updates
            AutoInstallUpdates_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(Win10UpdateKey, AutoInstallUpdatesValue)) == 1;
            //No Auto Reboot
            NoAutoReboot_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(Win10UpdateKey, NoAutoRebootValue)) == 1;
            //Disable OneDrive
            DisableOneDrive_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableOneDriveKey, DisableOneDriveValue)) == 1;
            //Allow Cortana
            DisableCortana_CheckBox.IsChecked = Reg.Exist(DisableCortanaKey, AllowCortanaValue) && Convert.ToInt32(Reg.Read(DisableCortanaKey, AllowCortanaValue)) == 0;
            //Disable Windows Defender
            DisableWindowsDefender_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableWindowsDefenderKey, DisableWindowsDefenderValue)) == 1;
            //Disable Custom Folder
            DisableCustomFolder_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableCustomFolderKey, DisableCustomFolderValue)) == 1;
            //Exclude Drivers
            if (WindowsVersion.GetOSCompleteVersion() >= Version.Parse(@"10.0.14328.1000"))
            {
                ExcludeWUDrivers_CheckBox.IsEnabled = true;
                ExcludeWUDrivers_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(ExcludeWUDriversKey, ExcludeWUDriversValue)) == 1;
            }
            else
            {
                ExcludeWUDrivers_CheckBox.IsEnabled = false;
                ExcludeWUDrivers_CheckBox.IsChecked = false;
            }
            //Exclude MRT
            ExcludeMRT_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(ExcludeMRTKey, ExcludeMRTValue)) == 1;
        }