public ShellViewModel GetExistingShellViewModelInstance(SimulationRecordWithModuleInfo simulationRecord) { FourElementTuple newTuple = new FourElementTuple(simulationRecord, new ShellViewModel(simulationRecord)); foreach (FourElementTuple listElement in ExecutableableSimulationContainer) { if (listElement.Equals(newTuple)) { return listElement.ShellViewModel; } } return null; }
public ShellViewModel GetOrCreateShellViewModelInstance(SimulationRecordWithModuleInfo simulationRecord) { ShellViewModel shellViewModel = GetExistingShellViewModelInstance(simulationRecord); if (shellViewModel == null) { FourElementTuple newTuple = new FourElementTuple(simulationRecord, new ShellViewModel(simulationRecord)); ExecutableableSimulationContainer.Add(newTuple); shellViewModel = newTuple.ShellViewModel; } GetTupleBySimulationRecord(simulationRecord).IncreaseCountOfReferences(); return shellViewModel; }
public WindowMessageBase(SimulationRecordWithModuleInfo simulationRecord) { SimulationRecord = simulationRecord; }
public ShellViewModel(SimulationRecordWithModuleInfo simulationRecord) { this.simulationRecord = simulationRecord; }
public Simulator.Infrastructure.Module GetModuleInstanceBySimulationRecord(SimulationRecordWithModuleInfo simulationRecord) { foreach (Simulator.Infrastructure.Module module in modules) { if (simulationRecord.SimulationType.Equals(module.GetType())) { return module; } } return null; }
public OpenSimulationMessage(SimulationRecordWithModuleInfo simulationRecord, string stringParam) : base(simulationRecord) { this.stringParam = stringParam; }
public void RemoveShellViewModelInstance(SimulationRecordWithModuleInfo simulationRecord) { FourElementTuple newTuple = GetTupleBySimulationRecord(simulationRecord); if (newTuple != null) { if (newTuple.CountOfReferences == 1) { newTuple.DecreaseCountOfReferences(); ExecutableableSimulationContainer.Remove(newTuple); } else { newTuple.DecreaseCountOfReferences(); } } }
public FourElementTuple(SimulationRecordWithModuleInfo simulationRecordWithModuleInfo, ShellViewModel shellViewModel) { this.simulationRecordWithModuleInfo = simulationRecordWithModuleInfo; this.shellViewModel = shellViewModel; this.countOfReferences = 0; }
private FourElementTuple GetTupleBySimulationRecord(SimulationRecordWithModuleInfo simulationRecord) { FourElementTuple newTuple = new FourElementTuple(simulationRecord, new ShellViewModel(simulationRecord)); foreach (FourElementTuple listElement in ExecutableableSimulationContainer) { if (listElement.Equals(newTuple)) { return listElement; } } return null; }