Beispiel #1
0
        public Page GetConfigPage(List <ElementConfigControl> configControlsList)
        {
            StackPanel dynamicPanel = new StackPanel {
                Orientation = Orientation.Horizontal
            };

            UserControlsLib.UCComboBox comboBox;
            Label elementLabel;
            Page  dynamicPage = new Page();

            foreach (ElementConfigControl element in configControlsList)
            {
                if (element.ControlType == eElementType.ComboBox)
                {
                    elementLabel = new Label()
                    {
                        Content             = element.Title,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        FontSize            = 14
                    };
                    comboBox = new UserControlsLib.UCComboBox()
                    {
                        Name   = element.Title,
                        Width  = 245,
                        Margin = new Thickness(99, 20, 20, 10)
                    };

                    comboBox.Init(mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true);
                    ((Ginger.UserControlsLib.UCComboBox)comboBox).ComboBox.ItemsSource = element.PossibleValues;

                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(comboBox);
                }
                else if (element.ControlType == eElementType.TextBox)
                {
                    elementLabel = new Label()
                    {
                        Content             = element.Title,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        FontSize            = 14
                    };
                    Ginger.Actions.UCValueExpression txtBox = new Ginger.Actions.UCValueExpression()
                    {
                        Name   = element.Title.ToString().Replace(" ", ""),
                        Width  = 245,
                        Margin = new Thickness(99, 20, 20, 10)
                    };

                    txtBox.Init(mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true);
                    ((Ginger.Actions.UCValueExpression)txtBox).ValueTextBox.Text = element.PossibleValues.ElementAt(0);
                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(txtBox);
                }
            }
            dynamicPage.Content = dynamicPanel;
            return(dynamicPage);
        }
Beispiel #2
0
        public Page GetConfigPage(List <ElementConfigControl> configControlsList)
        {
            StackPanel dynamicPanel = new StackPanel {
                Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
            };

            UserControlsLib.UCComboBox comboBox;
            Label elementLabel;
            Page  dynamicPage = new Page();

            foreach (ElementConfigControl element in configControlsList)
            {
                if (element.ControlType == eElementType.ComboBox)
                {
                    elementLabel = new Label()
                    {
                        Style               = this.FindResource("$LabelStyle") as Style,
                        Content             = element.Title + ":",
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment   = VerticalAlignment.Center,
                        FontSize            = 14
                    };
                    comboBox = new UserControlsLib.UCComboBox()
                    {
                        Name = element.Title,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Width  = 600,
                        Margin = new Thickness(10, 0, 0, 0)
                    };
                    comboBox.Init(mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true);
                    ((Ginger.UserControlsLib.UCComboBox)comboBox).ComboBox.ItemsSource = element.PossibleValues;
                    if (mAction.ElementLocateBy == eLocateBy.POMElement)
                    {
                        ((Ginger.UserControlsLib.UCComboBox)comboBox).ComboBox.SelectedValue = element.DefaultValue;
                        comboBox.ComboBoxObject.Style = this.FindResource("$FlatEditInputComboBoxStyle") as Style;
                    }
                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(comboBox);
                }
                else if (element.ControlType == eElementType.TextBox)
                {
                    elementLabel = new Label()
                    {
                        Style               = this.FindResource("$LabelStyle") as Style,
                        Content             = element.Title + ":",
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment   = VerticalAlignment.Center,
                        FontSize            = 14
                    };
                    Ginger.Actions.UCValueExpression txtBox = new Ginger.Actions.UCValueExpression()
                    {
                        Name = element.Title.ToString().Replace(" ", ""),
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Width  = 600,
                        Margin = new Thickness(10, 0, 0, 0)
                    };

                    txtBox.Init(mAction.GetOrCreateInputParam(element.BindedString), isVENeeded: true);
                    ((Ginger.Actions.UCValueExpression)txtBox).ValueTextBox.Text = element.PossibleValues.ElementAt(0);
                    dynamicPanel.Children.Add(elementLabel);
                    dynamicPanel.Children.Add(txtBox);
                }
            }
            dynamicPage.Content = dynamicPanel;
            return(dynamicPage);
        }