Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ConnectionWrapper wrapper = new ConnectionWrapper();

            IStateConnection openState = new Open();

            openState.Connection(wrapper);
            wrapper.GetState();

            IStateConnection closeState = new Close();

            closeState.Connection(wrapper);
            wrapper.GetState();

            Console.ReadKey();
        }
Exemplo n.º 2
0
 public void Connection(ConnectionWrapper wrapper)
 {
     wrapper.SetState(this);
     Console.WriteLine("Closing connection");
 }