private StatVM GetStatVM(TankVM tank, StatInfoVM statInfo) { var tankStats = _statVms.GetOrCreate(statInfo, () => new Dictionary <TankVM, StatVM>()); return(tankStats.GetOrCreate(tank, () => new StatVM(statInfo, statInfo.Model, TankInstanceManager.GetInstance(tank.Repository, tank.Model)))); }
// returns actual insert index private int MoveTankItem(TankVM tank, int insertIndex) { var oldIndex = _owner.SelectedTanks.IndexOf(tank); insertIndex = insertIndex > oldIndex ? insertIndex - 1 : insertIndex; _owner.SelectedTanks.Move(oldIndex, insertIndex); return(insertIndex); }
internal TankVM GetTankVM(TankUnikey key) { TankVM tankVm; if (_tankVms.TryGetValue(key, out tankVm)) { return(tankVm); } IRepository repository; IXQueryable tank; if (key.TryGetTank(out tank, out repository)) { tankVm = new TankVM(repository, tank); _tankVms[key] = tankVm; return(tankVm); } return(null); }