private void SetDataStore(DataStoreInfo[] values) { _view.DataStores = values; _view.DataStoreEnabled = values.Length > 0; _view.SubmitEnabled = values.Length > 0; }
public void PendingConnect() { InitConnection(); try { if (_conn.State != FdoConnectionState.Closed) _conn.Close(); _conn.ConnectionString = string.Format("{0}={1};{2}={3};{4}={5}", _view.ServiceParameter, _view.Service, _view.UsernameParameter, _view.Username, _view.PasswordParameter, _view.Password); if (_conn.Open() == FdoConnectionState.Pending) { List<DataStoreInfo> datastores = new List<DataStoreInfo>(); var cmds = _conn.Capability.GetArrayCapability(CapabilityType.FdoCapabilityType_CommandList); if (Array.IndexOf(cmds, CommandType.CommandType_ListDataStores) >= 0) { using (var svc = _conn.CreateFeatureService()) { var stores = svc.ListDataStores(false); foreach (var store in stores) { var ds = new DataStoreInfo( store.Name, store.Name + ((store.IsFdoEnabled) ? "" : " (*)"), store.IsFdoEnabled); datastores.Add(ds); } } } else { var prop = _conn.GetConnectTimeProperty(_view.DataStoreParameter) as EnumerableDictionaryProperty; if (prop != null) { foreach (string name in prop.Values) { datastores.Add(new DataStoreInfo(name, name, true)); } } } SetDataStore(datastores.ToArray()); } } catch (Exception ex) { _view.ShowError(ex.Message); } }