예제 #1
0
 protected virtual void OnCurrencyChanged(StockInfoEventArgs e)
 {
     if (CurrencyChanged != null)
     {
         CurrencyChanged(this, e);
     }
 }
예제 #2
0
 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}");
 }
예제 #3
0
 protected virtual void OnCurrencyChange(object sender, StockInfoEventArgs args)
 {
     if (CurrencyChange != null)
     {
         CurrencyChange.Invoke(sender, args);
     }
 }
예제 #4
0
 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}");
 }
예제 #5
0
        public void Market()
        {
            Random             rnd          = new Random();
            StockInfoEventArgs newStockInfo = new StockInfoEventArgs(rnd.Next(30, 50), rnd.Next(20, 40));

            OnCurrencyChange(this, newStockInfo);
        }
예제 #6
0
 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}");
 }
예제 #7
0
        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);
        }
예제 #8
0
        public void Market()
        {
            Random             rnd        = new Random();
            StockInfoEventArgs stocksInfo = new StockInfoEventArgs {
                USD = rnd.Next(20, 40), Euro = rnd.Next(30, 50)
            };

            OnCurrencyChanged(stocksInfo);
        }
예제 #9
0
        protected virtual void OnCurrencyChanged(StockInfoEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            CurrencyChanged(this, e);
        }
예제 #10
0
        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}");
        }
예제 #11
0
        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}");
        }
예제 #12
0
 public abstract void Update(object sender, StockInfoEventArgs eventArgs);
예제 #13
0
 protected virtual void OnCurrencyChange(StockInfoEventArgs info) => CurrencyChange?.Invoke(this, info);
예제 #14
0
 public Stock()
 {
     stocksInfo = new StockInfoEventArgs();
 }