/// <summary> /// Add a new statistics group. Access the created group using the StatGroups["groupName"] property. /// </summary> /// <param name="groupName"></param> void AddStat(string statName, int index) { GenericStatisticsClass grp = new GenericStatisticsClass(this, statName); StatsHashTableGetGroupByName.Add(statName, grp); StatsHashTableGetIndexByName.Add(statName, index); }
// STEP 4 - add indexer check for the new enum /// <summary> /// Allow access to the individual statistics objects via an indexer to the HealthStatistics class /// </summary> /// <param name="key"></param> /// <returns></returns> public GenericStatisticsClass this[int index] { get { string key = null; if (index < 100) { key = Enum.GetName(typeof(LPR), index); } else if (index < 200) { key = Enum.GetName(typeof(PHYSICAL_CHANNELS), index); } else if (index < 300) { key = Enum.GetName(typeof(FRAME_GENERATOR), index); } else if (index < 400) { key = Enum.GetName(typeof(MOTION_DETECTION), index); } else if (index < 500) { key = Enum.GetName(typeof(DVR), index); } else if (index < 600) { key = Enum.GetName(typeof(WatchList), index); } else if (index < 700) { key = Enum.GetName(typeof(System), index); } else if (index < 800) { key = Enum.GetName(typeof(QueueOverruns), index); } else if (index < 900) { key = Enum.GetName(typeof(LPRServiceVersionString), index); } if (StatsHashTableGetGroupByName.ContainsKey(key)) { return((GenericStatisticsClass)StatsHashTableGetGroupByName[key]); } else { return(null); } } }
/// <summary> /// Allow access to the individual statistics objects via an indexer to the HealthStatistics class /// </summary> /// <param name="key"></param> /// <returns></returns> public GenericStatisticsClass this[string name] { get { if (StatsHashTableGetGroupByName.ContainsKey(name)) { return((GenericStatisticsClass)StatsHashTableGetGroupByName[name]); } else { return(null); } } }