/// <summary> /// Gets the connect time property. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public DictionaryProperty GetConnectTimeProperty(string name) { if (this.State != FdoConnectionState.Open && this.State != FdoConnectionState.Pending) { throw new InvalidOperationException(Res.GetString("ERR_CONNECTION_NOT_OPEN")); } IConnectionPropertyDictionary dict = this.InternalConnection.ConnectionInfo.ConnectionProperties; bool enumerable = dict.IsPropertyEnumerable(name); DictionaryProperty dp = null; if (enumerable) { EnumerableDictionaryProperty ep = new EnumerableDictionaryProperty(); ep.Values = dict.EnumeratePropertyValues(name); dp = ep; } else { dp = new DictionaryProperty(); } dp.Name = name; dp.LocalizedName = dict.GetLocalizedName(name); dp.DefaultValue = dict.GetPropertyDefault(name); dp.Protected = dict.IsPropertyProtected(name); dp.Required = dict.IsPropertyRequired(name); return(dp); }
public DictionaryDialog(IConnectionPropertyDictionary dict) : this() { foreach (string name in dict.PropertyNames) { string localized = dict.GetLocalizedName(name); bool required = dict.IsPropertyRequired(name); bool enumerable = dict.IsPropertyEnumerable(name); string defaultValue = dict.GetPropertyDefault(name); string[] values = dict.EnumeratePropertyValues(name); if (required) { if (enumerable) { DataGridViewRow row = AddRequiredEnumerableProperty(localized, defaultValue, values); if (values.Length > 0) { row.Cells[1].Value = values[0]; } } else { AddRequiredProperty(localized, defaultValue); } } else { if (enumerable) { AddOptionalEnumerableProperty(localized, defaultValue, values); } else { AddProperty(localized, defaultValue); } } } }
public override int Execute() { CommandStatus retCode; IConnection conn = null; try { conn = FeatureAccessManager.GetConnectionManager().CreateConnection(_provider); } catch (OSGeo.FDO.Common.Exception ex) { WriteException(ex); return((int)CommandStatus.E_FAIL_CREATE_CONNECTION); } IConnectionPropertyDictionary dict = conn.ConnectionInfo.ConnectionProperties; Console.WriteLine("Connection properties for: {0}", _provider); foreach (string name in dict.PropertyNames) { Console.WriteLine("\nProperty Name: {0}\n\n\tLocalized Name: {1}", name, dict.GetLocalizedName(name)); Console.WriteLine("\tRequired: {0}\n\tProtected: {1}\n\tEnumerable: {2}", dict.IsPropertyRequired(name), dict.IsPropertyProtected(name), dict.IsPropertyEnumerable(name)); if (dict.IsPropertyEnumerable(name)) { Console.WriteLine("\tValues for property:"); try { string[] values = dict.EnumeratePropertyValues(name); foreach (string str in values) { Console.WriteLine("\t\t- {0}", str); } } catch (OSGeo.FDO.Common.Exception) { Console.Error.WriteLine("\t\tProperty values not available"); } } } retCode = CommandStatus.E_OK; return((int)retCode); }
public DictionaryDialog(IConnectionPropertyDictionary dict) : this() { foreach (string name in dict.PropertyNames) { string localized = dict.GetLocalizedName(name); bool required = dict.IsPropertyRequired(name); bool enumerable = dict.IsPropertyEnumerable(name); string defaultValue = dict.GetPropertyDefault(name); string[] values = dict.EnumeratePropertyValues(name); if (required) { if (enumerable) { DataGridViewRow row = AddRequiredEnumerableProperty(localized, defaultValue, values); if(values.Length > 0) row.Cells[1].Value = values[0]; } else AddRequiredProperty(localized, defaultValue); } else { if (enumerable) AddOptionalEnumerableProperty(localized, defaultValue, values); else AddProperty(localized, defaultValue); } } }