Skip to content

Commit

Permalink
Fixed issue #36
Browse files Browse the repository at this point in the history
A proper error is now displayed when a non-existent VM is started via a shortcut.
Also changed the "VM already running" messagebox to information.
  • Loading branch information
daviunic committed Dec 31, 2018
1 parent 4023ffb commit ff566ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions 86BoxManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]
23 changes: 16 additions & 7 deletions 86BoxManager/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -983,18 +983,27 @@ protected override void WndProc(ref Message m)
//Get the VM name and find the associated LVI and VM object
CopyDataStruct ds = (CopyDataStruct)m.GetLParam(typeof(CopyDataStruct));
ListViewItem lvi = lstVMs.FindItemWithText(ds.Data);
VM vm = (VM)lvi.Tag;

//If the VM is already running, display an error, otherwise, start it
if (vm.Status != VM.STATUS_STOPPED)
//This check is necessary in case the specified VM was already removed but the shortcut remains
if(lvi != null)
{
MessageBox.Show("This virtual machine is already running.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
VM vm = (VM)lvi.Tag;

//If the VM is already running, display an error, otherwise, start it
if (vm.Status != VM.STATUS_STOPPED)
{
MessageBox.Show("The virtual machine \"" + ds.Data + "\" is already running.", "Virtual machine already running", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
lvi.Focused = true;
lvi.Selected = true;
VMStart();
}
}
else
{
lvi.Focused = true;
lvi.Selected = true;
VMStart();
MessageBox.Show("The virtual machine \"" + ds.Data + "\" could not be found. It may have been removed or the specified name is invalid.", "Virtual machine not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
base.WndProc(ref m);
Expand Down

0 comments on commit ff566ea

Please sign in to comment.