protected virtual void OnCurrencyChanged(StockInfoEventArgs e) { if (CurrencyChanged != null) { CurrencyChanged(this, e); } }
public override void Update(object sender, StockInfoEventArgs eventArgs) { Console.WriteLine( eventArgs.USD > 30 ? $"Broker {this.Name} sells dollars; Dollar rate: {eventArgs.USD}" : $"Broker {this.Name} buys dollars; Dollar rate: {eventArgs.USD}"); }
protected virtual void OnCurrencyChange(object sender, StockInfoEventArgs args) { if (CurrencyChange != null) { CurrencyChange.Invoke(sender, args); } }
public void Update(object sender, StockInfoEventArgs args) { Console.WriteLine( args.Euro > 40 ? $"Bank {this.Name} sells euros; Euro rate:{args.Euro}" : $"Bank {this.Name} is buying euros; Euro rate: {args.Euro}"); }
public void Market() { Random rnd = new Random(); StockInfoEventArgs newStockInfo = new StockInfoEventArgs(rnd.Next(30, 50), rnd.Next(20, 40)); OnCurrencyChange(this, newStockInfo); }
public void Update(object sender, StockInfoEventArgs info) { Console.WriteLine( info.USD > 30 ? $"Broker {this.Name} sells dollars; Dollar rate: {info.USD}" : $"Broker {this.Name} buys dollars; Dollar rate: {info.USD}"); }
public void Market() { StockInfoEventArgs stocksInfo = new StockInfoEventArgs(); Random rnd = new Random(); stocksInfo.USD = rnd.Next(20, 40); stocksInfo.Euro = rnd.Next(30, 50); this.OnCurrencyChanged(stocksInfo); }
public void Market() { Random rnd = new Random(); StockInfoEventArgs stocksInfo = new StockInfoEventArgs { USD = rnd.Next(20, 40), Euro = rnd.Next(30, 50) }; OnCurrencyChanged(stocksInfo); }
protected virtual void OnCurrencyChanged(StockInfoEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } CurrencyChanged(this, e); }
public void Update(object sender, StockInfoEventArgs info) { var stockInfo = (StockInfoEventArgs)info; Console.WriteLine( stockInfo.Euro > 40 ? $"Bank {this.Name} sells euros; Euro rate:{stockInfo.Euro}" : $"Bank {this.Name} is buying euros; Euro rate: {stockInfo.Euro}"); }
public void Update(object sender, StockInfoEventArgs args) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (args == null) { throw new ArgumentNullException(nameof(args)); } Stock = sender; Console.WriteLine( args.Euro > 40 ? $"Bank {this.Name} sells euros; Euro rate:{args.Euro}" : $"Bank {this.Name} is buying euros; Euro rate: {args.Euro}"); }
public abstract void Update(object sender, StockInfoEventArgs eventArgs);
protected virtual void OnCurrencyChange(StockInfoEventArgs info) => CurrencyChange?.Invoke(this, info);
public Stock() { stocksInfo = new StockInfoEventArgs(); }