예제 #1
0
 /// <summary>
 /// Gets/sets a config by address.
 /// Returns null if not found.
 /// </summary>
 public LocoIOConfig this[LocoNetAddress index]
 {
     get
     {
         LocoIOConfig result;
         if (locoIOs.TryGetValue(index, out result))
         {
             return(result);
         }
         return(null);
     }
     set
     {
         if (value == null)
         {
             Remove(index);
         }
         else
         {
             if (this[index] != value)
             {
                 locoIOs[index] = value;
                 Modified.Fire(this);
             }
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Remove a configuration by it's address.
 /// </summary>
 public bool Remove(LocoNetAddress index)
 {
     if (!locoIOs.Remove(index))
     {
         return(false);
     }
     Modified.Fire(this);
     return(true);
 }