Esempio n. 1
0
 protected virtual void OnCurrencyChanged(StockInfoEventArgs e)
 {
     if (CurrencyChanged != null)
     {
         CurrencyChanged(this, e);
     }
 }
Esempio n. 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}");
 }
Esempio n. 3
0
 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}");
 }
Esempio n. 5
0
        public void Market()
        {
            Random             rnd          = new Random();
            StockInfoEventArgs newStockInfo = new StockInfoEventArgs(rnd.Next(30, 50), rnd.Next(20, 40));

            OnCurrencyChange(this, newStockInfo);
        }
Esempio n. 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}");
 }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 9
0
        protected virtual void OnCurrencyChanged(StockInfoEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

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