private Control[] getControls(Form form1, Form form2) { List <Control> result = new List <Control>(); List <UserControl> userControls = new List <UserControl>(); userControls.AddRange(FooStack.GetControlsByType <Form, UserControl>(form1, typeof(UserControl1)).ToList()); userControls.AddRange(FooStack.GetControlsByType <Form, UserControl>(form2, typeof(UserControl1)).ToList()); userControls.ForEach(c => result.AddRange(c.Controls.Cast <Control>())); return(result.ToArray()); }
private void my_managerTrigger(object sender, myEventArgs e) { Control[] result = new Control[] { }; Form fired_form = (Form)sender; Form form = myForm_1 != fired_form ? myForm_1 : myForm_2; Control[] controls = getControls(fired_form, form); var typeControl = EnumHelper.controlType(fired_form.Text); var shape = EnumHelper.controlShape(FooStack.GetControlByName(fired_form, "Rectangle_Square_label").Text); var size = EnumHelper.controlSize(FooStack.GetControlByName(fired_form, "Min_Max_label").Text); var color = EnumHelper.controlColor(FooStack.GetCheckedControl(fired_form).Text); var resultArea1 = FooStack.GetControlByName(fired_form, "ButtonLabel_MinMax_RectangleSquare_control"); var resultArea2 = e.userControl; Process process = new Process(controls, typeControl, color, size, shape); setResult(process.getControls(), process.getControl(), resultArea1, resultArea2); }