Ejemplo n.º 1
0
        private void ValueHasChanged(object sender, EventArgs e)
        {
            PriceWatch myPrice = (PriceWatch)sender;

            if (myPrice.CurrentPrice > myPrice.CurrentBudget)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine();
                Console.WriteLine("You are over your budget! \a ( $" + myPrice.CurrentPrice + " )");
                Console.WriteLine("That is $" + (myPrice.CurrentPrice - myPrice.CurrentBudget) + " too much!");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine("You are on budget. " + "$" + myPrice.CurrentPrice + " spent so far.");
                Console.WriteLine();
            }
        }
 private void ValueHasChanged(object sender, EventArgs e)
 {
     PriceWatch myPrice = (PriceWatch)sender;
 }
Ejemplo n.º 3
0
 public PriceMonitor(PriceWatch price)
 {
     price.ValueChanged += ValueHasChanged;
     PriceAlert          = price.CurrentPrice;
 }
 public PriceChangeNotifier(PriceWatch price)
 {
     price.ValueChanged += ValueHasChanged;
 }