private void MachineEvents_MachineHalted(object sender, MachineHaltedEventArgs e) { updater.Stop(); if (e.Reason == MachineHaltReason.Crash) { if (e.CrashException.Message.Contains(MachineErrorMessages.NoEepromFound)) { MessageBox.Show("Machine EEPROM not found or empty. It prevents booting machine, install proper EEPROM with code or make it yourself.", "Machine EEPROM not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (e.CrashException.Message.Contains(MachineErrorMessages.FailedToLoadBios)) { MessageBox.Show("Unable to load BIOS from EEPROM, it maybe caused by corrupted EEPROM code, syntax code or something else. You can find more information below:\r\n\r\n" + e.CrashException.Message, "Machine BIOS load failed!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Machine has crashed with unknown error!\r\n\r\nSomething critical happened while running VM! More information can be found below:\r\n\r\n" + e.CrashException.Message + "\r\nStack trace:\r\n" + e.CrashException.StackTrace); } } else if (e.Reason == MachineHaltReason.Shutdown) { Machine.RunningInstance.ClearState(); } if (InvokeRequired) { Invoke(new Action(() => { this.Close(); })); } else { this.Close(); } }
private void MachineEvents_MachineHalted(object sender, MachineHaltedEventArgs e) { if (InvokeRequired) { Invoke(new Action(() => { this.WindowState = FormWindowState.Normal; })); } else { this.WindowState = FormWindowState.Normal; } }