diff --git a/86BoxManager/Properties/AssemblyInfo.cs b/86BoxManager/Properties/AssemblyInfo.cs index d2a9110..f57e6c1 100644 --- a/86BoxManager/Properties/AssemblyInfo.cs +++ b/86BoxManager/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.3.0.0")] -[assembly: AssemblyFileVersion("1.3.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.1.0")] +[assembly: AssemblyFileVersion("1.3.1.0")] \ No newline at end of file diff --git a/86BoxManager/dlgSettings.Designer.cs b/86BoxManager/dlgSettings.Designer.cs index 439ac19..c544077 100644 --- a/86BoxManager/dlgSettings.Designer.cs +++ b/86BoxManager/dlgSettings.Designer.cs @@ -47,6 +47,7 @@ private void InitializeComponent() // btnApply // this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnApply.Enabled = false; this.btnApply.Location = new System.Drawing.Point(567, 164); this.btnApply.Name = "btnApply"; this.btnApply.Size = new System.Drawing.Size(75, 30); diff --git a/86BoxManager/dlgSettings.cs b/86BoxManager/dlgSettings.cs index 88641b7..8a7a933 100644 --- a/86BoxManager/dlgSettings.cs +++ b/86BoxManager/dlgSettings.cs @@ -44,6 +44,7 @@ private void btnCancel_Click(object sender, EventArgs e) private void btnApply_Click(object sender, EventArgs e) { SaveSettings(); + btnApply.Enabled = false; } private void btnOK_Click(object sender, EventArgs e) @@ -60,8 +61,7 @@ private void txt_TextChanged(object sender, EventArgs e) } else { - //btnApply.Enabled = true; - settingsChanged = true; + settingsChanged = CheckForChanges(); //true; btnOK.Enabled = true; } } @@ -168,12 +168,12 @@ private void btnBrowse2_Click(object sender, EventArgs e) private void cbxMinimize_CheckedChanged(object sender, EventArgs e) { - settingsChanged = true; + settingsChanged = CheckForChanges();//true; } private void cbxShowConsole_CheckedChanged(object sender, EventArgs e) { - settingsChanged = true; + settingsChanged = CheckForChanges();//true; } private void btnDefaults_Click(object sender, EventArgs e) @@ -201,12 +201,27 @@ private void ResetSettings() private void cbxCloseTray_CheckedChanged(object sender, EventArgs e) { - settingsChanged = true; + settingsChanged = CheckForChanges();//true; } private void cbxMinimizeTray_CheckedChanged(object sender, EventArgs e) { - settingsChanged = true; + settingsChanged = CheckForChanges();//true; + } + + //Checks if all controls match the currently saved settings to determine if any changes were made + private bool CheckForChanges() + { + RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box"); + + btnApply.Enabled = (txtEXEdir.Text != regkey.GetValue("EXEdir").ToString() || + txtCFGdir.Text != regkey.GetValue("CFGdir").ToString() || + cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) || + cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) || + cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) || + cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray"))); + + return btnApply.Enabled; } } } diff --git a/86BoxManager/frmMain.cs b/86BoxManager/frmMain.cs index 82dca5c..2a74446 100644 --- a/86BoxManager/frmMain.cs +++ b/86BoxManager/frmMain.cs @@ -251,7 +251,7 @@ private void LoadVMs() } //Wait for the associated window of a VM to close - private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) + private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { VM vm = e.Argument as VM; try @@ -264,7 +264,6 @@ private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWork MessageBox.Show("An error has occurred. Please provide the following details to the developer:\n" + ex.Message + "\n" + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } e.Result = vm; - } //Update the UI once the VM's window is closed @@ -1090,8 +1089,8 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e) { return; } - Application.Exit(); } + Application.Exit(); } //Handles things when WindowState changes @@ -1130,13 +1129,26 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e) private void killToolStripMenuItem_Click(object sender, EventArgs e) { - //Ask the user to confirm and kill the VM's process + VMKill(); + } + + //Kills the process associated with the selected VM + private void VMKill() + { + //Ask the user to confirm DialogResult = MessageBox.Show("Killing a virtual machine can cause data loss. Only do this if 86Box.exe process gets stuck. Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if(DialogResult == DialogResult.Yes) + if (DialogResult == DialogResult.Yes) { VM vm = (VM)lstVMs.FocusedItem.Tag; Process p = Process.GetProcessById(vm.Pid); - p.Kill(); + try + { + p.Kill(); + } + catch (Exception ex) + { + MessageBox.Show("Could not kill 86Box.exe. The process may have already ended on its own or access was denied.", "Could not kill process", MessageBoxButtons.OK, MessageBoxIcon.Error); + } //We need to cleanup afterwards to make sure the VM is put back into a valid state vm.Status = VM.STATUS_STOPPED; diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..440cc69 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,4 @@ +The following individuals or organizations have contributed at least some code to the 86Box Manager project: + +David Simunič (@daviunic) +David Lee (@DL444) \ No newline at end of file