Beispiel #1
0
        protected override void FillTreeWithData(ObjectSelectorEditor.Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
        {
            if (context == null || context.Instance == null)
            {
                return;
            }
            this.instance = context.Instance;
            selector.Clear();
            if (this.BdDbx0JCT)
            {
                selector.AddNode(USaG3GpjZagj1iVdv4u.Y4misFk9D9(424), (object)null, (ObjectSelectorEditor.SelectorNode)null);
            }
            foreach (KeyValuePair <string, object> keyValuePair in this.GetItems())
            {
                selector.AddNode(keyValuePair.Key, keyValuePair.Value, (ObjectSelectorEditor.SelectorNode)null);
            }
            object obj = context.PropertyDescriptor.GetValue(context.Instance);

            if (obj == null && this.BdDbx0JCT)
            {
                selector.SelectedNode = selector.Nodes[0];
            }
            else
            {
                foreach (ObjectSelectorEditor.SelectorNode selectorNode in selector.Nodes)
                {
                    if (selectorNode.value != null && selectorNode.value.Equals(obj))
                    {
                        selector.SelectedNode = (TreeNode)selectorNode;
                        break;
                    }
                }
            }
        }
 protected override void FillTreeWithData(ObjectSelectorEditor.Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
 {
     if (context != null && context.Instance != null)
     {
         AltIDGroup altIdGroup = (AltIDGroup)context.Instance;
         selector.Clear();
         foreach (IProvider provider1 in FreeQuant.Providers.ProviderManager.Providers)
         {
             selector.AddNode(provider1.Name, (object)provider1.Name, (ObjectSelectorEditor.SelectorNode)null);
         }
         selector.Sort();
         foreach (ObjectSelectorEditor.SelectorNode selectorNode in selector.Nodes)
         {
             if (selectorNode.value.Equals((object)altIdGroup.AltSource))
             {
                 selector.SelectedNode = (TreeNode)selectorNode;
                 break;
             }
         }
         selector.Width = 144;
     }
     else
     {
         base.FillTreeWithData(selector, context, provider);
     }
 }
Beispiel #3
0
 protected override void FillTreeWithData(ObjectSelectorEditor.Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
 {
     if ((context != null) && (context.Instance != null))
     {
         ApiItem instance = (ApiItem)context.Instance;
         this.selector          = selector;
         selector.CheckBoxes    = true;
         selector.BeforeSelect += new TreeViewCancelEventHandler(this.method_0);
         selector.Clear();
         foreach (ApiType category in Enum.GetValues(typeof(ApiType)))
         {
             if (category != ApiType.None)
             {
                 if ((instance.Type & category) == category)
                 {
                     selector.AddNode(category.ToString(), (int)category, null).Checked = (instance.UseType & category) == category;
                 }
             }
         }
         selector.SelectedNode = null;
     }
     else
     {
         base.FillTreeWithData(selector, context, provider);
     }
 }
Beispiel #4
0
 protected override void FillTreeWithData(ObjectSelectorEditor.Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
 {
     if (context != null && context.Instance != null)
     {
         this.instance = context.Instance;
         selector.Clear();
         if (this.allowNull)
         {
             selector.AddNode("(none)", null, null);
         }
         foreach (KeyValuePair <string, object> current in this.GetItems())
         {
             selector.AddNode(current.Key, current.Value, null);
         }
         object value = context.PropertyDescriptor.GetValue(context.Instance);
         if (value == null && this.allowNull)
         {
             selector.SelectedNode = selector.Nodes[0];
             return;
         }
         foreach (ObjectSelectorEditor.SelectorNode selectorNode in selector.Nodes)
         {
             if (selectorNode.value != null && selectorNode.value.Equals(value))
             {
                 selector.SelectedNode = selectorNode;
                 break;
             }
         }
     }
 }
Beispiel #5
0
        public void ObjectSelectorEditor_Selector()
        {
            ObjectSelectorEditor.Selector underTest = new ObjectSelectorEditor.Selector(new SubObjectSelectorEditor());

            Assert.NotNull(underTest);
            underTest.AddNode("node", "value", null);
            Assert.Single(underTest.Nodes);
            Assert.True(underTest.SetSelection("value", null));
            Assert.False(underTest.SetSelection("other value", null));
            underTest.Clear();
            Assert.Empty(underTest.Nodes);
        }
 protected override void FillTreeWithData(ObjectSelectorEditor.Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
 {
     if (context == null || context.Instance == null)
     {
         return;
     }
     selector.Clear();
     foreach (string label in this.types)
     {
         selector.AddNode(label, (object)label, (ObjectSelectorEditor.SelectorNode)null);
     }
 }
        protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
        {
            object       manager    = Activator.CreateInstance(_managerType, new object[] { provider });
            DbConnection connection = (DbConnection)context.Instance;

            ObjectSelectorEditor.SelectorNode node;

            _selector = selector;

            _selector.Clear();

            if (manager != null)
            {
                int    items = (int)_managerType.InvokeMember("GetConnectionCount", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, null);
                string dataProvider;
                string connectionString;
                string connectionName;

                for (int n = 0; n < items; n++)
                {
                    connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
                    connectionName   = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
                    dataProvider     = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
                    if (String.Compare(dataProvider, "Npgsql", true) == 0)
                    {
                        node = selector.AddNode(connectionName, connectionString, null);

                        if (String.Compare(connectionString, connection.ConnectionString, true) == 0)
                        {
                            selector.SelectedNode = node;
                        }
                    }
                }
                selector.AddNode("<New Connection...>", this, null);
            }
        }