public static void Main_1(string[] args) { ///Bofre facade implementation //ScheduleServer scheduleServer = new ScheduleServer(); //scheduleServer.startBooting(); //scheduleServer.readSystemConfigFile(); //scheduleServer.init(); //scheduleServer.initializeContext(); //scheduleServer.initializeListeners(); //scheduleServer.createSystemObjects(); //Console.WriteLine("Start working......"); //Console.WriteLine("After work done........."); //////To stop the server, the client needs to call the following methods in the same sequence. //scheduleServer.releaseProcesses(); //scheduleServer.destory(); //scheduleServer.destroySystemObjects(); //scheduleServer.destoryListeners(); //scheduleServer.destoryContext(); //scheduleServer.shutdown(); ////After Facade Implementation ScheduleServer scheduleServer = new ScheduleServer(); ScheduleServerFacade facadeServer = new ScheduleServerFacade(scheduleServer); facadeServer.startServer(); Console.WriteLine("Start working......"); Console.WriteLine("After work done........."); facadeServer.stopServer(); /* * Please note that, although the facade class has provided a simple interface to the complex subsystem, it has not encapsulated * the subsystem. A client can still access the low-level interfaces of the subsystem. So, a facade provides an extra layer, a simple * interface to the complex subsystem, but it does not completely hide the direct accessibility to the low-level interfaces of the * complex subsystem. */ }
public ScheduleServerFacade(ScheduleServer scheduleServer) { this.scheduleServer = scheduleServer; }