Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("please input selection for char or string");
            string inputString = Console.ReadLine();

            Console.WriteLine("please input {0}", inputString);

            UserInputMonitor    monitor_char   = new UserInputMonitor();
            UserStrInputMonitor monitor_string = new UserStrInputMonitor();
            Client client_char   = new Client(monitor_char);
            Client client_string = new Client(monitor_string);

            if (inputString == "char")
            {
                monitor_char.Run();
            }
            else if (inputString == "string")
            {
                monitor_string.Run();
            }
        }
Exemple #2
0
 public Client(UserInputMonitor m)
 {
     m.OnUserRequest += new UserInputMonitor.UserRequest(this.ShowMessage);
     //m.OnUserRequest+=new m.UserRequest(this.ShowMessage);
     //注意这种写法是错误的,因为委托是静态的
 }