/*------------------------------------------------------------------------------------------------------- ** Constructors **-----------------------------------------------------------------------------------------------------*/ public DropDownListContentControl(ApplicationField ApplicationField) : base(ApplicationField) { _lstListItems = new List<DropDownListItem>(); XmlDocument xml = new XmlDocument(); xml.LoadXml(ApplicationField.Parameters[0]); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable); namespaceManager.AddNamespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); XmlNodeList xnList = xml.SelectNodes("/w:sdt/w:sdtPr/w:dropDownList", namespaceManager); foreach (XmlNode xn in xnList) { foreach (XmlNode subnode in xn.ChildNodes) { switch (subnode.LocalName) { case "listItem": DropDownListItem listItem = new DropDownListItem(); if (subnode.Attributes["w:value"] != null) listItem.Value = subnode.Attributes["w:value"].Value; if (subnode.Attributes["w:displayText"] != null) listItem.DisplayText = subnode.Attributes["w:displayText"].Value; _lstListItems.Add(listItem); break; } } } }
/*------------------------------------------------------------------------------------------------------- ** Constructors **-----------------------------------------------------------------------------------------------------*/ public CheckBoxContentControl(ApplicationField ApplicationField) : base(ApplicationField) { XmlDocument xml = new XmlDocument(); xml.LoadXml(ApplicationField.Parameters[0]); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable); namespaceManager.AddNamespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); namespaceManager.AddNamespace("w14", "http://schemas.microsoft.com/office/word/2010/wordml"); XmlNodeList xnList = xml.SelectNodes("/w:sdt/w:sdtPr/w14:checkbox", namespaceManager); foreach (XmlNode xn in xnList) { foreach (XmlNode subnode in xn.ChildNodes) { switch (subnode.LocalName) { case "checked": if (subnode.Attributes["w14:val"] != null) _bChecked = ((Convert.ToInt32(subnode.Attributes["w14:val"].Value) != 0)); break; } } } }
/*------------------------------------------------------------------------------------------------------- ** Constructors **-----------------------------------------------------------------------------------------------------*/ public DateContentControl(ApplicationField ApplicationField) : base(ApplicationField) { XmlDocument xml = new XmlDocument(); xml.LoadXml(ApplicationField.Parameters[0]); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable); namespaceManager.AddNamespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); XmlNodeList xnList = xml.SelectNodes("/w:sdt/w:sdtPr/w:date", namespaceManager); foreach (XmlNode xn in xnList) { if (xn.Attributes["w:fullDate"].Value != null) _dtDate = Convert.ToDateTime(xn.Attributes["w:fullDate"].Value); foreach (XmlNode subnode in xn.ChildNodes) { switch (subnode.LocalName) { case "dateFormat": if (subnode.Attributes["w:val"] != null) _strDateFormat = subnode.Attributes["w:val"].Value; break; case "lid": if (subnode.Attributes["w:val"] != null) _strLanguageID = subnode.Attributes["w:val"].Value; break; case "storeMappedDataAs": if (subnode.Attributes["w:val"] != null) _strStoreMappedDataAs = subnode.Attributes["w:val"].Value; break; case "calendar": if (subnode.Attributes["w:val"] != null) _strCalendar = subnode.Attributes["w:val"].Value; break; } } } this.Date = _dtDate; }
public static Type GetContentControlType(ApplicationField ApplicationField) { if (ApplicationField.TypeName != "SDTRUN" && ApplicationField.TypeName != "SDTBLOCK") return null; XmlDocument xml = new XmlDocument(); xml.LoadXml(ApplicationField.Parameters[0]); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xml.NameTable); namespaceManager.AddNamespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); XmlNodeList xnList = xml.SelectNodes("/w:sdt/w:sdtPr", namespaceManager); foreach (XmlNode xn in xnList) { foreach (XmlNode subnode in xn.ChildNodes) { switch (subnode.LocalName) { case "text": return typeof(PlainTextContentControl); case "checkbox": return typeof(CheckBoxContentControl); case "comboBox": return typeof(ComboBoxContentControl); case "dropDownList": return typeof(DropDownListContentControl); case "date": return typeof(DateContentControl); } } return typeof(RichTextContentControl); } return null; }
/// <summary> /// Adds a new field to an app. /// <para>Podio API Reference: https://developers.podio.com/doc/applications/get-app-field-22353 </para> /// </summary> /// <example> /// <![CDATA[ /// //Example Usage: Adding a new text field. /// /// var applicationField = new ApplicationField(); /// applicationField.Type = "text"; /// applicationField.Config.Label = "New text field"; /// applicationField.Config.Settings = new Dictionary<string, object> /// { /// {"size", "large"} /// }; /// podio.ApplicationService.AddNewAppField(APP_ID, applicationField); /// ]]> /// </example> /// <param name="appId"></param> /// <param name="field"></param> public async Task<int> AddNewAppField(int appId, ApplicationField field) { string url = string.Format("/app/{0}/field/", appId); dynamic response = await _podio.PostAsync<dynamic>(url, field); return (int)response["field_id"]; }
/*------------------------------------------------------------------------------------------------------- ** Constructors **-----------------------------------------------------------------------------------------------------*/ public RichTextContentControl(ApplicationField ApplicationField) : base(ApplicationField) { }
/*------------------------------------------------------------------------------------------------------- ** Constructors **-----------------------------------------------------------------------------------------------------*/ public ContentControlFieldAdapter(ApplicationField ApplicationField) { _afApplicationField = ApplicationField; GetParameters(); }
public PlainTextContentControl(ApplicationField ApplicationField) : base(ApplicationField) { }
/// <summary> /// Adds a new field to an app. /// <para>Podio API Reference: https://developers.podio.com/doc/applications/get-app-field-22353 </para> /// </summary> /// <param name="appId"></param> /// <param name="field"></param> public int AddNewAppField(int appId, ApplicationField field) { /* Example Usage: Adding a new text field. var applicationField = new ApplicationField(); applicationField.Type = "text"; applicationField.Config.Label = "New text field"; applicationField.Config.Settings = new Dictionary<string, object> { {"size", "large"} }; podio.ApplicationService.AddNewAppField(APP_ID, applicationField); */ string url = string.Format("/app/{0}/field/", appId); dynamic response = _podio.Post<dynamic>(url, field); return (int)response["field_id"]; }