Hachiko: A Dog’s Story

public class Hachiko : Dog
{
    private Human boss;
    public Human Boss
    {
        get { return boss; }
        set
        {
            if (boss == null)
            {
                boss == value;
                boss.OnBossReturnFromWork += new EventHandler(OnBossReturnFromWork);
            }
        }
    }

    private Ball Fetch(Ball ball)
    {
        if (DateTime.Today == boss.DeathDate)
            return ball;
        return null;
    }

    private Timer timer;
    private void OnBossReturnFromWork(object sender, EventArgs e)
    {
        boss.OnBossReturnFromWork -= OnBossReturnFromWork;
        timer = new Timer();
        timer.Interval = 24*60*60*1000;
        timer.Tick += new EventHandler(timer_Tick);
        timer.Start();
    }

    void timer_Tick(object sender, EventArgs e)
    {
        GoToTheTrainStation();
        while (human.Location.Distance(this).TotalMeters <= 10)
            Thread.Sleep(1000);
    }
}
Vote up this code4