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) { 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; } } } }
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); } }
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); } }
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); } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider == null || context == null) { return(value); } if (context.Instance == null) { return(value); } try { context.OnComponentChanging(); object newConnection = base.EditValue(context, provider, value); string connectionString = newConnection as string; int index = -1; if (connectionString == null && newConnection != null) { if (_managerType != null) { object manager = Activator.CreateInstance(_managerType, new object[] { provider }); if (manager != null) { index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { "Npgsql" }); if (index > -1 && _selector != null) { connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }); _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null); } } } } if (String.IsNullOrEmpty(connectionString) == false) { value = connectionString; } context.OnComponentChanged(); } catch { } return(value); }