private void InitializationSiteList() { siteInfo comm_site = CRainfallXmlHelper.getInstance().GetCommSiteInfo(); ASiteObj obj = InitializationComSite(comm_site); obj.DbHelper = m_pDbHelper; obj.InitializeComponent(); m_pSiteObjList.Add(obj); obj.SiteName = CRainfallXmlHelper.getInstance().siteName + "(" + obj.SiteKM + ")"; obj.SiteObserver = m_pSiteObserver; AddSiteObjToSectinObj(obj); List <siteInfo> psslist = CRainfallXmlHelper.getInstance().GetRTUSiteInfo(); foreach (siteInfo si in psslist) { ASiteObj asj = new CSiteObj(); asj.SiteID = si.id; asj.SiteKM = si.km; asj.SectionID = si.section_id; asj.Type = "ssl"; asj.DbHelper = m_pDbHelper; asj.InitializeComponent(); asj.SiteName = CRainfallXmlHelper.getInstance().siteName + "(" + si.km + ")"; asj.SiteObserver = m_pSiteObserver; asj.RTUdaemon = new rtu_daemon(); m_pSiteObjList.Add(asj); AddSiteObjToSectinObj(asj); } }
private void InitializationSiteList() { #region 添加本地Comm采集对象 siteInfo comm_site = CRainfallXmlHelper.getInstance().GetCommSiteInfo(); if (!string.IsNullOrEmpty(comm_site.id)) { ASiteObj obj = InitializationComSite(comm_site); obj.DbHelper = m_pDbHelper; obj.InitializeComponent(); m_pSiteObjList.Add(obj); obj.SiteName = string.Format("{0}", obj.SiteKM); obj.SiteObserver = m_pSiteObserver; AddSiteObjToSectinObj(obj); m_pDefaultSiteName = obj.SiteName; } #endregion List <siteInfo> psslist = CRainfallXmlHelper.getInstance().GetRTUSiteInfo(); foreach (siteInfo si in psslist) { ASiteObj asj = new CSiteObj(); asj.SiteID = si.id; asj.SiteKM = si.km; asj.SectionID = si.section_id; asj.Type = "ssl"; asj.DbHelper = m_pDbHelper; asj.InitializeComponent(); asj.SiteName = string.Format("{0}", si.km); asj.SiteObserver = m_pSiteObserver; asj.RTUdaemon = new rtu_daemon(); // aliyun_daemon.getInstance().AddRTUObj(asj); bool bIsExist = false; foreach (ASiteObj ObjExist in m_pSiteObjList) { if (ObjExist.SiteID.Equals(asj.SiteID)) { bIsExist = true; AddSiteObjTosectionObj(ObjExist, asj.SectionID); break; } } if (!bIsExist) { m_pSiteObjList.Add(asj); AddSiteObjToSectinObj(asj); } } }