123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using System.IO;
- namespace FPER
- {
- public partial class frmWarningBox : Form// 경고 창 클래스
- {
- MDIParent parent;
- bool chkDetailViewMode = false;
- // cyim 2015.7.6 속도개선작업
- Hashtable eventLogInfos; //ArrayList eventLogInfos;
- delegate void deleFormInit();
- public bool faultmode = false;
- private string strImagePathCommConnect = "경고창_통신에러_이미지.gif"; //통신에러
- private string strImagePathFireOn = "경고창_화재_이미지.gif"; //화재
- private string strImagePathWriteOn = "경고창_설비_이미지.gif"; //설비가동
- private string strImagePathFaultOn = "경고창_FAULT_이미지.gif"; //에러
- private string strImagePathAccumul = "경고창_축적화재_이미지.gif"; //축적
- private string strImagePathPhoneOn = "경고창_전화_이미지.gif"; //전화
- private string strImagePathFireRecover = "경고창_화재복구_이미지.gif"; //화재복구
- private string ImagePathCommConnect { get { return Path.Combine(this.ImgBasePath, this.strImagePathCommConnect); } }
- private void ImageLoadingCommConnect()
- {
- Image img = ImgLoad(this.ImagePathCommConnect);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathFireOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathFireOn); } }
- private void ImageLoadingFireOn()
- {
- Image img = ImgLoad(this.ImagePathFireOn);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathWriteOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathWriteOn); } }
- private void ImageLoadingWriteOn()
- {
- Image img = ImgLoad(this.ImagePathWriteOn);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathFaultOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathFaultOn); } }
- private void ImageLoadingFaultOn()
- {
- Image img = ImgLoad(this.ImagePathFaultOn);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathAccumul { get { return Path.Combine(this.ImgBasePath, this.strImagePathAccumul); } }
- private void ImageLoadingAccumul()
- {
- Image img = ImgLoad(this.ImagePathAccumul);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathPhoneOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathPhoneOn); } }
- private void ImageLoadingPhoneOn()
- {
- Image img = ImgLoad(this.ImagePathPhoneOn);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string ImagePathFireRecover { get { return Path.Combine(this.ImgBasePath, this.strImagePathFireRecover); } }
- private void ImageLoadingFireRecover()
- {
- Image img = ImgLoad(this.ImagePathFireRecover);
- if (img != null)
- {
- this.picTitle.Image = img;
- }
- }
- private string strImgBasePath = "image";
- private string ImgBasePath { get { return Path.Combine(Directory.GetCurrentDirectory(), this.strImgBasePath); } }
- private string strImagePathBackground = "경고창_폼배경.gif";
- private string ImagePathBackground { get { return Path.Combine(this.ImgBasePath, this.strImagePathBackground); } }
- private Image ImgLoad(string path)
- {
- Image ret = null;
- try
- {
- ret = Image.FromFile(path);
- }
- catch (Exception e)
- {
- Util.UErrorMessage(e, 0, 0);
- }
- return ret;
- }
- private void ImageLoadingBackground()
- {
- Image img = ImgLoad(this.ImagePathBackground);
- if (img != null)
- {
- this.BackgroundImage = img;
- }
- }
- /**********************************************/
- /* 화면 경고 표시 아이콘 이미지리스트 */
- /**********************************************/
- const int cstCommConnectImageIdx = 0; //통신에러
- const int cstFireOnImageIdx = 1; //화재
- const int cstWriteOnImageIdx = 2; //설비가동
- const int cstFaultOnImageIdx = 3; //에러
- const int cstAccumulImageIdx = 4; //축적
- const int cstPhoneOnImageIdx = 5; //전화
- const int cstFireRecoverImageIdx = 6; //화재복구
- /**********************************************/
- //화면이동을 위해---------------
- private Boolean WindowsMove = true;
- private Point mouseOffset;
- //--------------------------------------------------------
- public frmWarningBox()
- {
- InitializeComponent();
- }
- public void Form_Init()
- {
- try
- {
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- private void frmWarningBox_Load(object sender, EventArgs e)
- {
- try
- {
- //dataGridView1.Rows.Clear();
- this.ImageLoadingBackground();
- this.Size = new Size(583, 234);
- this.Show();
- // cyim 2013.8.5 팝업창 종료 막음 : 안보이도록 함
- this.btnClose.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //각메세지별 우선순위를 판별한다..
- public void setMessage(MappingStatus sta, string message, string deviceMessage)
- {
- try
- {
- MappingStatus dispStatus = sta;
- string dispMessage = message;
- string dispDeviceMessage = deviceMessage;
- //화면 표시 우선순위를 판별한다..
- EventLogInfo sEventLogMsg = null;
- //이벤트 로그
- this.eventLogInfos = parent.AryEventLogs;
- // cyim 2015.7.6 속도개선작업
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- if (this.eventLogInfos != null && this.eventLogInfos.Count != 0)
- {
- int eventLogCnt = this.eventLogInfos.Count;
- if (eventLogCnt > 0)
- {
- // 해쉬테이블 키 추출
- string[] tmp_keys = new string[eventLogInfos.Keys.Count];
- this.eventLogInfos.Keys.CopyTo(tmp_keys, 0);
- sEventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[tmp_keys.Length - 1]];
- //sEventLogMsg = (EventLogInfo)this.eventLogInfos[eventLogCnt - 1]; //최종 메세지를 저장한다..
- for (int i = tmp_keys.Length - 1; i >= 0; i--)
- //for (int i = eventLogCnt - 1; i > -1; i--)
- {
- EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
- //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
- if (eventLogMsg.LiveMsgFlag)
- {
- //둘다 Live한 메세지라면 EventStatus가 높은 메세지로 수정
- if (faultmode == true)
- {
- if (eventLogMsg.EventStatus == MappingStatus.FaultOn ||
- eventLogMsg.EventStatus == MappingStatus.FaultOff
- )
- {
- if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
- {
- sEventLogMsg = eventLogMsg;
- //이전메세지가 Live가 아니라면 표시메세지 수정
- if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
- {
- sEventLogMsg = eventLogMsg;
- }
- }
- }
- }
- else
- {
- if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
- {
- sEventLogMsg = eventLogMsg;
- //이전메세지가 Live가 아니라면 표시메세지 수정
- if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
- {
- sEventLogMsg = eventLogMsg;
- }
- }
- }
- }
- }
- dispStatus = sEventLogMsg.EventStatus;
- dispMessage = sEventLogMsg.Message;
- dispDeviceMessage = sEventLogMsg.DeviceMessage;
- }
- }
- //if (dispDeviceMessage != null)
- // this.txtWarningMessage.Text = string.Format("{0} 위치:{1}", dispMessage, dispDeviceMessage);
- //else
- if (dispStatus == MappingStatus.FireOn || dispStatus == MappingStatus.FireOff)
- {
- this.lblTitle.ForeColor = Color.Red;
- }
- else if (dispStatus == MappingStatus.WriteOn || dispStatus == MappingStatus.WriteOff)
- {
- this.lblTitle.ForeColor = Color.Blue;
- }
- else
- {
- this.lblTitle.ForeColor = Color.Black;
- }
- this.lblTitle.Text = StaTitleMsg(dispStatus);
- //this.txtWarningMessage.Text = string.Format("{0} 위치:{1}", dispMessage, dispDeviceMessage);
- this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
- //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
- this.SetPicImage(dispStatus);
- //
- int ListTotalCnt = 10;
- if (dataGridView1.Rows.Count > ListTotalCnt)
- {
- int listRows = dataGridView1.Rows.Count;
- for (int i = ListTotalCnt; i < listRows; i++)
- dataGridView1.Rows.RemoveAt(i);
- }
- string msg = message.Replace("\n", " ");
- dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
- msg, deviceMessage);
- SetToggleColor();//2010.10.29,k.s.d, alram popup color toggle value set.
- timer_color_Tick(null, EventArgs.Empty);//2010.10.29,k.s.d, alram popup color toggle timer.
- timer_color.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- public void setMessage2(MappingStatus sta, string message, string deviceMessage)
- {
- try
- {
- MappingStatus dispStatus = sta;
- string dispMessage = message;
- string dispDeviceMessage = deviceMessage;
- this.lblTitle.ForeColor = Color.Black;
- this.lblTitle.Text = StaTitleMsg(dispStatus);
- this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
- //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
- this.SetPicImage(dispStatus);
- string msg = message.Replace("\n", " ");
- dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
- msg, deviceMessage);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void setMCCMessage(MappingStatus sta, string message, string deviceMessage)
- {
- try
- {
- ////Util.UDebugMessage("+setMCCMessage",0,0);
- MappingStatus dispStatus = sta;
- string dispMessage = message;
- string dispDeviceMessage = deviceMessage;
- //화면 표시 우선순위를 판별한다..
- EventLogInfo sEventLogMsg = null;
- //이벤트 로그
- this.eventLogInfos = parent.AryEventLogs;
- // cyim 2015.7.6 속도개선작업
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- if (this.eventLogInfos != null && this.eventLogInfos.Count != 0)
- {
- int eventLogCnt = this.eventLogInfos.Count;
- string[] tmp_keys = new string[eventLogInfos.Keys.Count];
- this.eventLogInfos.Keys.CopyTo(tmp_keys, 0);
- sEventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[tmp_keys.Length - 1]];
- if (eventLogCnt > 0)
- {
- for (int i = tmp_keys.Length - 1; i >= 0; i--)
- //for (int i = eventLogCnt - 1; i > -1; i--)
- {
- EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
- //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
- if (eventLogMsg.ReceiverID == parent.myReceiverID && eventLogMsg.CommId == 1 && eventLogMsg.BoardNo == 1 &&
- eventLogMsg.LoopNo == 0 && eventLogMsg.RepeaterNo == 127 && eventLogMsg.InoutType == "I" &&
- (eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "XL" || eventLogMsg.EventType == "FA" || eventLogMsg.EventType == "FN")) // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
- {
- sEventLogMsg = (EventLogInfo)eventLogMsg; //최종 메세지를 저장한다..
- ////Util.UDebugMessage(string.Format("setMCCMessage sEventLogMsg = {0}", sEventLogMsg.RepeaterNo), 0, 0);
- break;
- }
- }
- if (sEventLogMsg == null)
- {
- }
- else
- {
- for (int i = tmp_keys.Length - 1; i >= 0; i--)
- //for (int i = eventLogCnt - 1; i > -1; i--)
- {
- EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
- //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
- if (eventLogMsg.ReceiverID == parent.myReceiverID && eventLogMsg.CommId == 1 && eventLogMsg.BoardNo == 1 &&
- eventLogMsg.LoopNo == 0 && eventLogMsg.RepeaterNo == 127 && eventLogMsg.InoutType == "I" &&
- (eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "XL" || eventLogMsg.EventType == "FA" || eventLogMsg.EventType == "FN") // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
- )
- {
- if (eventLogMsg.LiveMsgFlag)
- { //둘다 Live한 메세지라면 EventStatus가 높은 메세지로 수정
- if (faultmode == true)
- {
- if (eventLogMsg.EventStatus == MappingStatus.FaultOn || eventLogMsg.EventStatus == MappingStatus.FaultOff)
- {
- if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
- {
- sEventLogMsg = eventLogMsg;
- if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
- {//이전메세지가 Live가 아니라면 표시메세지 수정
- sEventLogMsg = eventLogMsg;
- }
- }
- }
- }
- else
- {
- if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
- {
- sEventLogMsg = eventLogMsg;
- if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
- {//이전메세지가 Live가 아니라면 표시메세지 수정
- sEventLogMsg = eventLogMsg;
- }
- ////Util.UDebugMessage(string.Format("setMCCMessage sEventLogMsg = {0} :2", sEventLogMsg.RepeaterNo), 0, 0);
- }
- }
- }
- }
- }
- dispStatus = sEventLogMsg.EventStatus;
- dispMessage = sEventLogMsg.Message;
- dispDeviceMessage = sEventLogMsg.DeviceMessage;
- ////Util.UDebugMessage(string.Format("setMCCMessage dispMessage = {0} ", dispMessage), 0, 0);
- }
- }
- }
- if (dispStatus == MappingStatus.FireOn || dispStatus == MappingStatus.FireOff)
- {
- this.lblTitle.ForeColor = Color.Red;
- }
- else if (dispStatus == MappingStatus.WriteOn || dispStatus == MappingStatus.WriteOff)
- {
- this.lblTitle.ForeColor = Color.Blue;
- }
- else
- {
- this.lblTitle.ForeColor = Color.Black;
- }
- this.lblTitle.Text = StaTitleMsg(dispStatus);
- this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
- //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
- this.SetPicImage(dispStatus);
- int ListTotalCnt = 10;
- if (dataGridView1.Rows.Count > ListTotalCnt)
- {
- int listRows = dataGridView1.Rows.Count;
- for (int i = ListTotalCnt; i < listRows; i++)
- dataGridView1.Rows.RemoveAt(i);
- }
- string msg = message.Replace("\n", " ");
- dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
- msg, deviceMessage);
- SetToggleColor();//2010.10.29,k.s.d, alram popup color toggle value set.
- timer_color_Tick(null, EventArgs.Empty);//2010.10.29,k.s.d, alram popup color toggle timer.
- timer_color.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //각경고값의 상태를 레벨로 전환한다..
- private int statusLevel(MappingStatus dispStatus)
- {
- int lv = 99;
- try
- {
- lv = (int)dispStatus;//2010.10.29,k.s.d, pop up message level chnage.
- //
- // switch (dispStatus)
- // {
- // case MappingStatus.FireOn: lv = (int)dispStatus; break;
- // case MappingStatus.FireOff: lv = (int)MappingStatus.FireOn; break;
- // case MappingStatus.CommConnectError: lv = (int)dispStatus; break;
- // case MappingStatus.CommConnectNormal: lv = (int)MappingStatus.CommConnectError; break;
- // case MappingStatus.FaultOff: lv = (int)MappingStatus.FaultOn; break;
- // case MappingStatus.FaultOn: lv = (int)dispStatus; break;
- // case MappingStatus.AccumulateOff: lv = (int)MappingStatus.AccumulateOn; break;
- // case MappingStatus.AccumulateOn: lv = (int)dispStatus; break;
- // case MappingStatus.FireRecovery: lv = (int)dispStatus; break;
- // case MappingStatus.Normal: lv = (int)dispStatus; break;
- // case MappingStatus.PhoneOff: lv = (int)MappingStatus.PhoneOn; break;
- // case MappingStatus.PhoneOn: lv = (int)dispStatus; break;
- // case MappingStatus.ProgramEnd: lv = (int)MappingStatus.ProgramStart; break;
- // case MappingStatus.ProgramStart: lv = (int)dispStatus; break;
- // case MappingStatus.WriteOff: lv = (int)MappingStatus.WriteOn; break;
- // case MappingStatus.WriteOn: lv = (int)dispStatus; break;
- // }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return lv;
- }
- private string StaTitleMsg(MappingStatus dispStatus)
- {
- string tle = "";
- try
- {
- switch (dispStatus)
- {
- case MappingStatus.FireOn: tle = "화재발생"; break;
- case MappingStatus.FireOff: tle = "화재해제"; break;
- case MappingStatus.CommConnectError: tle = "통신연결에러"; break;
- case MappingStatus.CommConnectNormal: tle = "통신연결해제"; break;
- case MappingStatus.FaultOff: tle = "FAULT해제"; break;
- case MappingStatus.FaultOn: tle = "FAULT발생"; break;
- case MappingStatus.AccumulateOff: tle = "축적화재해제"; break;
- case MappingStatus.AccumulateOn: tle = "축적화재발생"; break;
- case MappingStatus.FireRecovery: tle = "화재복구"; break;
- case MappingStatus.Normal: tle = "정상"; break;
- case MappingStatus.PhoneOff: tle = "전화해제"; break;
- case MappingStatus.PhoneOn: tle = "전화연결"; break;
- case MappingStatus.ProgramEnd: tle = "프로그램종료"; break;
- case MappingStatus.ProgramStart: tle = "프로그램시작"; break;
- case MappingStatus.WriteOff: tle = "설비종료"; break;
- case MappingStatus.WriteOn: tle = "설비작동"; break;
- case MappingStatus.DemonInit: tle = "초기화 중"; break;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return tle;
- }
- //private int StaTitleImageIdx(MappingStatus dispStatus) {
- // int imageIdx = 0;
- // try {
- // switch (dispStatus) {
- // ///
- // case MappingStatus.FireOn:
- // case MappingStatus.FireOff:
- // imageIdx = cstFireOnImageIdx;
- // break;
- // case MappingStatus.CommConnectError:
- // case MappingStatus.CommConnectNormal:
- // imageIdx = cstCommConnectImageIdx;
- // break;
- // case MappingStatus.FaultOff:
- // case MappingStatus.FaultOn:
- // imageIdx = cstFaultOnImageIdx;
- // break;
- // case MappingStatus.PhoneOff:
- // case MappingStatus.PhoneOn:
- // imageIdx = cstPhoneOnImageIdx;
- // break;
- // case MappingStatus.AccumulateOff:
- // case MappingStatus.AccumulateOn:
- // imageIdx = cstAccumulImageIdx;
- // break;
- // case MappingStatus.WriteOff:
- // case MappingStatus.WriteOn:
- // imageIdx = cstWriteOnImageIdx;
- // break;
- // case MappingStatus.FireRecovery:
- // imageIdx = cstFireRecoverImageIdx;
- // break;
- // case MappingStatus.DemonInit:
- // imageIdx = cstCommConnectImageIdx;
- // break;
- // //case MappingStatus.ProgramEnd: tle = "프로그램종료"; break;
- // //case MappingStatus.ProgramStart: tle = "프로그램시작"; break;
- // //case MappingStatus.Normal: tle = "정상"; break;
- // default:
- // imageIdx = cstFaultOnImageIdx;
- // break;
- // }
- // }
- // catch (Exception ex) {
- // Util.UErrorMessage(ex, 0, 0);
- // }
- // return imageIdx;
- //}
- private void SetPicImage(MappingStatus dispStatus)
- {
- try
- {
- switch (dispStatus)
- {
- case MappingStatus.FireOn:
- case MappingStatus.FireOff: this.ImageLoadingFireOn(); break;
- case MappingStatus.CommConnectError:
- case MappingStatus.CommConnectNormal: this.ImageLoadingCommConnect(); break;
- case MappingStatus.FaultOff:
- case MappingStatus.FaultOn: this.ImageLoadingFaultOn(); break;
- case MappingStatus.PhoneOff:
- case MappingStatus.PhoneOn: this.ImageLoadingPhoneOn(); break;
- case MappingStatus.AccumulateOff:
- case MappingStatus.AccumulateOn: this.ImageLoadingAccumul(); break;
- case MappingStatus.WriteOff:
- case MappingStatus.WriteOn: this.ImageLoadingWriteOn(); break;
- case MappingStatus.FireRecovery: this.ImageLoadingFireRecover(); break;
- case MappingStatus.DemonInit: this.ImageLoadingCommConnect(); break;
- default: this.ImageLoadingFaultOn(); break;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void setParent(MDIParent parent)
- {
- try
- {
- this.parent = parent;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmWarningBox_FormClosed(object sender, FormClosedEventArgs e)
- {
- try
- {
- if (this.parent != null)
- {
- this.parent.CloseMessageForm();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmWarningBox_LostFocus(object sender, EventArgs e)
- {
- try
- {
- this.Select();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnStatusYes_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- //이력내역보기
- parent.toolStripMenuItem4_Click(null, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void lblDetailView_Click(object sender, EventArgs e)
- {
- try
- {
- if (chkDetailViewMode)
- {
- chkDetailViewMode = false;
- this.Size = new Size(583, 234);
- //lblDetailView.Text = "자세히보기>>";
- dataGridView1.Visible = false;
- }
- else
- {
- chkDetailViewMode = true;
- this.Size = new Size(583, 387);
- //lblDetailView.Text = "자세히보기닫기<<";
- dataGridView1.Visible = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnClose_Click(object sender, EventArgs e)
- {
- try
- {
- //this.Close();
- this.Hide();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- //this.Close();
- this.Hide();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /* 화면이동 */
- /********************************************************/
- private void lblWindowsMove_MouseDown(object sender, MouseEventArgs e)
- {
- try
- {
- if (WindowsMove)
- {
- mouseOffset = new Point(-(e.X + parent.Location.X), -(e.Y + 55 + parent.Location.Y));
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void lblWindowsMove_MouseMove(object sender, MouseEventArgs e)
- {
- try
- {
- if (WindowsMove && (e.Button == MouseButtons.Left))
- {
- Point mousePos = Control.MousePosition;
- mousePos.Offset(mouseOffset.X, mouseOffset.Y);
- this.Location = mousePos;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- Color ToggleColor_set = Color.Transparent;
- Color ToggleColor_reset = Color.Transparent;
- Color ToggleFontColor_set = Color.Black;
- Color ToggleFontColor_reset = Color.Black;
- private void timer_color_Tick(object sender, EventArgs e)
- {
- try
- {
- if (this.lblTitle.BackColor == this.ToggleColor_reset)
- {
- this.lblTitle.BackColor = this.ToggleColor_set;
- this.lblTitle.ForeColor = this.ToggleFontColor_set;
- }
- else
- {
- this.lblTitle.BackColor = this.ToggleColor_reset;
- this.lblTitle.ForeColor = this.ToggleFontColor_reset;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void SetToggleColor()
- {
- try
- {
- if (this.lblTitle.Text == "화재발생")
- {
- this.ToggleColor_set = Color.Red;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Red;
- }
- else if (this.lblTitle.Text == "축적화재발생")
- {
- this.ToggleColor_set = Color.Red;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Red;
- }
- else if (this.lblTitle.Text == "FAULT발생")
- {
- this.ToggleColor_set = Color.OrangeRed;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "통신연결에러")
- {
- this.ToggleColor_set = Color.OrangeRed;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "설비작동")
- {
- this.ToggleColor_set = Color.Blue;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.White;
- this.ToggleFontColor_reset = Color.Blue;
- }
- else if (this.lblTitle.Text == "전화연결")
- {
- this.ToggleColor_set = Color.Blue;
- this.ToggleColor_reset = Color.Transparent;
- this.ToggleFontColor_set = Color.White;
- this.ToggleFontColor_reset = Color.Blue;
- }
- else if (this.lblTitle.Text == "화재해제")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "축적화재해제")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "화재복구")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "FAULT해제")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "통신연결해제")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "설비종료")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "전화해제")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "정상")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "프로그램종료")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else if (this.lblTitle.Text == "프로그램시작")
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- else
- {
- this.ToggleColor_set = Color.Transparent;
- this.ToggleColor_reset = this.ToggleColor_set;
- this.ToggleFontColor_set = Color.Black;
- this.ToggleFontColor_reset = Color.Black;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- }
- }
|