⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 facadestructural.cs

📁 使用C#程序将23个常用设计模式进行列表显示
💻 CS
字号:
using System;
using System.Windows.Forms;
using System.Text;

namespace DesignPattern.FacadeStructural
{
    class FacadeStructural : AbstractPattern
    {
        public static void Run(TextBox tbInfo)
        {
            s_tbInfo = tbInfo;
            s_tbInfo.Text = "";

            Facade facade = new Facade(); 
            facade.MethodA(); 
            facade.MethodB();
            
            // Wait for user 
            //Console.Read();
        }
    }
    
    // "Subsystem ClassA" 
    class SubSystemOne 
    {
        public void MethodOne() 
        {
            DesignPattern.FormMain.OutputInfo(" SubSystemOne Method"); 
        }
    }
    
    // Subsystem ClassB" 
    class SubSystemTwo 
    {
        public void MethodTwo()
        { 
            DesignPattern.FormMain.OutputInfo(" SubSystemTwo Method"); 
        }
    } 
    
    // Subsystem ClassC" 
    class SubSystemThree 
    {
        public void MethodThree() 
        {
            DesignPattern.FormMain.OutputInfo(" SubSystemThree Method"); 
        }
    }
    
    // Subsystem ClassD" 
    class SubSystemFour 
    {
        public void MethodFour() 
        {
            DesignPattern.FormMain.OutputInfo(" SubSystemFour Method"); 
        }
    }
    
    // "Facade" 
    class Facade 
    {
        SubSystemOne one; 
        SubSystemTwo two;
        SubSystemThree three; 
        SubSystemFour four; 
        
        public Facade() 
        {
            one = new SubSystemOne(); 
            two = new SubSystemTwo(); 
            three = new SubSystemThree(); 
            four = new SubSystemFour(); 
        }
        
        public void MethodA() 
        {
            DesignPattern.FormMain.OutputInfo("\nMethodA() ---- ");
            one.MethodOne(); 
            two.MethodTwo(); 
            four.MethodFour();
        } 
        
        public void MethodB() 
        {
            DesignPattern.FormMain.OutputInfo("\nMethodB() ---- "); 
            two.MethodTwo();
            three.MethodThree(); 
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -