private void InstallGpuFeature() { try { if (MessageBox.Show("Want install Remote-Desktop-Services and RDS-Virtualization feature?", "Install GPU feature", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { List <InstallResult> installResult = Utilite.InstallGPUFeature(); int showFlag = 0; if (installResult.Where(s => s.RestartNeeded == true).Count() > 0) { if (MessageBox.Show("You need to restart your computer to finish installing.", "Reboot computer", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { showFlag++; Utilite.Reboot(); } } if (showFlag == 0 && (installResult.Where(s => s.Success == true).Count() == 2)) { MessageBox.Show("Install Success."); } } } catch (Exception ex) { MessageBox.Show("Install fail : " + ex.ToString()); } }
private void Reboot_Click(object sender, EventArgs e) { if (MessageBox.Show("This will reboot computer. Confirm?", "Reboot computer", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { Utilite.Reboot(); } }