Пример #1
0
        public bool isMatched(ref TKAlarm alarm)
        {
            lock (AllFilters.SyncRoot)
            {
                if (AllFilters.Count == 0)
                {
                    return(true);
                }

                if (AllFilters.Count == 1)
                {
                    FilterEx f = (FilterEx)AllFilters[AllFilters.GetKey(0)];
                    m_filterAllSee = f;
                    return(f.isMatched(ref alarm));
                }

                bool bMatched = false;
                foreach (DictionaryEntry de in AllFilters)
                {
                    bMatched = ((FilterEx)AllFilters[de.Key]).isMatched(ref alarm);
                    if (bMatched)
                    {
                        return(true);
                    }
                }
            }

            return(false);            // 不能直接返回false,可能未做任何比较
        }
Пример #2
0
 public void addFilter(FilterEx filter)
 {
     lock (m_FilterGroup.SyncRoot)
     {
         this.m_FilterGroup.Add(filter.Name, filter);
     }
 }
Пример #3
0
 // 改变自定义过滤器中的过滤器
 public void changeFilter(FilterEx filter)
 {
     if (this.m_FilterGroup.Contains(filter.Name))
     {
         lock (m_FilterGroup.SyncRoot)
         {
             this.m_FilterGroup.Remove(filter.Name);
             this.m_FilterGroup.Add(filter.Name, filter);
         }
     }
 }
Пример #4
0
        public void loadFilters(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                FilterEx filter = new FilterEx(dr["id"].ToString());
                filter.BSCes        = Utilities.ConvertString2StrArr(dr["ne_name"].ToString());
                filter.Redefinition = Utilities.ConvertString2StrArr(dr["redefinition"].ToString());
                filter.Categories   = Utilities.ConvertString2StrArr("");
                filter.StartTime    = DateTime.Parse(dr["start_time"].ToString());
                filter.EndTime      = DateTime.Parse(dr["end_time"].ToString());
                filter.AddInfo      = dr["report_msg"].ToString();

                addFilter(filter);
            }
        }