Пример #1
0
        protected override void OnDropDown(EventArgs e)
        {
            // Retrieve handle to the dynamically created drop-down list control
            var info = new Win32.COMBOBOXINFO {
                cbSize = Marshal.SizeOf(typeof(Win32.COMBOBOXINFO))
            };

            Win32.SendMessage(Handle, Win32.CB_GETCOMBOBOXINFO, IntPtr.Zero, out info);
            DropDownListCtrl = new DropDownListControl(this, info.hwndList);

            base.OnDropDown(e);
        }
Пример #2
0
        public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument)
        {
            PlaceHolder ph = new PlaceHolder();

            Label lbl = new Label();

            if (renderingDocument.Attributes["renderedLabel"] != null)
            {
                lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server);
            }
            else
            {
                lbl.Text = this.Name.FromXmlName2Render(server);
            }
            lbl.CssClass = "label";
            ph.Controls.Add(lbl);

            bool        isRadio = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)elemPointer.SchemaType).Content).Facets.Count <= MAX_ELEM_BEFORE_DROPDOWN;
            ListControl radio;

            if (isRadio)
            {
                radio = new RadioButtonControl(this);
            }
            else
            {
                radio = new DropDownListControl(this);
            }

            foreach (ListItem i in radio.Items)
            {
                i.Text = i.Text.FromXmlValue2Render(server);
            }

            if (isRadio && radio.Items.Count > 0)
            {
                radio.Items[0].Selected = true;
            }

            //--Rendering Document
            XmlAttribute clas = renderingDocument.Attributes["class"];
            XmlAttribute rel  = renderingDocument.Attributes["rel"];

            if (clas != null && rel != null)
            {
                foreach (ListItem el in isRadio ? ((RadioButtonControl)radio).Items : ((DropDownListControl)radio).Items)
                {
                    el.Attributes.Add("class", clas.Value.FromXmlValue2Render(server));
                    //el.Attributes.Add("rel", rel.Value.FromXmlValue2Render(server));
                }
            }
            if (renderingDocument.Attributes["description"] != null)
            {
                radio.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server);
            }
            //--
            if (isRadio)
            {
                if (radio.Items.Count > MAX_ELEM_BEFORE_VERTICAL_ALIGN)
                {
                    ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Vertical;
                    // ((RadioButtonControl)radio).RepeatColumns = 5;
                }
                else
                {
                    ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Horizontal;
                }
            }

            /* if (!Common.getElementFromSchema(baseSchema).IsNillable)
             * {
             *   RequiredFieldValidator rqfv = new RequiredFieldValidator();
             *   rqfv.ErrorMessage = "Required field: select an option";
             *   rqfv.ControlToValidate = radio.ID;
             *   rqfv.ValidationGroup = "1";
             *   ph.Controls.Add(rqfv);
             * }*/
            ph.Controls.Add(radio);
            return(ph);
        }
