Example #1
0
 /// <summary>
 /// The value changed, and the method implemented from interface, this takes a <see cref="Subject"/> Abstraction
 /// and prints the changed value. This method is crucial for the Observer pattern.
 /// </summary>
 /// <para>
 /// Implemented as using push methodology, but doesn't directly use the internal state and only using it retrieve a
 /// notification for a new update and passing itself to the output, therefore using the pull methodology instead.
 /// </para>
 /// <param name="value">This parameter is the internal state of the Subject received. This ensures that the Observer knows the state</param>
 public void ValueChanged(Subject value)
 {
     // Checks global variable if notifications are allowed.
     if (StockMarket.PortfolioNotifications)
     {
         PortfolioDisplay.PrintInformation(this);
     }
 }
Example #2
0
 public void ValueChanged(ISubject value)
 {
     PortfolioDisplay.PrintInformation(this);
 }