예제 #1
0
        static void Main(string[] args)
        {
            Invoker invoker = new Invoker();

            FilterParameters    filterParameters     = new FilterParameters();
            GetFilterParameters getFilterParameteres = new GetFilterParameters(filterParameters);

            invoker.SetCommand(getFilterParameteres);
            invoker.Run();

            CarsCatalog       carsCatalog       = new CarsCatalog();
            CreateCarsCatalog createCarsCatalog = new CreateCarsCatalog(carsCatalog);

            invoker.SetCommand(createCarsCatalog);
            invoker.Run();

            JavaScriptSerializer ser = new JavaScriptSerializer();
            string catalog           = ser.Serialize(carsCatalog.Catalog());

            File.WriteAllText("Cars catalog.json", catalog);
        }
예제 #2
0
 public CreateCarsCatalog(CarsCatalog cat)
 {
     carsCatalog = cat;
 }