public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (context != null)
            {
                object obj = context.Instance;
                if (obj is AjaxAutoComplete)
                {
                    AjaxAutoComplete autoComplete = (AjaxAutoComplete)obj;
                    string selAlias = autoComplete.SelectAlias;
                    if (selAlias != null && selAlias != "")
                    {
                        string conString = GloFix.GetConnString(selAlias);
                        int conType = GloFix.GetConnType(selAlias);

                        IDbConnection conn = GloFix.AllocateConn(conString, (ClientType)conType);
                        if (conn == null)
                            return null;
                        List<string> tables = GloFix.GetAllTablesList(conn);
                        if (edSvc != null)
                        {
                            StringListSelector mySelector = new StringListSelector(edSvc, tables.ToArray());
                            string strValue = (string)value;
                            if (mySelector.Execute(ref strValue)) value = strValue;

                            return strValue;
                        }
                    }
                }
            }
            return null;
        }
Example #2
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            ControlCollection ctrlList = null;
            if (context.Instance is Control)
            {
                ctrlList = ((Control)context.Instance).Page.Controls;
            }
            else if (context.Instance is InfoOwnerCollectionItem && ((InfoOwnerCollectionItem)context.Instance).Owner is Control)
            {
                ctrlList = ((Control)((InfoOwnerCollectionItem)context.Instance).Owner).Page.Controls;
            }

            foreach (Control ctrl in ctrlList)
            {
                if (ctrl is WebDataSource)
                {
                    objName.Add(ctrl.ID);
                }
            }
            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #3
