public void ChangeRate() { Random rnd = new Random(); USD = rnd.Next(20, 40); Euro = rnd.Next(30, 50); RateChanged?.Invoke(this, EventArgs.Empty); }
public void PublishRate(Rate rate) { if (rate == null) { foreach (var observer in _observers) { observer.OnCompleted(); } rates.Clear(); return; } rates[rate.Ticker] = rate; RateChanged?.Invoke(this, new RateChangedArgs(rate)); foreach (var observer in _observers) { observer.OnNext(rate); } }
/// <summary> /// Raises the <see cref="E:ValueChanged" /> event. /// </summary> /// <param name="e">The <see cref="Events.RateChangedEventArgs"/> instance containing the event data.</param> protected virtual void OnRateChanged(Events.RateChangedEventArgs e) { RateChanged?.Invoke(this, e); }