Beispiel #1
0
 public RobotRemote switchRemote(RobotRemote remote)
 {
     if (remote.GetType() == typeof(RightRemote))
     {
         return(remote = new LeftRemote(remote.getRobot()));
     }
     else
     {
         return(remote = new RightRemote(remote.getRobot()));
     }
 }
Beispiel #2
0
        protected static void Main(string[] args)
        {
            RobotRemote remote = new RightRemote(new Robot());

            Console.WriteLine("Booting...!");
            remote.getRobot().OnOff(true);
            remote.ButtonA_Click();
            Console.WriteLine("---SWITCHING----");
            remote = remote.switchRemote(remote);
            remote.ButtonA_Click();
            Console.WriteLine("---SWITCHING----");
            remote = remote.switchRemote(remote);
            remote.ButtonA_Click();
        }