Exemplo n.º 1
0
 public static void UnSubscribe(IOperationObserver observer, BaseOperation operation)
 {
     if (AllObservers.Keys.Contains(operation.Name))
     {
         AllObservers[operation.Name].Remove(observer);
     }
 }
Exemplo n.º 2
0
        // implementing subject interface
        public static void Subscribe(IOperationObserver observer, BaseOperation operation)
        {
            if (!AllObservers.Keys.Contains(operation.Name))
            {
                AllObservers.Add(operation.Name, new List <IOperationObserver>());
            }

            if (!AllObservers[operation.Name].Contains(observer))
            {
                AllObservers[operation.Name].Add(observer);
            }
        }