Esempio n. 1
0
        static void Main(string[] args)
        {
            FunctionButton fb = new FunctionButton();//1、创建命令执行者

            Command command;
            //2、创建命令
            //读取配置文件
            string commandStr = ConfigurationManager.AppSettings["command"];

            //反射生成对象
            command = (Command)Assembly.Load("CommandSample").CreateInstance(commandStr);

            //3、下发命令给执行者
            //设置命令对象
            fb.Command = command;

            //4、执行命令
            fb.Click();
            CommandQueue queue = new CommandQueue();

            queue.AddCommand(command);
            Invoker leader = new Invoker(queue);

            leader.Call();


            Console.Read();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            FunctionButton fb = new FunctionButton();

            Command command;
            //读取配置文件
            string commandStr = ConfigurationManager.AppSettings["command"];

            //反射生成对象
            command = (Command)Assembly.Load("CommandSample").CreateInstance(commandStr);

            //设置命令对象
            fb.Command = command;
            fb.Click();

            Console.Read();
        }