コード例 #1
0
        private void comboBoxMethodName_SelectedValueChanged(object sender, EventArgs e)
        {
            if (comboBoxMethodName.SelectedItem is FactoryMethodSelectionItem factoryMethod)
            {
                tableLayoutPanel1.Controls.Remove(argumentTable);
                argumentTable = new ArgumentTableControl(factoryMethod.FactoryMethod);

                tableLayoutPanel1.SetColumn(argumentTable, 1);
                tableLayoutPanel1.SetRowSpan(argumentTable, 2);

                tableLayoutPanel1.Controls.Add(argumentTable);
            }
        }
コード例 #2
0
        public FactoryForm()
        {
            InitializeComponent();

            Text = "FactoryForm";



            comboBoxClassName.Items.AddRange(Reflector.GetSubclasses <AbstractFactoryType>().Select(type => new FactoryClassSelectionItem(type)).ToArray());

            comboBoxMethodName.Items.AddRange(Reflector.GetMethodsWithAttribute <FactoryMethodAttribute>(typeof(AbstractFactoryType)).Select(method => new FactoryMethodSelectionItem(method)).ToArray());

            argumentTable = new ArgumentTableControl();

            tableLayoutPanel1.SetColumn(argumentTable, 1);
            tableLayoutPanel1.SetRowSpan(argumentTable, 2);

            tableLayoutPanel1.Controls.Add(argumentTable);
        }