示例#1
0
        public ucComboBox(clsComboBox ccb)
        {
            InitializeComponent();
            this.ccb = ccb;
            updateTb();

            DataContext = this;
        }
示例#2
0
        public object createCompleteComboboxWithClass(List <string> comboboxItem, clsComboBox clsCb)
        {
            Grid comboboxGrid = (Grid)createGrid();

            comboboxGrid.Name        = "ComboBox";
            comboboxClass            = clsCb;
            comboboxGrid.DataContext = comboboxClass;
            comboboxGrid.Children.Add((ComboBox)createCombobox(comboboxItem));
            comboboxClass["propComboboxItem"] = comboboxItem;

            object sendcomboboxGridAsObject = (object)comboboxGrid;

            return(sendcomboboxGridAsObject);
        }
示例#3
0
        private void ListViewDesignedItem_Click(object sender, EventArgs e)
        {
            object gridChildren = (object)((Grid)((ListViewItem)sender).Content).Children[0];

            if (gridChildren.ToString().Contains("TextBlock"))
            {
                textBlockClass = new clsTextblock();
                textBlockClass = (clsTextblock)((Grid)((ListViewItem)sender).Content).DataContext;
                ((Grid)((ListViewItem)sender).Content).DataContext = textBlockClass;
                customWindowForControlProperties.Visibility        = Visibility.Visible;
                Switcher.Switch(new ucTextBlock(textBlockClass));
            }
            if (gridChildren.ToString().Contains("Image"))
            {
                imageClass = new clsImage();
                imageClass = (clsImage)((Grid)((ListViewItem)sender).Content).DataContext;
                ((Grid)((ListViewItem)sender).Content).DataContext = imageClass;
                customWindowForControlProperties.Visibility        = Visibility.Visible;
                Switcher.Switch(new ucImage(imageClass));
            }
            if (gridChildren.ToString().Contains("Button"))
            {
                buttonClass = new clsButton();
                buttonClass["propButtonAction"] = buttonActionClass;
                buttonClass = (clsButton)((Grid)((ListViewItem)sender).Content).DataContext;
                ((Grid)((ListViewItem)sender).Content).DataContext = buttonClass;
                customWindowForControlProperties.Visibility        = Visibility.Visible;
                Switcher.Switch(new ucButton(buttonClass));
            }
            if (gridChildren.ToString().Contains("TextBox"))
            {
                textBoxClass = new clsTextBox();
                textBoxClass = (clsTextBox)((Grid)((ListViewItem)sender).Content).DataContext;
                ((Grid)((ListViewItem)sender).Content).DataContext = textBoxClass;
                customWindowForControlProperties.Visibility        = Visibility.Visible;
                Switcher.Switch(new ucTextBox(textBoxClass));
            }
            if (gridChildren.ToString().Contains("ComboBox"))
            {
                listViewDesign.SelectedIndex = ((ListView)((Grid)((ListViewItem)sender).Content).Parent).Items.IndexOf(((Grid)((ListViewItem)sender).Content));
                comboboxClass = new clsComboBox();
                comboboxClass = (clsComboBox)((Grid)((ListViewItem)sender).Content).DataContext;
                ((Grid)((ListViewItem)sender).Content).DataContext = comboboxClass;
                customWindowForControlProperties.Visibility        = Visibility.Visible;
                Switcher.Switch(new ucComboBox(comboboxClass));
            }
        }
示例#4
0
        public object createCompleteCombobox(string dicEntryKey, string inputDataType, List <string> comboboxItem, int inputId)
        {
            Grid comboboxGrid = (Grid)createGrid();

            comboboxGrid.Name         = "ComboBox";
            comboboxClass             = new clsComboBox();
            comboboxClass["propId"]   = Guid.NewGuid();
            comboboxClass["propName"] = inputId.ToString();
            //textBoxClass["propName"] = dicEntryKey;
            comboboxClass["propInputType"] = inputDataType;
            comboboxGrid.DataContext       = comboboxClass;
            comboboxGrid.Children.Add((ComboBox)createCombobox(comboboxItem));
            comboboxClass["propComboboxItem"] = comboboxItem;

            object sendcomboboxGridAsObject = (object)comboboxGrid;

            return(sendcomboboxGridAsObject);
        }
