public void RunVirtualMachinesUntilTimerInterupt() { for (int i = 0; i < VirtualMachines.Count; i++) { try { if (VirtualMachines[i].IsFinished) { continue; } TI = Settings.Default.TimerStartValue; for (; TI > 0; TI--) { if (!VirtualMachines[i].IsFinished) { ExecuteAction(VirtualMachines[i]); } } } catch (Exception exception) { if (i < VirtualMachines.Count) { VirtualMachines[i].ReleaseResources(); VirtualMachines.Remove(VirtualMachines[i]); MessageBox.Show("Ooops... your program have crased\n" + exception.Message, "Program " + VirtualMachines[i].Name + "(" + VirtualMachines[i].PID + ") have occured error"); } } } }
private void HandleRemovedEvent(IList <RemovedVMEvent> removedVms) { foreach (var removedVM in removedVms) { var vm = VMs.Get(removedVM.VMId); if (vm.HostId > 0) { var server = servers.Get(vm.HostId); server.RemoveVM(vm); } VMs.Remove(vm.Id); } }
//Executes next action of command in file public void ExecuteAction(VirtualMachine virtualMachine) { try { virtualMachine.DoNextInstruction(); } catch (Exception exception) { virtualMachine.ReleaseResources(); VirtualMachines.Remove(virtualMachine); MessageBox.Show("Ooops... your program have crased\n" + exception.Message, "Program " + virtualMachine.Name + "(" + virtualMachine.PID + ") have occured error"); } }