private bool GetNbConfigs() { try { List<string> nbInstances = (List<string>)Hierarchy.LevelNames2(@"global", "NbInstance"); log.InfoFormat("Obtained {0} NetBroker configs from central config hierarchy.", nbInstances.Count); XmlDocument xdoc = new XmlDocument(); XmlNode nodeConfig = null; //tsNetBrokers.DropDownItems.Clear(); //Application.DoEvents(); //lock (tsNetBrokers) //{ foreach (string nbInstance in nbInstances) { if (nbInstance.ToUpper().Contains("_SERVER")) continue; if (Entitlements.Contains(nbInstance)==false && UserRole.Equals(Role.USER)) continue; string s = String.Empty; Hierarchy.TryGetValueAtLevel2<string>(@"global", "NbInstance", nbInstance, out s); try { xdoc.LoadXml(s); nodeConfig = xdoc.SelectSingleNode("NetBroker"); NB.Configuration.Config nbc = new NB.Configuration.Config(nodeConfig); nbConfigs.Add(nbInstance, nbc); //BrokerConnection.InstanceOf().BrokerConfigs[nbInstance] = nbc; //if (tsNetBrokers.DropDownItems.ContainsKey(nbInstance) == false) // tsNetBrokers.DropDownItems.Add(nbInstance); } catch (Exception ex) { log.Warn(ex); return false; } //} } } catch (Exception ex) { log.Error(ex); return false; } return true; }
private static void GetNbConfigs() { try { List<string> nbInstances = (List<string>)ConfigUtils.GlobalConfig.Hierarchy.LevelNames2(@"global", "NbInstance"); log.InfoFormat("Obtained {0} NetBroker configs from central config hierarchy.", nbInstances.Count); XmlDocument xdoc = new XmlDocument(); XmlNode nodeConfig = null; foreach (string nbInstance in nbInstances) { if (nbInstance.ToUpper().Contains("_SERVER")) continue; string s = String.Empty; ConfigUtils.GlobalConfig.Hierarchy.TryGetValueAtLevel2<string>(@"global", "NbInstance", nbInstance, out s); try { xdoc.LoadXml(s); nodeConfig = xdoc.SelectSingleNode("NetBroker"); nbConfigs[nbInstance] = new NB.Configuration.Config(nodeConfig); } catch (Exception ex) { log.Warn(ex); } } } catch (Exception ex) { log.Error(ex); } }