Пример #3
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            //the actual list of standard items to return
            StandardValuesCollection list = null;

            if (context.Instance is Screen)
            {
                Screen screen = (Screen)context.Instance;

                var retVal = from item in screen.DataCommands
                             select item.Name;

                var tempList = retVal.ToList <String>();
                tempList.Insert(0, String.Empty);

                string[] items = tempList.ToArray <string>();
                list = new StandardValuesCollection(items);
            }



            if (context.Instance is Section)
            {
                Section section = (Section)context.Instance;

                if (section.Parent != null)
                {
                    if (section.Parent is Screen)
                    {
                        Screen parentScreen = (Screen)section.Parent;
                        var    retVal       = from item in parentScreen.DataCommands
                                              select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }
                else
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 select item.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is Grid)
            {
                Grid grid = (Grid)context.Instance;


                if (grid.Parent == null)
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 select item.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
                else
                {
                    if (grid.Parent is Screen)
                    {
                        Screen parentScreen = (Screen)grid.Parent;
                        var    retVal       = from item in parentScreen.DataCommands
                                              select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is DropDownListControl)
            {
                DropDownListControl control = (DropDownListControl)context.Instance;


                if (control.Parent is Section)
                {
                    Section section = (Section)control.Parent;


                    if (section.Parent != null)
                    {
                        if (section.Parent is Screen)
                        {
                            Screen parentScreen = (Screen)section.Parent;
                            var    retVal       = from item in parentScreen.DataCommands
                                                  select item.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                    else
                    {
                        //handle bug during initial creation where we donot have a parent
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is ListBoxControl)
            {
                ListBoxControl control = (ListBoxControl)context.Instance;


                if (control.Parent is Section)
                {
                    Section section = (Section)control.Parent;


                    if (section.Parent != null)
                    {
                        if (section.Parent is Screen)
                        {
                            Screen parentScreen = (Screen)section.Parent;
                            var    retVal       = from item in parentScreen.DataCommands
                                                  select item.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                    else
                    {
                        //handle bug during initial creation where we donot have a parent
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is TreeViewControl)
            {
                TreeViewControl control = (TreeViewControl)context.Instance;


                if (control.Parent is Section)
                {
                    Section section = (Section)control.Parent;


                    if (section.Parent != null)
                    {
                        if (section.Parent is Screen)
                        {
                            Screen parentScreen = (Screen)section.Parent;
                            var    retVal       = from item in parentScreen.DataCommands
                                                  select item.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                    else
                    {
                        //handle bug during initial creation where we donot have a parent
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is WorkflowStatusControl)
            {
                WorkflowStatusControl workflowStatus = (WorkflowStatusControl)context.Instance;

                if (workflowStatus.Parent is Section)
                {
                    Section section = (Section)workflowStatus.Parent;


                    if (section.Parent != null)
                    {
                        if (section.Parent is Screen)
                        {
                            Screen parentScreen = (Screen)section.Parent;
                            var    retVal       = from item in parentScreen.DataCommands
                                                  select item.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                    else
                    {
                        //handle bug during initial creation where we do not have a parent
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     select item.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();
                        list = new StandardValuesCollection(items);
                    }
                }


                if (context.Instance is RadioButtonListControl)
                {
                    RadioButtonListControl control = (RadioButtonListControl)context.Instance;


                    if (control.Parent is Section)
                    {
                        Section section = (Section)control.Parent;


                        if (section.Parent != null)
                        {
                            if (section.Parent is Screen)
                            {
                                Screen parentScreen = (Screen)section.Parent;
                                var    retVal       = from item in parentScreen.DataCommands
                                                      select item.Name;

                                var tempList = retVal.ToList <String>();
                                tempList.Insert(0, String.Empty);

                                string[] items = tempList.ToArray <string>();
                                list = new StandardValuesCollection(items);
                            }
                        }
                        else
                        {
                            //handle bug during initial creation where we donot have a parent
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         select item.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                }
            }


            return(list);
        }
Пример #4
0
    public override void OnInspectorGUI()
    {
        DropDownListControl myTarget = null;

        try { myTarget = (DropDownListControl)target; } catch { }

        if (myTarget != null)
        {
            GUI.changed = false;
            EditorGUILayout.Space();

            EditorStyles.foldout.fontStyle = FontStyle.Bold;
            blnObjects = EditorGUILayout.Foldout(blnObjects, "DROPDOWN LIST GAMEOBJECT COMPONENTS");
            if (blnObjects)
            {
                myTarget.ParentContainer = (GameObject)EditorGUILayout.ObjectField("Parent Container", myTarget.ParentContainer, typeof(GameObject), true);
                EditorGUILayout.Space();
                myTarget.SelectedTextObject = (Text)EditorGUILayout.ObjectField("Selected Text", myTarget.SelectedTextObject, typeof(Text), true);
                myTarget.DdlListBox         = (ListBoxControl)EditorGUILayout.ObjectField("List Box Control", myTarget.DdlListBox, typeof(ListBoxControl), true);
                EditorGUILayout.Separator();
                EditorGUILayout.Space();
            }

            myTarget.DdlListBox.Title            = "";
            myTarget.DdlListBox.TitleBestFit     = false;
            myTarget.DdlListBox.CanMultiSelect   = false;
            myTarget.DdlListBox.PartOfDDL        = true;
            myTarget.DdlListBox.AllowDoubleClick = false;

            EditorStyles.label.fontStyle = FontStyle.Bold;
            EditorGUILayout.LabelField("DROPDOWN LIST PLACEHOLDER TEXT");
            EditorStyles.label.fontStyle = FontStyle.Normal;
            myTarget.PlaceholderText     = EditorGUILayout.TextField("Placeholder Text", myTarget.PlaceholderText);
            EditorGUILayout.Separator();
            EditorGUILayout.Space();

            EditorStyles.label.fontStyle = FontStyle.Bold;
            EditorGUILayout.LabelField("LINE ITEM SETTINGS");
            EditorStyles.label.fontStyle           = FontStyle.Normal;
            myTarget.LineItemHeight                = EditorGUILayout.FloatField("Line Item Height", myTarget.LineItemHeight);
            myTarget.DdlListBox.Spacing            = EditorGUILayout.FloatField("Line Item Spacing", myTarget.DdlListBox.Spacing);
            myTarget.DdlListBox.ItemNormalColor    = EditorGUILayout.ColorField("Normal Color", myTarget.DdlListBox.ItemNormalColor);
            myTarget.DdlListBox.ItemHighlightColor = EditorGUILayout.ColorField("Highlight Color", myTarget.DdlListBox.ItemHighlightColor);
            myTarget.DdlListBox.ItemSelectedColor  = EditorGUILayout.ColorField("Selected Color", myTarget.DdlListBox.ItemSelectedColor);
            myTarget.DdlListBox.ItemDisabledColor  = EditorGUILayout.ColorField("Disabled Color", myTarget.DdlListBox.ItemDisabledColor);
            EditorGUILayout.Separator();
            EditorGUILayout.Space();


            if (Application.isPlaying)
            {
                // DISPLAY THE CURRENTLY SELECTED ITEM(S) IN THE LISTBOX
                EditorStyles.label.fontStyle = FontStyle.Bold;
                EditorGUILayout.LabelField("SELECTED INDEXES & VALUES");
                EditorStyles.label.fontStyle = FontStyle.Normal;
                string        st = "";
                List <string> sl = myTarget.DdlListBox.SelectedValues;
                if (sl != null)
                {
                    for (int i = 0; i < sl.Count; i++)
                    {
                        st += myTarget.DdlListBox.SelectedIndexes[i].ToString() + ": \"" + sl[i].ToString() + "\"\n";
                    }
                    EditorStyles.label.fixedHeight = sl.Count * 14;
                    EditorGUILayout.LabelField("Selected", st);
                    EditorStyles.label.fixedHeight = 0;
                    GUILayout.Space(sl.Count * 14);
                }
                else
                {
                    EditorGUILayout.LabelField("Selected", "None");
                }
                EditorGUILayout.Separator();
                EditorGUILayout.Space();
            }
            else
            {
                EditorStyles.label.fontStyle = FontStyle.Bold;
                EditorGUILayout.LabelField("INITIAL LINE ITEMS");
                EditorStyles.label.fontStyle = FontStyle.Normal;

                myTarget.StartingValue = EditorGUILayout.TextField("Starting Value", myTarget.StartingValue);
                EditorGUILayout.Space();

                EditorGUILayout.BeginVertical();

                // DISPLAY LIST HEADER
                EditorGUILayout.BeginHorizontal();
                EditorStyles.label.richText     = true;
                EditorStyles.label.stretchWidth = false;
                GUILayout.Button(" ", GUILayout.Width(20));
                EditorGUILayout.LabelField("<color=yellow>Index</color>", GUILayout.Width(40));
                EditorGUILayout.LabelField("<color=yellow>Value</color>", GUILayout.Width(100));
                EditorGUILayout.LabelField("<color=yellow>Text</color>");
                EditorStyles.label.richText     = false;
                EditorStyles.label.stretchWidth = true;
                EditorGUILayout.EndHorizontal();

                // DISPLAY INITIAL LIST ITEMS
                for (int i = 0; i < myTarget.StartArray.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("x", GUILayout.Width(20)))
                    {
                        myTarget.RemoveStartItemByIndex(i);
                    }
                    else
                    {
                        EditorGUILayout.LabelField(myTarget.StartArray[i].Index.ToString(), GUILayout.Width(40));
                        EditorGUILayout.LabelField(myTarget.StartArray[i].Value, GUILayout.Width(100));
                        EditorGUILayout.LabelField(myTarget.StartArray[i].Text);
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.Space();

                // ADD NEW ITEM
                strValue = EditorGUILayout.TextField("Value", strValue);
                strText  = EditorGUILayout.TextField("Text", strText);
                sprIcon  = (Sprite)EditorGUILayout.ObjectField("Icon", sprIcon, typeof(Sprite), true);
                if (GUILayout.Button("Add Item") && strValue.Trim() != "" && strText.Trim() != "")
                {
                    myTarget.AddStartItem(strValue, strText, sprIcon);
                    strValue = "";
                    strText  = "";
                    sprIcon  = null;
                }
                EditorGUILayout.Space();

                // SORT LIST ITEMS
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Sort By Text"))
                {
                    myTarget.SortStartByText();
                }
                if (GUILayout.Button("Sort By Value"))
                {
                    myTarget.SortStartByValue();
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Separator();
                EditorGUILayout.Space();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(myTarget);
                if (!Application.isPlaying)
                {
                    EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                }
            }
        }
    }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            //the actual list of standard items to return
            StandardValuesCollection list = null;

            if (context.Instance is Picker)
            {
                Picker picker = (Picker)context.Instance;

                var retVal = from item in Configuration.GetInstance().DataCommands
                             from column in item.Columns
                             where item.Name == picker.DataCommand
                             select column.Name;

                var tempList = retVal.ToList <String>();
                tempList.Insert(0, String.Empty);

                string[] items = tempList.ToArray <string>();

                list = new StandardValuesCollection(items);
            }

            if (context.Instance is ScreenPageTemplate)
            {
                ScreenPageTemplate pageTemplate = (ScreenPageTemplate)context.Instance;

                if (!String.IsNullOrEmpty(pageTemplate.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == pageTemplate.DataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is Grid)
            {
                Grid grid = (Grid)context.Instance;

                if (!String.IsNullOrEmpty(grid.SelectDataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == grid.SelectDataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is GridColumn)
            {
                GridColumn col = (GridColumn)context.Instance;

                if (!String.IsNullOrEmpty(col.Parent.SelectDataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name == col.Parent.SelectDataCommand
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is GridGroupByField)
            {
                GridGroupByField groupByField = (GridGroupByField)context.Instance;

                if ((groupByField.Expression != null) && (groupByField.Expression.Grid != null))
                {
                    if (!String.IsNullOrEmpty(groupByField.Expression.Grid.SelectDataCommand))
                    {
                        var retVal = from item in Configuration.GetInstance().DataCommands
                                     from column in item.Columns
                                     where item.Name == groupByField.Expression.Grid.SelectDataCommand
                                     select column.Name;

                        var tempList = retVal.ToList <String>();
                        tempList.Insert(0, String.Empty);

                        string[] items = tempList.ToArray <string>();

                        list = new StandardValuesCollection(items);
                    }
                }
            }

            if (context.Instance is Widget)
            {
                //if propery is DataField
                if (context.PropertyDescriptor.Name.ToLower() == "datafield")
                {
                    list = GetDataFieldColumns(context, list);
                }
                else
                {
                    if (context.Instance is DropDownListControl)
                    {
                        DropDownListControl control = (DropDownListControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }

                    if (context.Instance is ListBoxControl)
                    {
                        ListBoxControl control = (ListBoxControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }

                    if (context.Instance is TreeViewControl)
                    {
                        TreeViewControl control = (TreeViewControl)context.Instance;

                        if (!String.IsNullOrEmpty(control.SelectDataCommand))
                        {
                            var retVal = from item in Configuration.GetInstance().DataCommands
                                         from column in item.Columns
                                         where item.Name.ToLower() == control.SelectDataCommand.ToLower()
                                         select column.Name;

                            var tempList = retVal.ToList <String>();
                            tempList.Insert(0, String.Empty);

                            string[] items = tempList.ToArray <string>();
                            list = new StandardValuesCollection(items);
                        }
                    }
                }
            }

            if (context.Instance is DataCommandValidator)
            {
                DataCommandValidator validator = (DataCommandValidator)context.Instance;

                if (!String.IsNullOrEmpty(validator.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == validator.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is WorkflowDynamicSecurityGroup)
            {
                WorkflowDynamicSecurityGroup dynamicGroup = (WorkflowDynamicSecurityGroup)context.Instance;

                if (!String.IsNullOrEmpty(dynamicGroup.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dynamicGroup.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is EmailWorkflowAction)
            {
                EmailWorkflowAction emailAction = (EmailWorkflowAction)context.Instance;

                string dataCommandName = null;

                switch (context.PropertyDescriptor.Name.ToLower())
                {
                case "attachmentdocumentidfield":
                case "attachmenttoaddressfield":
                    dataCommandName = emailAction.AttachmentDataCommand;
                    break;

                case "bccaddressdisplaynamefield":
                case "bccaddressfield":
                case "bcctoaddressfield":
                    dataCommandName = emailAction.BCCAddressDataCommand;
                    break;

                case "ccaddressdisplaynamefield":
                case "ccaddressfield":
                case "cctoaddressfield":
                    dataCommandName = emailAction.CCAddressDataCommand;
                    break;

                case "contenttemplatefield":
                    dataCommandName = emailAction.ContentTemplateDataCommand;
                    break;

                case "fromaddressdisplaynamefield":
                case "fromaddressfield":
                case "fromtoaddressfield":
                    dataCommandName = emailAction.FromAddressDataCommand;
                    break;

                case "subjectfield":
                case "subjecttoaddressfield":
                    dataCommandName = emailAction.SubjectDataCommand;
                    break;

                case "toaddressdisplaynamefield":
                case "toaddressfield":
                    dataCommandName = emailAction.ToAddressDataCommand;
                    break;
                }

                if (!String.IsNullOrEmpty(dataCommandName))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dataCommandName.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is WorkflowContentDataItem)
            {
                WorkflowContentDataItem emailDataItem = (WorkflowContentDataItem)context.Instance;

                if (!String.IsNullOrEmpty(emailDataItem.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == emailDataItem.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }

            if (context.Instance is ContentDataItem)
            {
                ContentDataItem contentDataItem = (ContentDataItem)context.Instance;

                if (!String.IsNullOrEmpty(contentDataItem.DataCommand))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == contentDataItem.DataCommand.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();
                    list = new StandardValuesCollection(items);
                }
            }



            if (context.Instance is SMSWorkflowAction)
            {
                SMSWorkflowAction smsAction = (SMSWorkflowAction)context.Instance;

                string dataCommandName = null;

                switch (context.PropertyDescriptor.Name.ToLower().Substring(0, 2))
                {
                case "co":    //content
                    dataCommandName = smsAction.ContentTemplateDataCommand;
                    break;

                case "ph":    //phone
                    dataCommandName = smsAction.PhoneDataCommand;
                    break;
                }

                if (!String.IsNullOrEmpty(dataCommandName))
                {
                    var retVal = from item in Configuration.GetInstance().DataCommands
                                 from column in item.Columns
                                 where item.Name.ToLower() == dataCommandName.ToLower()
                                 select column.Name;

                    var tempList = retVal.ToList <String>();
                    tempList.Insert(0, String.Empty);

                    string[] items = tempList.ToArray <string>();

                    list = new StandardValuesCollection(items);
                }
            }



            return(list);
        }