0
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     IAjaxDataSource ajaxSource = null;
     ControlCollection ctrlList = null;
     if (context.Instance is IAjaxDataSource)
     {
         ajaxSource = (IAjaxDataSource)context.Instance;
         ctrlList = ((Control)context.Instance).Page.Controls;
     }
     else if (context.Instance is InfoOwnerCollectionItem && ((InfoOwnerCollectionItem)context.Instance).Owner is IAjaxDataSource)
     {
         ajaxSource = ((InfoOwnerCollectionItem)context.Instance).Owner as IAjaxDataSource;
         ctrlList = (((InfoOwnerCollectionItem)context.Instance).Owner as Control).Page.Controls;
     }
     if (ajaxSource != null)
     {
         foreach (Control ctrl in ctrlList)
         {
             if (ctrl is WebDataSource && ctrl.ID == ajaxSource.DataSourceID)
             {
                 WebDataSource wds = (WebDataSource)ctrl;
                 DataTable srcTab = null;
                 if (string.IsNullOrEmpty(wds.SelectAlias) && string.IsNullOrEmpty(wds.SelectCommand))
                 {
                     if (wds.DesignDataSet == null)
                     {
                         WebDataSet ds = GloFix.CreateDataSet(wds.WebDataSetID);
                         wds.DesignDataSet = ds.RealDataSet;
                     }
                     srcTab = wds.DesignDataSet.Tables[wds.DataMember].Clone();
                 }
                 else
                 {
                     srcTab = wds.CommandTable.Clone();
                 }
                 foreach (DataColumn column in srcTab.Columns)
                 {
                     objName.Add(column.ColumnName);
                 }
                 break;
             }
         }
     }
     IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (service != null)
     {
         StringListSelector selector = new StringListSelector(service, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Example #4
0
 //    // Displays the UI for value selection.
 //    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     // Uses the IWindowsFormsEditorService to display a drop-down UI in the Properties window.
     IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     IGetValues aItem = (IGetValues)context.Instance;
     if (edSvc != null)
     {
         StringListSelector mySelector = new StringListSelector(edSvc, aItem.GetValues(context.PropertyDescriptor.Name));
         string strValue = (string)value;
         if (mySelector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Example #5
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     // Uses the IWindowsFormsEditorService to display a
     // drop-down UI in the Properties window.
     IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     IGetValues aItem = (IGetValues)context.Instance;
     if (edSvc != null)
     {
         try
         {
             StringListSelector mySelector = new StringListSelector(edSvc, aItem.GetValues(context.PropertyDescriptor.Name));
             string strValue = (string)value;
             if (mySelector.Execute(ref strValue)) value = strValue;
         }
         catch(Exception e)
         {
             MessageBox.Show(e.Message, "Error",  MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     return value;
 }
Example #6
0
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     if (context.Instance is InfoOwnerCollectionItem)
     {
         InfoOwnerCollectionItem collectionItem = context.Instance as InfoOwnerCollectionItem;
         AjaxBaseControl baseControl = collectionItem.Owner as AjaxBaseControl;
         //if (context.PropertyDescriptor.Name == "ButtonType" && collectionItem is AjaxScheduleToolItem)
         //{
         //    objName.AddRange(new string[] { "previousYear", "previousMonth", "nextYear", "nextMonth", "today", "title", "month", "week", "day" });
         //}
     }
     else if (context.Instance is AjaxSchedule)
     {
         DataTable srcTab = GetSourceTable(context.Instance as AjaxBaseControl);
         if (srcTab != null)
         {
             if (context.PropertyDescriptor.Name == "IdField"
                 || context.PropertyDescriptor.Name == "CaptionField"
                 || context.PropertyDescriptor.Name == "DescriptionField"
                 || context.PropertyDescriptor.Name == "StartDateTimeField"
                 || context.PropertyDescriptor.Name == "EndDateTimeField"
                 || context.PropertyDescriptor.Name == "AllDayField")
             {
                 foreach (DataColumn field in srcTab.Columns)
                 {
                     objName.Add(field.ColumnName);
                 }
             }
         }
     }
     IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (service != null)
     {
         StringListSelector selector = new StringListSelector(service, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (context != null)
            {
                object obj = context.Instance;
                if (obj is AjaxAutoComplete)
                {
                    AjaxAutoComplete autoComplete = (AjaxAutoComplete)obj;
                    IGetSelectAlias aItem = (IGetSelectAlias)autoComplete;
                    if (edSvc != null)
                    {
                        StringListSelector mySelector = new StringListSelector(edSvc, aItem.GetSelectAlias());
                        string strValue = (string)value;
                        if (mySelector.Execute(ref strValue)) value = strValue;

                        return strValue;
                    }
                }
            }
            return null;
        }
Example #8
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            if (context.Instance is WebValidateBox)
            {
                ControlCollection ctrlList = ((WebValidateBox)context.Instance).Page.Controls;

                foreach (Control ctrl in ctrlList)
                {
                    Control c = GetWebValidateBox(ctrl);
                    if (c != null)
                        objName.Add(c.ID);
                }
            }
            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #9
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     if (context.Instance is INavigatorSecurity)
     {
         if (File.Exists(SystemFile.DBFile))
         {
             XmlDocument DBXML = new XmlDocument();
             DBXML.Load(SystemFile.DBFile);
             XmlNode aNode = DBXML.DocumentElement.FirstChild;
             while (aNode != null)
             {
                 if (aNode.Name.ToUpper().Equals("DATABASE"))
                 {
                     XmlNode bNode = aNode.FirstChild;
                     while (bNode != null)
                     {
                         objName.Add(bNode.LocalName);
                         bNode = bNode.NextSibling;
                     }
                 }
                 aNode = aNode.NextSibling;
             }
         }
     }
     IWindowsFormsEditorService EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     if (EditorService != null)
     {
         StringListSelector selector = new StringListSelector(EditorService, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Example #10
0
 public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     if (context.Instance is AjaxResizableControl)
     {
         objName.Add("OnClientResizeText");
     }
     IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (service != null)
     {
         StringListSelector selector = new StringListSelector(service, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Example #11
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            if (context.Instance is InfoOwnerCollectionItem)
            {
                InfoOwnerCollectionItem collectionItem = context.Instance as InfoOwnerCollectionItem;
                AjaxBaseControl baseControl = collectionItem.Owner as AjaxBaseControl;

                if (context.PropertyDescriptor.Name == "FieldType" && (collectionItem is ExtGridColumn || collectionItem is AjaxFormField))
                {
                    objName.AddRange(new string[] { "string", "int", "float", "boolean", "date" });
                }
                else if (context.PropertyDescriptor.Name == "TextAlign" && collectionItem is ExtGridColumn)
                {
                    objName.AddRange(new string[] { "left", "center", "right" });
                }
                else if ((context.PropertyDescriptor.Name == "Operator" && collectionItem is ExtQueryField) ||
                    (context.PropertyDescriptor.Name == "Condition" && collectionItem is ExtWhereItem))
                {
                    objName.AddRange(new string[] { "=", "!=", ">", "<", ">=", "<=", "%", "%%" });
                }
                else if (context.PropertyDescriptor.Name == "Condition" && collectionItem is ExtQueryField)
                {
                    objName.AddRange(new string[] { "None", "And", "Or" });
                }
                else if ((context.PropertyDescriptor.Name == "DataField" && (collectionItem is ExtSimpleColumn || collectionItem is ExtGridColumn || collectionItem is AjaxFormField || collectionItem is ExtQueryField)) || (context.PropertyDescriptor.Name == "FieldName" && collectionItem is ExtWhereItem))
                {
                    DataTable srcTab = GetSourceTable(baseControl);
                    if (srcTab != null)
                    {
                        foreach (DataColumn field in srcTab.Columns)
                        {
                            objName.Add(field.ColumnName);
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "ColumnName" && collectionItem is AjaxSecColumnItem)
                {
                    DataTable srcTab = GetSourceTable(baseControl);
                    if (srcTab != null)
                    {
                        foreach (DataColumn field in srcTab.Columns)
                        {
                            objName.Add(field.ColumnName);
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "EditControlId" && (collectionItem is ExtGridColumn || collectionItem is AjaxFormField))
                {
                    PropertyInfo propEditor = collectionItem.GetType().GetProperty("Editor");
                    if (propEditor != null
                        && propEditor.PropertyType == typeof(ExtGridEditor))
                    {
                        if ((ExtGridEditor)propEditor.GetValue(collectionItem, null) == ExtGridEditor.ComboBox)
                        {
                            foreach (Control ctrl in baseControl.Page.Controls)
                            {
                                if (ctrl is ExtComboBox)
                                {
                                    objName.Add(ctrl.ID);
                                }
                            }
                        }
                        else if ((ExtGridEditor)propEditor.GetValue(collectionItem, null) == ExtGridEditor.RefButton)
                        {
                            foreach (Control ctrl in baseControl.Page.Controls)
                            {
                                if (ctrl is ExtRefButton)
                                {
                                    objName.Add(ctrl.ID);
                                }
                            }
                        }
                        else if ((ExtGridEditor)propEditor.GetValue(collectionItem, null) == ExtGridEditor.RefVal)
                        {
                            foreach (Control ctrl in baseControl.Page.Controls)
                            {
                                if (ctrl is ExtRefVal)
                                {
                                    objName.Add(ctrl.ID);
                                }
                            }
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "ControlId" && collectionItem is MultiViewItem)
                {
                    MultiViewItem item = context.Instance as MultiViewItem;
                    foreach (Control ctrl in baseControl.Page.Controls)
                    {
                        if (ctrl is AjaxGridView || ctrl is AjaxFormView)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
                else if (context.Instance is ExtColumnMatch)
                {
                    ExtColumnMatch extColumnMatch = context.Instance as ExtColumnMatch;
                    if (context.PropertyDescriptor.Name == "DestField")
                    {
                        foreach (Control ctrl in baseControl.Page.Controls)
                        {
                            bool isView = false;
                            if (ctrl is AjaxGridView)
                            {
                                AjaxGridView grid = ctrl as AjaxGridView;
                                foreach (ExtGridColumn col in grid.Columns)
                                {
                                    if (col.EditControlId == baseControl.ID)
                                    {
                                        isView = true;
                                        break;
                                    }
                                }
                            }
                            else if (ctrl is AjaxFormView)
                            {
                                AjaxFormView form = ctrl as AjaxFormView;
                                foreach (AjaxFormField field in form.Fields)
                                {
                                    if (field.EditControlId == baseControl.ID)
                                    {
                                        isView = true;
                                        break;
                                    }
                                }
                            }
                            if (isView)
                            {
                                DataTable srcTab = GetSourceTable(ctrl as AjaxBaseControl);
                                if (srcTab != null)
                                {
                                    foreach (DataColumn field in srcTab.Columns)
                                    {
                                        objName.Add(field.ColumnName);
                                    }
                                }
                                break;
                            }
                        }
                    }
                    else if (context.PropertyDescriptor.Name == "SrcField")
                    {
                        DataTable srcTab = GetSourceTable(baseControl);
                        if (srcTab != null)
                        {
                            foreach (DataColumn field in srcTab.Columns)
                            {
                                objName.Add(field.ColumnName);
                            }
                        }
                    }
                }
                else if (context.Instance is ExtRefButtonColumnMatch)
                {
                    ExtRefButton refButton = baseControl as ExtRefButton;
                    ExtRefButtonColumnMatch refButtonColMatch = context.Instance as ExtRefButtonColumnMatch;
                    if (refButton != null)
                    {
                        if (context.PropertyDescriptor.Name == "DestField")
                        {
                            foreach (Control ctrl in baseControl.Page.Controls)
                            {
                                bool isView = false;
                                if (ctrl is AjaxFormView)
                                {
                                    AjaxFormView form = ctrl as AjaxFormView;
                                    foreach (AjaxFormField field in form.Fields)
                                    {
                                        if (field.EditControlId == baseControl.ID)
                                        {
                                            isView = true;
                                            break;
                                        }
                                    }
                                }
                                if (isView)
                                {
                                    DataTable srcTab = GetSourceTable(ctrl as AjaxBaseControl);
                                    if (srcTab != null)
                                    {
                                        foreach (DataColumn field in srcTab.Columns)
                                        {
                                            objName.Add(field.ColumnName);
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                        else if (context.PropertyDescriptor.Name == "SrcField")
                        {
                            if (string.IsNullOrEmpty(refButton.SourceDataSourceID))
                            {
                                System.Windows.Forms.MessageBox.Show("The 'SourceDataSourceID' property must be set first.");
                            }
                            else
                            {
                                DataTable srcTab = GetSourceTable(baseControl);
                                if (srcTab != null)
                                {
                                    foreach (DataColumn field in srcTab.Columns)
                                    {
                                        objName.Add(field.ColumnName);
                                    }
                                }
                            }
                        }
                        else if (context.PropertyDescriptor.Name == "SrcControlId")
                        {
                            UpdatePanel upan = refButton.GetModalUpdatePanel();
                            if (upan != null)
                            {
                                FileLevelPageControlBuilder ctrlBuilder = upan.ContentTemplate as FileLevelPageControlBuilder;
                                if (ctrlBuilder != null)
                                {
                                    foreach (DictionaryEntry control in ctrlBuilder.BuiltObjects)
                                    {
                                        if (control.Key is WebControl)
                                        {
                                            objName.Add(((WebControl)control.Key).ID);
                                        }
                                    }
                                }
                            }
                        }
                        else if (context.PropertyDescriptor.Name == "SrcControlValueProperty")
                        {
                            objName.AddRange(new string[] { "BindingValue", "Checked", "SelectedValue", "Text" });
                        }
                    }
                }
            }
            else if (context.Instance is IChildSet)
            {
                IChildSet set = context.Instance as IChildSet;
                if (context.PropertyDescriptor.Name == "AutoFillingColumn")
                {
                    foreach (ExtGridColumn col in (set.OwnerView as AjaxGridView).Columns)
                    {
                        if (!string.IsNullOrEmpty(col.ColumnName) && col.Visible)
                        {
                            objName.Add(col.ColumnName);
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "GridPanel")
                {
                    foreach (Control ctrl in set.OwnerView.Page.Controls)
                    {
                        if (ctrl is UpdatePanel || ctrl is Panel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }
            else if (context.Instance is AjaxGridView)
            {
                AjaxGridView grid = context.Instance as AjaxGridView;
                if (context.PropertyDescriptor.Name == "EditPanelID")
                {
                    foreach (Control ctrl in grid.Page.Controls)
                    {
                        if (ctrl is ExtModalPanel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "QueryPanelID")
                {
                    foreach (Control ctrl in grid.Page.Controls)
                    {
                        if (ctrl is ExtModalPanel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }
            else if (context.Instance is ExtComboBox)
            {
                ExtComboBox cmb = context.Instance as ExtComboBox;
                if (context.PropertyDescriptor.Name == "ComboPanel")
                {
                    foreach (Control ctrl in cmb.Page.Controls)
                    {
                        if (ctrl is Panel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }
            else if (context.Instance is AjaxLayout)
            {
                AjaxLayout layout = context.Instance as AjaxLayout;
                if (context.PropertyDescriptor.Name == "View"/* || context.PropertyDescriptor.Name == "Details"*/)
                {
                    foreach (Control ctrl in layout.Page.Controls)
                    {
                        if (ctrl is AjaxGridView)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
                //else if (context.PropertyDescriptor.Name == "Master")
                //{
                //    foreach (Control ctrl in layout.Page.Controls)
                //    {
                //        if (ctrl is AjaxFormView)
                //        {
                //            objName.Add(ctrl.ID);
                //        }
                //    }
                //}
                else if (context.PropertyDescriptor.Name == "LayoutPanel")
                {
                    foreach (Control ctrl in layout.Page.Controls)
                    {
                        if (ctrl is Panel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }
            else if (context.Instance is ExtRefButton)
            {
                ExtRefButton refButton = context.Instance as ExtRefButton;
                if (context.PropertyDescriptor.Name == "DestinDataSourceID" || context.PropertyDescriptor.Name == "SourceDataSourceID")
                {
                    foreach (Control ctrl in refButton.Page.Controls)
                    {
                        if (ctrl is WebDataSource)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
                else if (context.PropertyDescriptor.Name == "ModalPanelID")
                {
                    foreach (Control ctrl in refButton.Page.Controls)
                    {
                        if (ctrl is ExtModalPanel)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #12
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            if (context.Instance != null && context.Instance is AjaxModalPanel)
            {
                AjaxModalPanel panel = context.Instance as AjaxModalPanel;
                if (panel.Controls.Count > 0 && panel.Controls[0] is UpdatePanel)
                {
                    UpdatePanel updatepanel = panel.Controls[0] as UpdatePanel;
                    string html = (updatepanel.ContentTemplate as TemplateBuilder).Text;
                    IDesignerHost host = (IDesignerHost)updatepanel.Site.GetService(typeof(IDesignerHost));
                    Control[] ctrls = ControlParser.ParseControls(host, html);

                    foreach (Control ctrl in ctrls)
                    {
                        if (ctrl is FormView || ctrl is DetailsView)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue))
                    value = strValue;
            }
            return value;
        }
Example #13
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            IGetValues aItem = (IGetValues)context.Instance;
            if (editorService != null)
            {
                StringListSelector mySelector = new StringListSelector(editorService, aItem.GetValues(context.PropertyDescriptor.Name));
                string strValue = (string)value;
                if (mySelector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #14
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            if (context.Instance != null)
            {
                ControlCollection ctrlList = ((Control)context.Instance).Page.Controls;
                foreach (Control ctrl in ctrlList)
                {
                    if (ctrl is TreeView)
                    {
                        objName.Add(ctrl.ID);
                    }
                }
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue))
                    value = strValue;
            }
            return value;
        }
Example #15
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> objName = new List<string>();
            if (context.Instance != null)
            {
                if (context.Instance is Control)
                {
                    AllCtrls.Clear();
                    ControlCollection ctrlList = ((Control)context.Instance).Page.Controls;
                    GetAllCtrls(ctrlList);
                    foreach (Control ctrl in AllCtrls)
                    {
                        if (ctrl is GridView || ctrl is DetailsView || ctrl is WebFormView)
                        {
                            objName.Add(ctrl.ID);
                        }
                    }
                }
                else if (context.Instance is WebSecControl)
                {
                    object obj = ((WebSecControl)context.Instance).Owner;
                    if (obj != null && obj is WebSecColumns)
                    {
                        AllCtrls.Clear();
                        ControlCollection ctrlList = ((WebSecColumns)obj).Page.Controls;
                        GetAllCtrls(ctrlList);
                        foreach (Control ctrl in AllCtrls)
                        {
                            if (ctrl is GridView || ctrl is DetailsView || ctrl is WebFormView)
                            {
                                objName.Add(ctrl.ID);
                            }
                        }
                    }
                }
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, objName.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #16
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> focusCtrls = new List<string>();
            if (context.Instance != null && context.Instance is InfoBindingSource)
            {
                InfoBindingSource bindingsource = (InfoBindingSource)context.Instance;
                List<Control> ctrls = new List<Control>(); ;
                foreach (IComponent comp in bindingsource.Container.Components)
                {
                    if (comp is Control)
                    {
                        ctrls.Add((Control)comp);
                    }
                }
                GetAllCtrls(ctrls);
                foreach (Control ctrl in AllCtrls)
                {
                    foreach (Binding binding in ctrl.DataBindings)
                    {
                        if (binding.DataSource is InfoBindingSource &&
                            binding.DataSource == bindingsource
                            && ((InfoBindingSource)binding.DataSource).DataMember == bindingsource.DataMember)
                        {
                            focusCtrls.Add(ctrl.Name);
                        }
                    }
                }
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, focusCtrls.ToArray());
                string strValue = ((Control)value).Name;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #17
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            WebDataSource source = null;
            object o = context.Instance;
            if (o is WebDataSource)
            {
                source = (WebDataSource)context.Instance;
            }
            else if (o is WebValidate)
            {
                WebValidate validate = (WebValidate)context.Instance;
                source = (WebDataSource)(validate.GetObjByID(validate.DataSourceID));
            }
            else if (o is WebDefault)
            {
                WebDefault def = (WebDefault)context.Instance;
                source = (WebDataSource)(def.GetObjByID(def.DataSourceID));
            }
            else
            {
                source = (WebDataSource)((WebDataSourceActionList)context.Instance).Component;
            }

            // --------------------------------------------------------------------------------
            // read xml.
            if (source.DesignDataSet == null)
            {
                WebDataSet wds = WebDataSet.CreateWebDataSet(source.WebDataSetID);
                if (wds != null)
                {
                    source.DesignDataSet = wds.RealDataSet;
                }
            }

            List<string> names = new List<string>();
            if (source.DesignDataSet != null)
            {
                DataTableCollection tables = source.DesignDataSet.Tables;
                foreach (DataTable t in tables)
                    names.Add(t.TableName);
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, names.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #18
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     List<string> objName = new List<string>();
     if (context.Instance is INavigatorSecurity)
     {
         INavigatorSecurity sec = context.Instance as INavigatorSecurity;
         object[] param = new object[1];
         param[0] = sec.DBAlias;
         CliUtils.fLoginDB = sec.DBAlias;
         object[] myRet = CliUtils.CallMethod("GLModule", "GetMenuID", param);
         CliUtils.fLoginDB = "";
         if ((myRet != null) && (0 == (int)myRet[0]))
         {
             ArrayList listMenuID = (ArrayList)myRet[1];
             ArrayList listCaption = (ArrayList)myRet[2];
             for (int i = 0; i < listMenuID.Count; i++)
             {
                 objName.Add(listMenuID[i] + "(" + listCaption[i] + ")");
             }
         }
     }
     IWindowsFormsEditorService EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     if (EditorService != null)
     {
         StringListSelector selector = new StringListSelector(EditorService, objName.ToArray());
         string strValue = (string)value;
         if (selector.Execute(ref strValue))
         {
             value = strValue.Substring(0, strValue.IndexOf('('));
         }
     }
     return value;
 }
Example #19
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (service != null)
     {
         StringListSelector selector = new StringListSelector(service, WebDataSet.GetAvailableDataSetID());
         string strValue = (string)value;
         if (selector.Execute(ref strValue)) value = strValue;
     }
     return value;
 }
Example #20
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (context != null)
            {
                object obj = context.Instance;
                WebDataSource source;
                if (obj is WebDataSource)
                {
                    source = (WebDataSource)obj;
                }
                else
                {
                    source = (WebDataSource)((WebDataSourceActionList)context.Instance).Component;
                }

                if (source == null)
                {
                    return null;
                }

                IGetSelectAlias aItem = (IGetSelectAlias)source;
                if (edSvc != null)
                {
                    // Get Alias in db.xml.
                    StringListSelector mySelector = new StringListSelector(edSvc, aItem.GetSelectAlias());
                    string strValue = (string)value;
                    if (mySelector.Execute(ref strValue)) value = strValue;

                    return strValue;
                }
                else
                { return null; }
            }
            else
            { return null; }
        }
Example #21
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> names = new List<string>();

            ControlCollection controls = (((WebDataSource)context.Instance).Parent).Controls;
            foreach (System.Web.UI.Control control in controls)
            {
                if (control.GetType() != typeof(WebDataSource))
                    continue;

                string name = control.Site.Name;
                if (name.ToLower() != ((System.Web.UI.Control)context.Instance).Site.Name.ToLower())
                    names.Add(control.Site.Name);
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, names.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }
Example #22
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            List<string> names = new List<string>();

            string aspxName = EditionDifference.ActiveDocumentFullName();
            string keyName = "LinqDataSets";
            string resourceName = aspxName + @".vi-VN.resx";
            // ResXResourceReader reader = new ResXResourceReader(s + aspxPath + @"\" + resourceName);
            ResXResourceReader reader = new ResXResourceReader(resourceName);
            IDictionaryEnumerator enumerator = reader.GetEnumerator();

            XmlDocument xmlDoc = new XmlDocument();
            while (enumerator.MoveNext())
            {
                if (enumerator.Key.ToString() == keyName)
                {
                    string sXml = (string)enumerator.Value;
                    xmlDoc.LoadXml(sXml);
                    break;
                }
            }
            reader.Close();

            if (xmlDoc == null) return null;

            XmlNode nLinqDSs = xmlDoc.SelectSingleNode("LinqDataSets");
            if (nLinqDSs == null) return null;

            XmlNodeList nLinqDSList = nLinqDSs.SelectNodes("LinqDataSet");
            foreach (XmlNode n in nLinqDSList)
            {
                names.Add(n.Attributes["Name"].Value);
            }

            IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (service != null)
            {
                StringListSelector selector = new StringListSelector(service, names.ToArray());
                string strValue = (string)value;
                if (selector.Execute(ref strValue)) value = strValue;
            }
            return value;
        }