public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     try
     {
         if (((provider != null) && (context != null)) && (context.Instance != null))
         {
             FilterControl filter;
             FilterColumnCollectionDialog.ListBoxItem instance = context.Instance as FilterColumnCollectionDialog.ListBoxItem;
             if (instance != null)
             {
                 filter = instance.FilterColumn.FilterControl;
             }
             else
             {
                 FilterColumn column = context.Instance as FilterColumn;
                 if (column != null)
                 {
                     filter = column.FilterControl;
                 }
                 else
                 {
                     filter = null;
                 }
             }
             if (filter == null)
             {
                 return value;
             }
             object dataSource = filter.DataSource;
             string dataMember = filter.DataMember;
             string str2 = (string)value;
             string str3 = dataMember + "." + str2;
             if (dataSource == null)
             {
                 dataMember = string.Empty;
                 str3 = str2;
             }
             if (this.designBindingPicker == null)
             {
                 this.designBindingPicker = new DesignBindingPicker();
             }
             DesignBinding initialSelectedItem = new DesignBinding(dataSource, str3);
             DesignBinding binding2 = this.designBindingPicker.Pick(context, provider, false, true, false, dataSource, dataMember, initialSelectedItem);
             if ((dataSource != null) && (binding2 != null))
             {
                 value = binding2.DataField;
             }
         }
         return value;
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.ToString());
         throw;
     }
 }
 public DesignBinding Pick(ITypeDescriptorContext context, IServiceProvider provider, bool showDataSources, bool showDataMembers, bool selectListMembers, object rootDataSource, string rootDataMember, DesignBinding initialSelectedItem)
 {
     this.serviceProvider = provider;
     this.edSvc = (IWindowsFormsEditorService)this.serviceProvider.GetService(typeof(IWindowsFormsEditorService));
     this.dspSvc = (DataSourceProviderService)this.serviceProvider.GetService(typeof(DataSourceProviderService));
     this.typeSvc = (ITypeResolutionService)this.serviceProvider.GetService(typeof(ITypeResolutionService));
     this.hostSvc = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost));
     if (this.edSvc == null)
     {
         return null;
     }
     this.context = context;
     this.showDataSources = showDataSources;
     this.showDataMembers = showDataMembers;
     this.selectListMembers = showDataMembers ? selectListMembers : true;
     this.rootDataSource = rootDataSource;
     this.rootDataMember = rootDataMember;
     IUIService service = this.serviceProvider.GetService(typeof(IUIService)) as IUIService;
     if (service != null)
     {
         if (service.Styles["VsColorPanelHyperLink"] is Color)
         {
             this.addNewCtrl.LinkColor = (Color)service.Styles["VsColorPanelHyperLink"];
         }
         if (service.Styles["VsColorPanelHyperLinkPressed"] is Color)
         {
             this.addNewCtrl.ActiveLinkColor = (Color)service.Styles["VsColorPanelHyperLinkPressed"];
         }
     }
     this.FillTree(initialSelectedItem);
     this.addNewPanel.Visible = (showDataSources && (this.dspSvc != null)) && this.dspSvc.SupportsAddNewDataSource;
     this.helpTextPanel.Visible = showDataSources;
     this.UpdateHelpText(null);
     this.edSvc.DropDownControl(this);
     DesignBinding selectedItem = this.selectedItem;
     this.selectedItem = null;
     this.EmptyTree();
     this.serviceProvider = null;
     this.edSvc = null;
     this.dspSvc = null;
     this.hostSvc = null;
     context = null;
     return selectedItem;
 }
 private void FillTree(DesignBinding initialSelectedItem)
 {
     this.selectedItem = initialSelectedItem;
     this.EmptyTree();
     this.noneNode = new NoneNode();
     this.otherNode = new OtherNode();
     this.projectNode = new ProjectNode(this);
     if (((this.hostSvc != null) && (this.hostSvc.RootComponent != null)) && (this.hostSvc.RootComponent.Site != null))
     {
         this.instancesNode = new InstancesNode(this.hostSvc.RootComponent.Site.Name);
     }
     else
     {
         this.instancesNode = new InstancesNode(string.Empty);
     }
     this.treeViewCtrl.Nodes.Add(this.noneNode);
     if (this.showDataSources)
     {
         this.AddFormDataSources();
         this.AddProjectDataSources();
         if (this.projectNode.Nodes.Count > 0)
         {
             this.otherNode.Nodes.Add(this.projectNode);
         }
         if (this.instancesNode.Nodes.Count > 0)
         {
             this.otherNode.Nodes.Add(this.instancesNode);
         }
         if (this.otherNode.Nodes.Count > 0)
         {
             this.treeViewCtrl.Nodes.Add(this.otherNode);
         }
     }
     else
     {
         this.AddDataSourceContents(this.treeViewCtrl.Nodes, this.rootDataSource, this.rootDataMember, null);
     }
     if (this.selectedNode == null)
     {
         this.selectedNode = this.noneNode;
     }
     this.selectedItem = null;
     base.Width = Math.Max(base.Width, this.treeViewCtrl.PreferredWidth + (SystemInformation.VerticalScrollBarWidth * 2));
 }