示例#5
0
        public void loadDesignedTemplate(clsListViewDesignBackground lv)
        {
            XDocument xmlDocument             = XDocument.Load(designXmlFilePath);
            IEnumerable <XElement> designRoot = xmlDocument.Descendants("Design")
                                                .Where(mi => mi.Attribute("id").Value == templateId)
                                                .Elements();

            foreach (XElement control in designRoot)
            {
                if (control.Name == "Background")
                {
                    lv["propBackground"] = (SolidColorBrush)(new BrushConverter().ConvertFrom(control.Value));
                }
                else
                {
                    string id   = control.Attribute("id").Value;
                    string type = control.Attribute("type").Value;

                    switch (type)
                    {
                    case "ComboBox":
                        XElement cboxRoot    = xmlDocument.Descendants(type + "es").FirstOrDefault();
                        XElement cboxDetails = cboxRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        comboboxClass                  = new clsComboBox();
                        comboboxClass["propId"]        = new Guid(id);
                        comboboxClass["propName"]      = cboxDetails.Element("Name").Value;
                        comboboxClass["propInputType"] = cboxDetails.Element("DataType").Value;
                        comboboxClass["propMargin"]    = cboxDetails.Element("Margin").Value == "NaN" ? convertToDoubleFromNaN(cboxDetails.Element("Margin").Value) : convertToDouble(cboxDetails.Element("Margin").Value);
                        comboboxClass["propHeight"]    = cboxDetails.Element("Height").Value == "NaN" ? convertToDoubleFromNaN(cboxDetails.Element("Height").Value) : convertToDouble(cboxDetails.Element("Height").Value);
                        Grid comboboxGrid = (Grid)controlCreator.createCompleteComboboxWithClass(cboxDetails.Element("ComboboxItem").Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(), comboboxClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = comboboxGrid;
                        objectCollection.addObject(objectClass);
                        break;

                    case "TextBox":
                        XElement tboxRoot    = xmlDocument.Descendants(type + "es").FirstOrDefault();
                        XElement tboxDetails = tboxRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        textBoxClass                      = new clsTextBox();
                        textBoxClass["propId"]            = new Guid(id);
                        textBoxClass["propName"]          = tboxDetails.Element("Name").Value;
                        textBoxClass["propContent"]       = tboxDetails.Element("Content").Value;
                        textBoxClass["propHeight"]        = tboxDetails.Element("Height").Value == "NaN" ? convertToDoubleFromNaN(tboxDetails.Element("Height").Value) : convertToDouble(tboxDetails.Element("Height").Value);
                        textBoxClass["propMargin"]        = tboxDetails.Element("Margin").Value == "NaN" ? convertToDoubleFromNaN(tboxDetails.Element("Margin").Value) : convertToDouble(tboxDetails.Element("Margin").Value);
                        textBoxClass["propWidth"]         = tboxDetails.Element("Width").Value == "NaN" ? convertToDoubleFromNaN(tboxDetails.Element("Width").Value) : convertToDouble(tboxDetails.Element("Width").Value);
                        textBoxClass["propAlignment"]     = tboxDetails.Element("HorizontalAlignment").Value;
                        textBoxClass["propInputDataType"] = tboxDetails.Element("DataType").Value;
                        Grid textBoxGrid = (Grid)controlCreator.createCompleteTextBoxWithClass(textBoxClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = textBoxGrid;
                        objectCollection.addObject(objectClass);
                        break;

                    case "TextBlock":
                        XElement tblockRoot    = xmlDocument.Descendants(type + "s").FirstOrDefault();
                        XElement tblockDetails = tblockRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        textBlockClass                   = new clsTextblock();
                        textBlockClass["propId"]         = new Guid(id);
                        textBlockClass["propContent"]    = tblockDetails.Element("Text").Value;
                        textBlockClass["propAlignment"]  = tblockDetails.Element("HorizontalAlignment").Value;
                        textBlockClass["propFontFamily"] = tblockDetails.Element("FontFamily").Value;
                        textBlockClass["propFontSize"]   = double.Parse(tblockDetails.Element("FontSize").Value);
                        textBlockClass["propForeground"] = (SolidColorBrush)(new BrushConverter().ConvertFrom(tblockDetails.Element("Foreground").Value));
                        textBlockClass["propMargin"]     = tblockDetails.Element("Margin").Value == "NaN" ? convertToDoubleFromNaN(tblockDetails.Element("Margin").Value) : convertToDouble(tblockDetails.Element("Margin").Value);;
                        Grid textBlockGrid = (Grid)controlCreator.createCompleteTextblockWithClass(textBlockClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = textBlockGrid;
                        objectCollection.addObject(objectClass);
                        break;

                    case "Button":
                        XElement buttonRoot    = xmlDocument.Descendants(type + "s").FirstOrDefault();
                        XElement buttonDetails = buttonRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        buttonClass                      = new clsButton();
                        buttonActionClass                = new clsButtonAction();
                        buttonClass["propId"]            = new Guid(id);
                        buttonClass["propContent"]       = buttonDetails.Element("Content").Value;
                        buttonClass["propBtnBackground"] = (SolidColorBrush)(new BrushConverter().ConvertFrom(buttonDetails.Element("Background").Value));
                        buttonClass["propForeground"]    = (SolidColorBrush)(new BrushConverter().ConvertFrom(buttonDetails.Element("Foreground").Value));
                        buttonClass["propAlignment"]     = buttonDetails.Element("HorizontalAlignment").Value;
                        buttonClass["propFontFamily"]    = buttonDetails.Element("FontFamily").Value;

                        buttonClass["propHeight"]   = buttonDetails.Element("Height").Value == "NaN" ? convertToDoubleFromNaN(buttonDetails.Element("Height").Value) : convertToDouble(buttonDetails.Element("Height").Value);
                        buttonClass["propMargin"]   = buttonDetails.Element("Margin").Value == "NaN" ? convertToDoubleFromNaN(buttonDetails.Element("Margin").Value) : convertToDouble(buttonDetails.Element("Margin").Value);
                        buttonClass["propWidth"]    = buttonDetails.Element("Width").Value == "NaN" ? convertToDoubleFromNaN(buttonDetails.Element("Width").Value) : convertToDouble(buttonDetails.Element("Width").Value);;
                        buttonClass["propFontSize"] = double.Parse(buttonDetails.Element("FontSize").Value);
                        //To do - open action class - assign the value
                        Grid buttonGrid = (Grid)controlCreator.createCompleteButtonWithClass(buttonClass, buttonActionClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = buttonGrid;
                        objectCollection.addObject(objectClass);
                        break;

                    case "DatePicker":
                        XElement datePickerRoot    = xmlDocument.Descendants(type + "s").FirstOrDefault();
                        XElement datePickerDetails = datePickerRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        datePickerClass                  = new clsDatePicker();
                        datePickerClass["propId"]        = new Guid(id);
                        datePickerClass["propName"]      = datePickerDetails.Element("Name").Value;
                        datePickerClass["propInputType"] = datePickerDetails.Element("DataType").Value;
                        datePickerClass["propHeight"]    = datePickerDetails.Element("Height").Value == "NaN" ? convertToDoubleFromNaN(datePickerDetails.Element("Height").Value) : convertToDouble(datePickerDetails.Element("Height").Value);
                        datePickerClass["propWidth"]     = datePickerDetails.Element("Width").Value == "NaN" ? convertToDoubleFromNaN(datePickerDetails.Element("Width").Value) : convertToDouble(datePickerDetails.Element("Width").Value);
                        Grid datePickerGrid = (Grid)controlCreator.createCompleteDatePickerWithClass(datePickerClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = datePickerGrid;
                        objectCollection.addObject(objectClass);
                        break;

                    case "Image":
                        XElement imageRoot    = xmlDocument.Descendants(type + "s").FirstOrDefault();
                        XElement imageDetails = imageRoot.Descendants(type).Where(mi => mi.Attribute("id").Value == id).FirstOrDefault();
                        imageClass                      = new clsImage();
                        imageClass["propId"]            = new Guid(id);
                        imageClass["propMargin"]        = imageDetails.Element("Margin").Value == "NaN" ? convertToDoubleFromNaN(imageDetails.Element("Margin").Value) : convertToDouble(imageDetails.Element("Margin").Value);
                        imageClass["propImageHeight"]   = imageDetails.Element("Height").Value == "NaN" ? convertToDoubleFromNaN(imageDetails.Element("Height").Value) : convertToDouble(imageDetails.Element("Height").Value);
                        imageClass["propImageWidth"]    = imageDetails.Element("Width").Value == "NaN" ? convertToDoubleFromNaN(imageDetails.Element("Width").Value) : convertToDouble(imageDetails.Element("Width").Value);
                        imageClass["propAlignment"]     = imageDetails.Element("HorizontalAlignment").Value;
                        imageClass["propImageData"]     = imageDetails.Element("ImageData").Value;
                        imageClass["propImageLocation"] = imageDetails.Element("ImageLocation").Value;
                        Grid imageGrid = (Grid)controlCreator.createCompleteImageWithClass(imageClass);
                        objectClass = new clsObject();
                        objectClass["controlObject"] = imageGrid;
                        objectCollection.addObject(objectClass);
                        break;
                    }
                }
            }
        }