Пример #1
0
        /// <summary>
        /// 股民炒股
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Stock1 gu1 = new Stock1();
            Stock2 gu2 = new Stock2();
            Stock3 gu3 = new Stock3();

            gu1.Sell();
            gu2.Sell();
            gu3.Sell();

            gu1.Buy();
            gu2.Buy();
            gu3.Buy();

            Fund jijin = new Fund();

            //基金购买
            jijin.BuyFund();
            //基金赎回
            jijin.SellFund();

            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();
            Console.Read();
        }
Пример #2
0
        public void Run()
        {
            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();
        }
Пример #3
0
        /// <summary>
        /// Facade pattern bir sürü subsystemin kodlarıyla structure ile yada nasıl instance yaratıldığıyla
        /// değil
        /// Subsystemlerin birbiri ardına yapılan işlemin ayrı bir katmanda olduğu
        /// bu katmanın clientlar tarafından kullanıldığı bir patterndir
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();
        }
Пример #4
0
        private static void Main(string[] args)
        {
            var facade = new Facade();
            facade.MethodA();
            facade.MethodB();

            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();
            Console.ReadLine();
        }
Пример #6
0
        static void Main(string[] args)
        {
            Facade f = new Facade();

            f.MethodA();
            f.MethodB();
            Console.ReadKey();
        }
Пример #7
0
        private static void Main(string[] args)
        {
            var facade = new Facade();

            facade.MethodA();
            facade.MethodB();

            Console.ReadKey();
        }
        /// <summary>
        /// The Facade pattern is for when we need to present a unified front, combining calls to x sub-systems into a common front.
        /// </summary>
        /// <example>
        /// Real-life use includes...
        ///  - whenever we use API's we tend to call their individual methods, instead of facading away a specific need -
        ///  - fx.a security API that authenticates, authorizes, sets a timer for allowed access, so on and so forth.
        ///
        ///  - remember the facade pattern is about reducing complexity. For example:
        ///
        ///  * for a role-playing game, we can use the facade pattern to reduce a multitude of calculations that take place when
        ///  summing up a player's experience points based on X number of diverse criteria.
        ///
        ///  * We can also use the facade pattern to present a simplified, 'most-often-used' scenario front of a highly complex API.
        ///  Fx. an image-processing API, which has 2-3 facades for dealing with different scenarios.
        ///
        ///  * When you design and build large or complex microservice-based applications with multiple client apps,
        ///  a good approach to consider can be an API Gateway. This could also be considered an example of the facade pattern.
        /// </example>
        public static void Main()
        {
            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();

            Console.ReadKey();
        }
Пример #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Facade facade = new Facade();

            facade.MethodA();
            facade.MethodB();
            Console.ReadKey();
        }
Пример #10
0
        public static void Main(string[] args)
        {
            // initialise the facade
            var facade = new Facade();

            // call facade method A
            Console.WriteLine("Calling Facade.MethodA...");
            facade.MethodA();
            Console.WriteLine();

            // call facade method B
            Console.WriteLine("Calling Facade.MethodB...");
            facade.MethodB();
        }
Пример #11
0
 static void Main(string[] args)
 {
     try
     {
         {//BasicStructure
          //由于Facade的作用,客户端根本不知道子4个子系统的存在
             Facade facade = new Facade();
             facade.MethodA();
             facade.MethodB();
         }
         {//SituationSimulation
             NotebookPowerSupply notebookPowerSupply = new NotebookPowerSupply();
             notebookPowerSupply.Open();
             notebookPowerSupply.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Console.ReadKey();
 }