public UserDataInterface getUserData(UIBuilderInterface uiBuilder) { Dictionary <string, string> stringValues = new Dictionary <string, string>(); Dictionary <string, List <string> > arrayValues = new Dictionary <string, List <string> >(); UIElement[] uiElements = uiBuilder.getUIElements(); int element_count = uiElements.Length; int current_param = 0; foreach (UIElement element in uiElements) { if (element.getType() == UIElement.TYPE_SINGLE) { stringValues[element.getKey()] = ""; } else { arrayValues[element.getKey()] = new List <string>(); } } while (current_param < element_count) { UIElement current_element = uiElements[current_param]; universelleseingabemodul uem = new universelleseingabemodul(); uem.buildUi(uiElements[current_param]); uem.ShowDialog(); if (current_element.getType() == UIElement.TYPE_SINGLE) { stringValues[current_element.getKey()] = uem.getData(); } else { arrayValues[current_element.getKey()].Add(uem.getData()); } if (uem.state == universelleseingabemodul.STATE_NEXT_PARAM) { current_param++; } else if (uem.state != universelleseingabemodul.STATE_NEXT_VALUE) { return(null); } } Dictionary <string, string[]> arrayDict = new Dictionary <string, string[]>(); foreach (string key in arrayValues.Keys) { arrayDict[key] = arrayValues[key].ToArray <string>(); } return(new UserData(stringValues, arrayDict)); }
private void ms_function_click(object sender, EventArgs e) { MyMenuItem item = sender as MyMenuItem; ModulInterface modul = this.modules[item.moduleId]; FunctionInterface function = modul.getFunctions()[item.functionId]; UIBuilderInterface builder = new UIBuilder(); function.buildUI(builder); var uem = new universelleseingabemodul(); uem.buildUi(builder); uem.ShowDialog(); try { lb_Ergebnis.Items.Add(function.calculate(uem.getData())); } catch (DatenNichtValideFehler) { } }