Exemplo n.º 1
0
        public static IGuiOption CreateGuiOption(XElement OptionXml, TsColumn Parent)
        {
            XElement prebuiltx = PrebuiltFactory.GetPrebuiltXElement(OptionXml);

            if (prebuiltx == null)
            {
                return(GetGuiOption(OptionXml, Parent));
            }
            else
            {
                XAttribute xtype = OptionXml.Attribute("Type");
                prebuiltx.Add(xtype);
                IGuiOption g = GetGuiOption(prebuiltx, Parent);
                g.LoadXml(OptionXml);
                return(g);
            }
        }
Exemplo n.º 2
0
        private static IGuiOption GetGuiOption(XElement OptionXml, TsColumn Parent)
        {
            XAttribute xtype = OptionXml.Attribute("Type");

            if (xtype == null)
            {
                throw new ArgumentException("Missing Type attribute on GuiOption" + Environment.NewLine);
            }

            LoggerFacade.Info("Creating GuiOption, type: " + xtype.Value);

            IGuiOption newoption = null;

            #region
            if (xtype.Value == "DropDownList")
            {
                newoption = new TsDropDownList(OptionXml, Parent);
            }

            else if (xtype.Value == "CheckBox")
            {
                newoption = new TsCheckBox(OptionXml, Parent);
            }
            else if (xtype.Value == "FreeText")
            {
                newoption = new TsFreeText(OptionXml, Parent);
            }

            else if (xtype.Value == "ComputerName")
            {
                newoption = new TsComputerName(OptionXml, Parent);
            }
            else if (xtype.Value == "Heading")
            {
                newoption = new TsHeading(OptionXml, Parent);
                return(newoption);
            }
            else if (xtype.Value == "InfoBox")
            {
                newoption = new TsInfoBox(OptionXml, Parent);
            }
            else if (xtype.Value == "TrafficLight")
            {
                newoption = new TsTrafficLight(OptionXml, Parent);
            }
            else if (xtype.Value == "TickCross")
            {
                newoption = new TsTickCross(OptionXml, Parent);
            }
            else if (xtype.Value == "Image")
            {
                newoption = new TsImage(OptionXml, Parent);
                return(newoption);
            }
            else if (xtype.Value == "ComplianceRefreshButton")
            {
                newoption = new TsComplianceRefreshButton(OptionXml, Parent);
                return(newoption);
            }
            else if (xtype.Value == "PasswordBox")
            {
                newoption = new TsPasswordBox(OptionXml, Parent);
            }
            else if (xtype.Value == "UsernameBox")
            {
                newoption = new TsUsernameBox(OptionXml, Parent);
            }
            else if (xtype.Value == "ActionButton")
            {
                newoption = new TsActionButton(OptionXml, Parent);
            }
            else if (xtype.Value == "TreeView")
            {
                newoption = new TsTreeView(OptionXml, Parent);
            }
            else if (xtype.Value == "Timeout")
            {
                if (GuiTimeout.Instance == null)
                {
                    throw new TsGuiKnownException("No Timeout section defined in config. Timeout GuiOption type not available", string.Empty);
                }
                newoption = new TsTimeout(OptionXml, Parent);
            }
            else
            {
                return(null);
            }
            #endregion

            Director.Instance.AddOptionToLibary(newoption);
            return(newoption);
        }