private CDataUpload() { string szAliAddress = CINIFile.IniReadValue("基本信息", "FTP_IP", AppDomain.CurrentDomain.BaseDirectory + "base.ini"); if (!string.IsNullOrEmpty(szAliAddress)) { m_pAliyunAddress = szAliAddress; } string szMtupAddress = CINIFile.IniReadValue("基本信息", "MTUP_IP", AppDomain.CurrentDomain.BaseDirectory + "base.ini"); if (!string.IsNullOrEmpty(szMtupAddress)) { m_pMtupAddress = szMtupAddress; } string szMobileId = CINIFile.IniReadValue("基本信息", "MTUP标识", AppDomain.CurrentDomain.BaseDirectory + "base.ini"); if (!string.IsNullOrEmpty(szMobileId)) { m_pMoblieID = szMobileId; } m_pMoblieID = Convert.ToString(int.Parse(m_pMoblieID), 16); m_bMobileID = HexStringToBytes(m_pMoblieID, 8); }
public int readLiftValue() { string value = "0"; value = CINIFile.IniReadValue(mSection, mKey, paths.liftPath); return(int.Parse(value)); }
private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { foreach (ASiteObj obj in m_pSiteObjList) { obj.StopRTUdaemon(); } m_pSiteObserver.EndTimer(); CAlarmSound.getInstance().Dispose(); if (m_pInitCtrlThread != null) { if (m_pInitCtrlThread.IsAlive) { m_pInitCtrlThread.Abort(); } } if (m_pInitRainMapEventThread != null) { if (m_pInitRainMapEventThread.IsAlive) { m_pInitRainMapEventThread.Abort(); } } m_pDbHelper.Dispose(); string v = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); m_pDbHelper.WriteRunLogInfoDB("exit" + v, "软件退出"); Process.GetCurrentProcess().Kill(); }
private ASiteObj InitializationComSite(siteInfo site) { ASiteObj asj = new CSiteObj(); asj.SiteID = site.id; asj.SiteKM = site.km; asj.SectionID = site.section_id; asj.Type = "comm"; // aliyun_daemon.getInstance().QueueName = asj.SiteID; //m_pDefaultKM = asj.SiteKM; string comX = CINIFile.IniReadValue("基本信息", "串口编号", paths.baseInfoPath); if (string.IsNullOrEmpty(comX)) { MessageBox.Show("没有找到串口配置信息,如有问题请联系我们!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { comm_daemon.getInstance().Initialize(comX, this.Handle.ToInt32()); comm_daemon.getInstance().receviedNewClickEvent += new rainfalls.DataSource.Comm.OnReceviedNewClickEvent(asj.ReceviedData); } return(asj); }
public override void readCurLevel() { string szLevel = CINIFile.IniReadValue(SiteSection, workAreaCls.siteCurLevel, paths.levels); int l; m_nLevel = int.TryParse(szLevel, out l) ? l : 0; }
void Sysinfo() { txtSysInfo.Text = "系统版本:" + CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); txtDeviceID.Text = "更新时间:" + CINIFile.IniReadValue("基本信息", "更新时间", paths.baseInfoPath); //txtDeviceID.Text = "更新标识:" + CINIFile.IniReadValue("基本信息", "更新标识", paths.baseInfoPath); //txtMtup.Text = "MTUP:" + CINIFile.IniReadValue("基本信息", "MTUP标识", paths.baseInfoPath); }
private void frmMain_Load(object sender, EventArgs e) { m_pUpLoad = CDataUpload.getInstance(); IniHelper.IniWriteValue("System", paths.MainHandle, this.Handle.ToInt32().ToString(), paths.HandlePath); string ip = CINIFile.IniReadValue("基本信息", "MTUP_IP", paths.baseInfoPath); //SQLite操作对象 m_pDbHelper = rainfallsDBHelper.getInstance(new SQLiteDbHelper(), m_pUpLoad); //报警算法 m_pDbHelper.InitQueueR(); InitializationRainfalls(); m_pInitCtrlThread = new Thread(new ThreadStart(InitializeCtrl)); m_pInitCtrlThread.Start(); //InitSiteCtrlThread = new Thread(new ThreadStart(initializeSiteObj)); //InitSiteCtrlThread.Start(); m_pInitRainMapEventThread = new Thread(new ThreadStart(UnicomInterface)); m_pInitRainMapEventThread.Start(); NetWorkCls.onNotify += new Notity(NetWorkCls_onNotify); // System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(timer_Elapsed), null, 0, 1000); Thread NetWorkThread = new Thread(new ThreadStart(timer_Elapsed)); NetWorkThread.Start(); Sysinfo(); }
private void frmMain_Load(object sender, EventArgs e) { IniHelper.IniWriteValue("System", paths.MainHandle, this.Handle.ToInt32().ToString(), paths.HandlePath); /* xp系统 * */ //string pVerson = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //MessageBox.Show(pVerson); InspectorsLab.getInstance().DbHelper = m_pDbHelper; InspectorsLab.getInstance().ReadInSpectorRecords(); m_pRainfallsToolbar.DbHelper = m_pDbHelper; m_pRainfallsToolbar.SiteRainCalc = m_pSiteRainCalc; this.m_pDockPanel.DocumentStyle = DocumentStyle.DockingMdi; if (System.IO.File.Exists(paths.LayoutPath)) { this.m_pDockPanel.LoadFromXml(paths.LayoutPath, m_pDDC); } else { NewLayout(); } FormUnicomm(); string v = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); m_pDbHelper.WriteRunLogInfoDB("start" + v, "软件启动"); CSoftInfo.getInstance().SetDefaultSiteName(m_pDefaultSiteName); m_bIsLoaded = true; }
private void Form1_Load(object sender, EventArgs e) { KillRainfallProcess(); string comX = CINIFile.IniReadValue("基本信息", "串口编号", paths.baseInfoPath); Initialize(comX); FlushClientEvent += new FlushClient(Form1_FlushClientEvent); }
protected override void WndProc(ref Message m) { switch (m.Msg) { case CMessage.WM_ONMODIFY_PERSON: lbName.Text = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); break; } base.WndProc(ref m); }
private void Initialize() { workAreaInfo.site_id = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteId, paths.workAreaPath); workAreaInfo.site_name = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteName, paths.workAreaPath); workAreaInfo.site_km = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteKm, paths.workAreaPath); workAreaInfo.site_qj = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteQj, paths.workAreaPath); workAreaInfo.siteDev_Id = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteDevId, paths.workAreaPath); workAreaInfo.siteMtup_Id = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteMtupId, paths.workAreaPath); workAreaInfo.webServiceAddress = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.webServiceAddress, paths.workAreaPath); workAreaInfo.siteCurLevel = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.siteCurLevel, paths.workAreaPath); workAreaInfo.xianBie = CINIFile.IniReadValue(workAreaCls.section, workAreaCls.xianBie, paths.workAreaPath); }
private void frmUserInfo_Load(object sender, EventArgs e) { lbVersion.Text = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); lbUpdateTime.Text = CINIFile.IniReadValue("基本信息", "更新时间", paths.baseInfoPath); lbUpdateID.Text = CINIFile.IniReadValue("基本信息", "更新标识", paths.baseInfoPath); lbMtup.Text = CINIFile.IniReadValue("基本信息", "MTUP标识", paths.baseInfoPath); string pCruPerson = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); m_pCurPerson = string.IsNullOrEmpty(pCruPerson) ? "" : pCruPerson; GetPerson(); FillPerson(); AnimateWindow(this.Handle, 500, AW_BLEND | AW_ACTIVE); }
public void SetLogInfo(LEVELINFO lip) { m_pLevelInfo = lip; /* * r.typelevel >> 16, r.typelevel & 0xffff */ string reason = null; CWorksDoneReg.GetWorksReason(m_pLevelInfo.t1, m_pLevelInfo.t2, m_pLevelInfo.delta, m_pLevelInfo.tag, m_pLevelInfo.level, ref reason, m_pLevelInfo.hValue); this.labReason.Text = reason; CWorksDoneReg.GetWorksDone(m_pLevelInfo.level, ref reason); this.labShould.Text = reason; if (m_pLevelInfo.level == 1) { string _pGqInfos = CINIFile.IniReadValue(m_pSectonObj.ID, "出巡工区", paths.GqInfos); this.labShould.Text = "通知" + _pGqInfos + "," + reason; } //m_pSMS.siteId = m_pLevelInfo.site_id; //m_pSMS.km = m_pSectonObj.ID;//将区间ID //m_pSMS.tm1 = m_pLevelInfo.t1; //m_pSMS.tm2 = m_pLevelInfo.t2; //m_pSMS.value = m_pLevelInfo.delta; //m_pSMS.typelevel = (m_pLevelInfo.tag << 16) | m_pLevelInfo.level; m_pWorksDoneLog.siteId = lip.site_id; m_pWorksDoneLog.tm1 = m_pLevelInfo.t1; m_pWorksDoneLog.tm2 = m_pLevelInfo.t2; m_pWorksDoneLog.value = m_pLevelInfo.delta; m_pWorksDoneLog.typelevel = (m_pLevelInfo.tag << 16) | m_pLevelInfo.level; m_pWorksDoneLog.hourValue = m_pLevelInfo.hValue; m_nLevel = m_pLevelInfo.level; this.m_pLbOKHandle.Text = m_pWarns[m_nLevel - 1]; m_nLevel = m_pLevelInfo.level; this.lbTimeCaption.Text = m_pWarnTypes[m_nLevel - 1]; this.lbCaption.Text = string.Format("{0}[{1}]", m_pSectonObj.XingBieName, m_pSectonObj.SectionName); this.lbTime.Text = DateTime.Now.ToString(); lbName.Text = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); m_pWorksDoneLog.name = string.Format("{0},{1}", lbName.Text, m_pSectonObj.SectionName); m_nShowTime++; m_pRainfallsDbHelper.WriteRunLogInfoDB(m_pSectonObj.SectionName + "报警=" + m_pSectonObj.SectionName, m_pSectonObj.SectionName + "开始报警:警戒级别=" + lip.level.ToString()); m_soundPlay.AppendSoundAcc(); }
void UnicomInterface() { mEvent.WaitOne(); #region 雨量图 m_pRainfallsMap = new RainMapCtr(m_pSiteRainCalc); m_pRainfallsMap.ToolBarControl = m_pRainfallsToolbar; m_pRainfallsMap.SiteObjList = m_pSiteObjList; m_pRainfallsMap.SiteControl = (ISiteControl)m_pSiteControl; addCtrl(m_pRainfallsMap, DockStyle.Fill); m_pSiteObserver.RainMapObj = m_pRainfallsMap; m_pSiteControl.RainMapObj = m_pRainfallsMap; m_pSiteControl.RainMapCaptionObj = m_pRainfallsCaption; m_pRainfallsCaption.RainMapObj = m_pRainfallsMap; m_pRainfallsCaption.DrawRainMapCaption(); #endregion string v = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); m_pDbHelper.WriteRunLogInfoDB("start" + v, "软件启动"); }
private void SaveLogInfo() { SaveDataNotify("[正在保存报警数据...]"); m_pRainfallsDbHelper.WriteWorksDoneLog(m_pWorksDoneLog); if (m_pLevelInfo.level == 1 && m_pLevelInfo.liftValue == 0) { m_pLevelInfo.liftValue = 2; } _RFLog rlog = new _RFLog(); rlog.uuid = System.Guid.NewGuid().ToString("N"); rlog.section_id = m_pSectonObj.ID; rlog.site_id = m_pLevelInfo.site_id; rlog.logtime = Time.DateTime2DbTime(System.DateTime.Now); string startTime = this.lbTime.Text; DateTime dt = DateTime.Parse(startTime); rlog.tm1 = Time.DateTime2DbTime(dt); rlog.note = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); rlog.lift_time = m_pLevelInfo.liftTime.ToString(); rlog.lift_value = m_pLevelInfo.liftValue.ToString(); rlog.level = m_pLevelInfo.level.ToString(); m_pRainfallsDbHelper.WriteRFlog(rlog); _SMS sms = new _SMS(); sms.siteId = m_pLevelInfo.site_id; sms.railLine = rlog.note; sms.km = m_pSectonObj.ID; sms.tm1 = m_pLevelInfo.t1; sms.tm2 = m_pLevelInfo.t2; sms.value = m_pLevelInfo.delta; sms.typelevel = m_pWorksDoneLog.typelevel; sms.hourValue = m_pLevelInfo.hValue; m_pRainfallsDbHelper.WriteSms(sms, m_pLevelInfo); m_pSectonObj.SaveLevelInfo(m_pLevelInfo); InspectorsLab.getInstance().AddNewInspectorTaskAlarm(m_pLevelInfo.level); }
private void UITrackOpenNofityControl_Load(object sender, EventArgs e) { IniHelper.IniWriteValue("System", paths.PersonHandle, this.Handle.ToInt32().ToString(), paths.HandlePath); string person = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); if (string.IsNullOrEmpty(person)) { string szHandle = IniHelper.IniReadValue("System", paths.MainHandle, paths.HandlePath); if (szHandle.Length > 0) { int nHandle = int.Parse(szHandle); IntPtr pHandle = new IntPtr(nHandle); CWinMsgAPI.PostMessage(pHandle, CMessage.WM_ONADD_PERSON, 0, 0); } } else { lbName.Text = person; } }
void GetParams() { try { string szPath = Application.StartupPath + "\\RainMapConfig.ini"; m_nOneHourWidth = int.Parse(CINIFile.IniReadValue("RainMapParams", "OneHourWidth", szPath)); m_nOneMmRainHeight = int.Parse(CINIFile.IniReadValue("RainMapParams", "OneMmRainHeight", szPath)); m_nHMarigineLeft = int.Parse(CINIFile.IniReadValue("RainMapParams", "HMarigineLeft", szPath)); m_nHMarigineRight = int.Parse(CINIFile.IniReadValue("RainMapParams", "HMarigineRight", szPath)); m_nVMarigineTop = int.Parse(CINIFile.IniReadValue("RainMapParams", "VMarigineTop", szPath)); m_nVMarigineBottom = int.Parse(CINIFile.IniReadValue("RainMapParams", "VMarigineBottom", szPath)); m_fPenWidth = float.Parse(CINIFile.IniReadValue("RainMapParams", "PenWidth", szPath)); m_fRainPenWidth = float.Parse(CINIFile.IniReadValue("RainMapParams", "RainPenWidth", szPath)); m_fAxisFontSize = float.Parse(CINIFile.IniReadValue("RainMapParams", "AxisFontSize", szPath)); m_fCaptionFontSize = float.Parse(CINIFile.IniReadValue("RainMapParams", "CaptionFontSize", szPath)); } catch { // CLog.LOG("Exception occur in GetParams()"); } }
private void WriteWorksDoneLog(_autoLiftLevelInfo autoLevelInfo) { /* * r.typelevel >> 16, r.typelevel & 0xffff */ string reason = null; CWorksDoneReg.GetWorksReason(autoLevelInfo.t1, autoLevelInfo.t2, autoLevelInfo.value, TagType.tag_open, autoLevelInfo.level, ref reason, 0); this.labReason.Text = reason; CWorksDoneReg.GetWorksDone(autoLevelInfo.level, ref reason); this.lbTime.Text = reason; this.lbSectionName.Text = autoLevelInfo.secName; log.siteId = autoLevelInfo.siteid; log.tm1 = autoLevelInfo.t1; log.tm2 = autoLevelInfo.t2; log.value = autoLevelInfo.value; log.typelevel = (TagType.tag_open << 16) | autoLevelInfo.level; log.hourValue = 0; log.name = string.Format("{0},{1}", CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath), m_pSectonObj.SectionName); m_dbHelper.WriteRunLogInfoDB(autoLevelInfo.secName + "解除=" + autoLevelInfo.level.ToString(), autoLevelInfo.secName + "解除警戒:警戒级别=" + autoLevelInfo.level.ToString()); m_dbHelper.WriteWorksDoneLog(log); }
private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { try { foreach (ASiteObj obj in m_pSiteObjList) { obj.StopRTUdaemon(); } m_pSiteObserver.EndTimer(); CAlarmSound.getInstance().Dispose(); m_pDbHelper.Dispose(); string v = CINIFile.IniReadValue("基本信息", "软件版本", paths.baseInfoPath); m_pDbHelper.WriteRunLogInfoDB("exit" + v, "软件退出"); Process.GetCurrentProcess().Kill(); } catch (Exception err) { throw new Exception(string.Format("{0}:{1}:{2}:{3}", err.Message, err.Source, err.InnerException, err.Data)); } }
public override void doGetLiftDefValue() { int n; string szLiftSpeedValue = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szLiftSpeedValue, paths.rtuSitePath); m_nLiftSpeedValue = int.TryParse(szLiftSpeedValue, out n) ? n : 0; string szBreakOpenValue = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szBreakOpenValue, paths.rtuSitePath); m_nBreakOpenValue = int.TryParse(szBreakOpenValue, out n) ? n : 0; long t; string szLiftSpeedTime = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szLiftSpeedTime, paths.rtuSitePath); m_lgLiftSpeedTime = long.TryParse(szLiftSpeedTime, out t) ? t : 0; string szBreakOpenTime = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szBreakOpenTime, paths.rtuSitePath); m_lgBreakOpenTime = long.TryParse(szBreakOpenTime, out t) ? t : 0; string szContStartTime = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szContRainStartTime, paths.rtuSitePath); m_lgContRainStartTime = long.TryParse(szContStartTime, out t) ? t : 0; string szDayStartTime = CINIFile.IniReadValue(m_szSiteId, liftCls.m_szDayRainStartTime, paths.rtuSitePath); m_lgDayRainStartTime = long.TryParse(szDayStartTime, out t) ? t : 0; }
private void ObjectInitialze() { m_pUpLoad = CDataUpload.getInstance(); m_pUpLoad.SetCommSiteID(CINIFile.IniReadValue("基本信息", "MTUP标识", paths.baseInfoPath)); m_pDbHelper = rainfallsDBHelper.getInstance(new SQLiteDbHelper(), m_pUpLoad); }
private void rainfallsToolBar_Load(object sender, EventArgs e) { string pCruPerson = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); lbPerson.Text = string.Format("值班负责人:{0}", string.IsNullOrEmpty(pCruPerson) ? "" : pCruPerson); }
private void m_pLbOKHandle_Click(object sender, EventArgs e) { //if (m_nMaxLvl < 2) //{ // m_soundPlay.RemoveSoundAcc(m_nShowTime); m_nShowTime = 0; // this.Shown = false; // if (OnShowHiddenEvent != null) // OnShowHiddenEvent(); // //解除完了之后是否要记录一下出巡解除时的雨量值; // m_pSectonObj.UpdataLevel(1, 0, m_pLiftLevelInfo.siteid); // return; //} //long t = Time.DateTime2DbTime(DateTime.Now); //for (int i = 0; i < m_nRecords; i++) //{ // if (m_pRFLog[i].brk_close > 0) // { // m_pRFLog[i].brk_open = t; // m_dbHelper.UpDateRFlogDb(t, m_pRFLog[i].logtime, 5, m_pRFLog[i].site_id, m_pRFLog[i]); // _SMS sms = new _SMS(); // sms.siteId = m_pRFLog[i].site_id; // sms.typelevel = (TagType.tag_open << 16) | 5; // sms.tm1 = t; // sms.tm2 = 0; // sms.railLine = m_pRFLog[i].railLine; // sms.km = m_pSectonObj.ID; // sms.value = long.Parse(m_pRFLog[i].lift_value); // m_dbHelper.WriteSms(sms); // m_dbHelper.WriteRunLogInfoDB(sms.km + "解除3级警戒", sms.km + "解除3级警戒"); // //解除完了之后是否要记录一下,报警站点的解除时间,解除时的雨量 // m_pSectonObj.UpdataLevel(3, 1, m_pLiftLevelInfo.siteid); // } // else if (m_pRFLog[i].limit_start > 0) // { // m_pRFLog[i].limit_restore = t; // m_dbHelper.UpDateRFlogDb(t, m_pRFLog[i].logtime, 4, m_pRFLog[i].site_id, m_pRFLog[i]); // if (2 == m_nMaxLvl) // { // _SMS sms = new _SMS(); // sms.siteId = m_pRFLog[i].site_id; // sms.typelevel = (TagType.tag_open << 16) | 4; // sms.railLine = m_pRFLog[i].railLine; // sms.km = m_pSectonObj.ID; // sms.tm1 = m_pLiftLevelInfo.t1; // sms.tm2 = m_pLiftLevelInfo.t2; // sms.value = m_pLiftLevelInfo.value; // m_dbHelper.WriteSms(sms); // m_dbHelper.WriteRunLogInfoDB(sms.km + "解除2级警戒", sms.km + "解除2级警戒"); // m_pSectonObj.UpdataLevel(2, 1, m_pLiftLevelInfo.siteid); // } // //解除完了之后是否要记录一下,报警站点的解除时间,解除时的雨量 // } //} long t = Time.DateTime2DbTime(DateTime.Now); rlog.tm2 = t; m_dbHelper.UpDateRFlogDb(rlog); _SMS sms = new _SMS(); sms.siteId = rlog.site_id; sms.typelevel = log.typelevel; sms.km = m_pSectonObj.ID; sms.tm1 = m_pLiftLevelInfo.t1; sms.tm2 = m_pLiftLevelInfo.t2; sms.value = m_pLiftLevelInfo.value; sms.railLine = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath); m_dbHelper.WriteSms(sms); m_dbHelper.WriteRunLogInfoDB(sms.km + string.Format("解除{0}级警戒", rlog.level), sms.km + string.Format("解除{0}级警戒", rlog.level)); m_pSectonObj.UpdataLevel(int.Parse(rlog.level), 0, rlog.site_id); // m_soundPlay.RemoveSoundAcc(m_nShowTime); m_nShowTime = 0; ClearValue(); this.Shown = false; if (OnShowHiddenEvent != null) { OnShowHiddenEvent(); } }