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; }
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; }