예제 #1
0
        public Manager()
        {
            Current = new House();
            Current.Name = "default";
            houses.Add("default", Current);

            ComponentsFactory = new LogicComponentsFactory();
        }
예제 #2
0
 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;
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
 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;
     }
 }
예제 #5
0
 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;
     }
 }