Add mediator examples

This commit is contained in:
Petrutiu Mihai
2016-06-23 17:04:16 +03:00
parent 68f0822bfe
commit a632b5a6d9
21 changed files with 557 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using System;
namespace MediatorPattern.AirTrafficControl
{
public class Plane
{
public string ID { get; private set; }
IAirTrafficControlTower controlTower;
public Plane(string id, IAirTrafficControlTower controlTower)
{
this.controlTower = controlTower;
ID = id;
}
public void RequestPermissionToLand()
{
var lane = controlTower.RequestPermissionToLand(this);
if (lane.IsPresent)
Console.WriteLine("Landing");
else
Console.WriteLine("I will ask again in 5 minutes");
}
}
}