IUIWidget IUIWidget.Clone()
        {
            var clone = new UiWidgetType()
            {
                Disabled   = this.Disabled,
                ImageClass = this.ImageClass,
                ImageUrl   = this.ImageUrl,
                Label      = this.Label,
                Location   = this.Location,
                Name       = this.Name,
                StatusText = this.StatusText,
                Tooltip    = this.Tooltip,
                Type       = this.Type,
                Extension  = new CustomContentType()
                {
                    Any = new XmlElement[0]
                }
            };

            var ext = this.GetAllValues();

            if (ext.Count > 0)
            {
                clone.SetAllValues(ext);
            }

            return(clone);
        }
        IWidget IApplicationDefinition.CreateWidget(string name, IWidgetInfo widgetInfo)
        {
            var wparams = widgetInfo.Parameters;

            IWidget widget = null;

            if (widgetInfo.StandardUi)
            {
                widget = new UiWidgetType()
                {
                    Disabled  = "false", //NOXLATE
                    Extension = new CustomContentType()
                    {
                        Any = new XmlElement[0]
                    },
                    ImageClass = widgetInfo.ImageClass ?? string.Empty, //Required to satisfy content model
                    ImageUrl   = widgetInfo.ImageUrl ?? string.Empty,   //Required to satisfy content model
                    Label      = widgetInfo.Label ?? string.Empty,      //Required to satisfy content model
                    Location   = widgetInfo.Location ?? string.Empty,   //Required to satisfy content model
                    Name       = name,
                    StatusText = widgetInfo.StatusText ?? string.Empty, //Required to satisfy content model
                    Tooltip    = widgetInfo.Tooltip ?? string.Empty,    //Required to satisfy content model
                    Type       = widgetInfo.Type
                };
            }
            else
            {
                widget = new WidgetType()
                {
                    Extension = new CustomContentType()
                    {
                        Any = new XmlElement[0]
                    },
                    Location = widgetInfo.Location ?? string.Empty, //Required to satisfy content model
                    Name     = name,
                    Type     = widgetInfo.Type,
                };
            }

            NameValueCollection extProperties = new NameValueCollection();

            foreach (var wp in widgetInfo.Parameters)
            {
                if (!string.IsNullOrEmpty(wp.DefaultValue))
                {
                    extProperties.Add(wp.Name, wp.DefaultValue);
                }
                else
                {
                    extProperties.Add(wp.Name, string.Empty);
                }
            }

            widget.SetAllValues(extProperties);

            return(widget);
        }