Example #1
0
        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;
        }
Example #2
0
        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;
        }
 public static bool LoadFromFile(string fileName, out UiWidgetType obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an UiWidgetType object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output UiWidgetType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out UiWidgetType obj, out System.Exception exception) {
     exception = null;
     obj = default(UiWidgetType);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out UiWidgetType obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an UiWidgetType object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output UiWidgetType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out UiWidgetType obj, out System.Exception exception) {
     exception = null;
     obj = default(UiWidgetType);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }