public Manager() { Current = new House(); Current.Name = "default"; houses.Add("default", Current); ComponentsFactory = new LogicComponentsFactory(); }
public House Clone(House house, string cloneName) { if (house == null) throw new ArgumentNullException("house"); if (String.IsNullOrWhiteSpace(cloneName)) throw new ArgumentNullException("cloneName"); if (houses.ContainsKey(cloneName)) throw new ArgumentException("house with new name already exists"); house = (House)house.Clone(); house.Name = cloneName; lock (houses) { if (houses.ContainsKey(cloneName)) throw new ArgumentException("house with new name already exists"); houses.Add(cloneName, house); } return house; }
public bool RemoveHouse(House house) { if (house == null) throw new ArgumentNullException("house"); if (String.IsNullOrWhiteSpace(house.Name)) throw new ArgumentNullException("house.Name"); lock (houses) { return houses.Remove(house.Name); } }
public void SetCurrentHouse(House newCurrent) { if (newCurrent == null) throw new ArgumentNullException("newCurrent"); lock (houses) { if (houses.ContainsValue(newCurrent)) throw new ArgumentException("newCurrent is not known"); Current = newCurrent; } }
public House NewHouse(string name) { if (String.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("name"); lock (houses) { if (houses.ContainsKey(name)) throw new ArgumentException("House already exists", "name"); House house = new House(); house.Name = name; houses.Add(name, house); return house; } }