コード例 #1
0
        public DecoratorForm(IWattCalculator d)
        {
            InitializeComponent();
            decorator = d;

            switcher = 0;
            FillForm();
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (switcher)
            {
            case 0:
                decorator = new Buzzer(decorator);
                break;

            case 1:
                decorator = new LED(decorator);
                break;

            case 2:
                decorator = new Resistor(decorator);
                break;

            case 3:
                decorator = new RGBLED(decorator);
                break;
            }
            lbItems.Items.Add(lbOptions.SelectedItem);
        }
コード例 #3
0
 public Resistor(IWattCalculator m)
 {
     decoratedMeasurer = m;
 }
コード例 #4
0
 public RGBLED(IWattCalculator m)
 {
     decoratedMeasurer = m;
 }
コード例 #5
0
 public Buzzer(IWattCalculator m)
 {
     decoratedMeasurer = m;
 }