Exemplo n.º 1
0
		public void Move()
		{
			while(tank.Fuel > 5) {
				tank.Fuel -= 2;
				if (tank.Fuel < 5) {
					TankEmptyEventArgs e = new TankEmptyEventArgs (tank.Fuel);
					tank.OnTankEmpty (e);
				} else
					Console.WriteLine ("Moving... Tank balance is {0}", tank.Fuel);	
			}
		}
Exemplo n.º 2
0
		// actually the subscriber
		public void Stop(object sender, TankEmptyEventArgs e)
		{
			Console.WriteLine("Engine has stoppeed. Fuel balance: {0}", e.FuelBalance);
		}
Exemplo n.º 3
0
		// method that raise event
		public void OnTankEmpty(TankEmptyEventArgs e)
		{
			if (tankEmpty != null)
				tankEmpty (this, e);
		}