123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- using System.Collections;
- using System.Diagnostics;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace FPER
- {
- public partial class frmModeConfig : Form
- {
- //[DllImport("kernel32.dll")]
- //private extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime);
- [DllImport("kernel32.dll")]
- private extern static uint SetSystemTime(ref SYSTEMTIME lpSystemTime);
- private struct SYSTEMTIME
- {
- public ushort wYear;
- public ushort wMonth;
- public ushort wDayOfWeek;
- public ushort wDay;
- public ushort wHour;
- public ushort wMinute;
- public ushort wSecond;
- public ushort wMilliseconds;
- }
- //private SYSTEMTIME GetTime()
- //{
- // // Call the native GetSystemTime method
- // // with the defined structure.
- // SYSTEMTIME stime = new SYSTEMTIME();
- // GetSystemTime(ref stime);
- // return stime;
- // //// Show the current time.
- // //MessageBox.Show("Current Time: " +
- // // stime.wHour.ToString() + ":"
- // // + stime.wMinute.ToString());
- //}
- //private void SetTime(SYSTEMTIME systime)
- //{
- // // Call the native GetSystemTime method
- // // with the defined structure.
- // //SYSTEMTIME systime = new SYSTEMTIME();
- // //GetSystemTime(ref systime);
- // //// Set the system clock ahead one hour.
- // //systime.wHour = (ushort)(systime.wHour + 1 % 24);
- // SetSystemTime(ref systime);
- // //MessageBox.Show("New time: " + systime.wHour.ToString() + ":"
- // // + systime.wMinute.ToString());
- //}
- MDIParent mdi;
- //최초 시간설정을 위해
- bool TimeTicker_Start = false;
- DateTime sSystemDateTime;
- delegate void deleFormInit();
- string temppw;
- ReceiverConfigVo configVO;
- public frmModeConfig()
- {
- InitializeComponent();
- // cyim 2013.7.29 시운전모드 속성 변경
- this.checkBox_TestRunFlag.Visible = false;
- }
- public void Form_Init()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(Form_Init);
- this.Invoke(d, new object[] { });
- }
- else
- {
- this.configVO.Fire_accumulation_mode = mdi.MyConfigVO.Fire_accumulation_mode;
- this.configVO.Fire_accumulation_time = mdi.MyConfigVO.Fire_accumulation_time;
- this.configVO.Fire_process_mode = mdi.MyConfigVO.Fire_process_mode;
- this.configVO.Master_user_id = mdi.MyConfigVO.Master_user_id;
- this.configVO.Master_password = mdi.MyConfigVO.Master_password;
- this.configVO.Building_name = mdi.MyConfigVO.Building_name;
- this.configVO.Background_image = mdi.MyConfigVO.Background_image;
- getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- private void frmModeConfig_Load(object sender, EventArgs e)
- {
- // cyim 2013.8.1 : 더블버퍼링 적용
- SetStyle(ControlStyles.UserPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.UpdateStyles();
- try
- {
- mdi = (MDIParent)this.MdiParent;
- //
- // cyim 2016.04.06 : 감지기의 낮시간대 설정
- //
- DacReceiverConfig TB_DayTime = new DacReceiverConfig(mdi.MyReceiverID);
- if (TB_DayTime.TB_DAYTIME_Exist() != null && TB_DayTime.TB_DAYTIME_Exist().Count != 0) // 처음 접근할 당시에 해당 테이블이 있다면 UI 가 새로 생긴다
- {
- // 설정된 값이 존재한다면
- DataRowCollection drc = TB_DayTime.TB_DAYTIME_Get();
- if (drc.Count == 0)
- {
- this.textBox_Start_Hour.Text = "0";
- this.textBox_Start_Minute.Text = "0";
- this.textBox_End_Hour.Text = "0";
- this.textBox_End_Minute.Text = "0";
- }
- else
- {
- string START_HOUR = ((drc[0]["START_HOUR"]) == null) ? "00" : (drc[0]["START_HOUR"]).ToString();
- string START_MIN = ((drc[0]["START_MIN"]) == null) ? "00" : (drc[0]["START_MIN"]).ToString();
- string END_HOUR = ((drc[0]["END_HOUR"]) == null) ? "00" : (drc[0]["END_HOUR"]).ToString();
- string END_MIN = ((drc[0]["END_MIN"]) == null) ? "00" : (drc[0]["END_MIN"]).ToString();
- groupBox_TBDayTime.Visible = true;
- this.textBox_Start_Hour.Text = START_HOUR;
- this.textBox_Start_Minute.Text = START_MIN;
- this.textBox_End_Hour.Text = END_HOUR;
- this.textBox_End_Minute.Text = END_MIN;
- }
- }
- else
- groupBox_TBDayTime.Visible = false;
- // cyim 2016.12.14 : IFC2000, IFC1000 은 아날로그 감지기 시간대 설정화면이 출력되지 않는다
- if (mdi.ReceiverModel == "IFC2000" || mdi.ReceiverModel == "IFC1000")
- groupBox_TBDayTime.Visible = false;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- this.configVO = new ReceiverConfigVo(mdi.myReceiverID);
- this.configVO.Fire_accumulation_mode = mdi.MyConfigVO.Fire_accumulation_mode;
- this.configVO.Fire_accumulation_time = mdi.MyConfigVO.Fire_accumulation_time;
- this.configVO.Fire_process_mode = mdi.MyConfigVO.Fire_process_mode;
- this.configVO.Master_user_id = mdi.MyConfigVO.Master_user_id;
- this.configVO.Master_password = mdi.MyConfigVO.Master_password;
- this.configVO.Building_name = mdi.MyConfigVO.Building_name;
- this.configVO.Background_image = mdi.MyConfigVO.Background_image;
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- this.configVO.Jump_field_flag = mdi.MyConfigVO.Jump_field_flag;
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- this.configVO.Test_run_flag = mdi.MyConfigVO.Test_run_flag;
- //축적(30초, 40초, 50초, 60초 선택) , 비축적
- ArrayList ary = new ArrayList();
- ary.Add(new cboitem("30", "30초"));
- ary.Add(new cboitem("40", "40초"));
- ary.Add(new cboitem("50", "50초"));
- ary.Add(new cboitem("60", "60초"));
- //ary.Add(new cboitem("0", "비축적"));
- Util.ComboSetting(cboFireAccumulationTime, ary, null);
- // cyim 2016.12.09 : 수신기 모델을 표시 (운전모드 설정화면)
- label_ReceiverModel.Text = mdi.ReceiverModel;
- getData();
- timer1.Enabled = true;
- }
- catch (Exception ex)
- {
- // cyim 2016.04.06 : 감지기의 낮시간대 설정
- groupBox_TBDayTime.Visible = false;
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmModeConfig_Activated(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 2;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmModeConfig_Disposed(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 0;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void getData()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(getData);
- this.Invoke(d, new object[] { });
- }
- else
- {
- //축적모드
- chkFireAccumulationMode.Checked = this.configVO.Fire_accumulation_mode;
- if (!chkFireAccumulationMode.Checked) chkFireAccumulationMode_CheckedChanged(chkFireAccumulationMode, EventArgs.Empty);
- //화재모드
- chkFireProcessMode.Checked = this.configVO.Fire_process_mode;
- if (!chkFireProcessMode.Checked) chkFireProcessMode_CheckedChanged(chkFireProcessMode, EventArgs.Empty);
- //관리자ID
- txtMasterUserId.Text = this.configVO.Master_user_id;
- //관리자암호
- txtMasterPassword.Text = this.configVO.Master_password;
- temppw = txtMasterPassword.Text;
- //관리자암호재입력
- txtMasterPasswordRe.Text = this.configVO.Master_password;
- //건물명
- txtBuildingName.Text = this.configVO.Building_name;
- //배경이미지
- //txtBackgroundImagePath.Text = this.configVO.Background_image;
- txtBackgroundImagePath.Text = "";
- //화재시화면전환 // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- if (this.configVO.Jump_field_flag == "N") checkBox_JumpField.Checked = false;
- else checkBox_JumpField.Checked = true;
- //시운전모드 // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- if (this.configVO.Test_run_flag == "N") checkBox_TestRunFlag.Checked = false;
- else checkBox_TestRunFlag.Checked = 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);
- }
- }
- private void chkFireAccumulationMode_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- if (chkFireAccumulationMode.Checked)
- {
- chkFireAccumulationMode.Text = "화재축적사용";
- this.cboFireAccumulationTime.Visible = true;
- if (this.configVO.Fire_accumulation_time > 0) cboFireAccumulationTime.SelectedValue = this.configVO.Fire_accumulation_time.ToString();
- else cboFireAccumulationTime.SelectedIndex = 0;
- }
- else
- {
- chkFireAccumulationMode.Text = "화재축적비사용";
- cboFireAccumulationTime.SelectedValue = "0";
- this.cboFireAccumulationTime.Visible = false;
- }
- // cyim 2013.7.12 디자인개선작업 : 운전설정
- if (chkFireAccumulationMode.Checked) this.chkFireAccumulationMode.BackgroundImage = (Image)Properties.Resources.일반버튼_대_주황_215_58;
- else this.chkFireAccumulationMode.BackgroundImage = (Image)Properties.Resources.일반버튼_대_회색_215_58;
- this.panel_Main.Focus();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void chkFireProcessMode_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- if (chkFireProcessMode.Checked)
- {
- chkFireProcessMode.Text = "화재지속";
- mdi.CommandLog(MappingStatus.Log, string.Format("복구모드 변경(화재지속)"));
- }
- else
- {
- chkFireProcessMode.Text = "자동복구";
- mdi.CommandLog(MappingStatus.Log, string.Format("복구모드 변경(자동복구)"));
- }
- // cyim 2013.7.12 디자인개선작업 : 운전설정
- if (chkFireProcessMode.Checked) this.chkFireProcessMode.BackgroundImage = (Image)Properties.Resources.일반버튼_대_회색_215_58;
- else this.chkFireProcessMode.BackgroundImage = (Image)Properties.Resources.일반버튼_대_주황_215_58;
- this.panel_Main.Focus();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- try
- {
- int nowHour = Util.StrToInt(string.Format("{0:HH}", DateTime.Now), 0);
- int sysHour = Util.StrToInt(string.Format("{0:HH}", sSystemDateTime), 0);
- if (!TimeTicker_Start)
- {
- dateTimePicker1.Value = DateTime.Now;
- numericUpDown1.Value = nowHour;
- numericUpDown2.Value = DateTime.Now.Minute;
- sSystemDateTime = DateTime.Now;
- TimeTicker_Start = true;
- }
- else
- {
- if (DateTime.Now.Minute != sSystemDateTime.Minute) numericUpDown2.Value = DateTime.Now.Minute;
- if (sysHour != nowHour) numericUpDown1.Value = nowHour;
- //if (DateTime.Now.Date != sSystemDateTime.Date) dateTimePicker1.Value = DateTime.Now;
- sSystemDateTime = DateTime.Now;
- }
- txtSystemSecond.Text = string.Format("{0}", DateTime.Now.Second);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnTimeApply_Click(object sender, EventArgs e)
- {
- try
- {
- DateTime sDateTimeValue = dateTimePicker1.Value;
- //string myDateTimeValue = string.Format("2/16/1992 12:15:12");
- string myDateTimeValue = string.Format("{0:MM}/{0:dd}/{0:yyyy} {1:00}:{2:00}:{3:00}", sDateTimeValue
- , numericUpDown1.Value, numericUpDown2.Value, Util.StrToInt(txtSystemSecond.Text, 0));
- DateTime myDateTime = DateTime.Parse(myDateTimeValue);
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
- DateTime TempDateTime = myDateTime;
- SYSTEMTIME systime = new SYSTEMTIME();
- //GetSystemTime(ref systime);
- myDateTime = myDateTime.AddHours(-9);
- int nowHour = Util.StrToInt(string.Format("{0:HH}", myDateTime), 0);
- systime.wYear = (ushort)myDateTime.Year;
- systime.wMonth = (ushort)myDateTime.Month;
- systime.wDay = (ushort)myDateTime.Day;
- systime.wHour = (ushort)(nowHour);
- systime.wMinute = (ushort)myDateTime.Minute;
- systime.wSecond = (ushort)myDateTime.Second;
- SetSystemTime(ref systime); //시간설정
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 (라벨은 적용버튼 누르면 보임)
- mdi.Event.TimeSync_Setup_SendMessage_Write(TempDateTime.ToString("yyyy-MM-dd HH:mm:ss"));
- this.label_Inform.Visible = 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);
- }
- }
- //비밀번호 규칙 설정
- //6~20자리 문자열 숫자와 문자와 같이 있어야 함
- public static bool IsRegexMatch(int type, string plainText)
- {
- Regex rx;
- switch (type)
- {
- case 1: //숫자
- rx = new Regex(@"^[0-9]$", RegexOptions.None);
- break;
- case 2: //영문자
- rx = new Regex(@"^[a-zA-Z]$", RegexOptions.None);
- break;
- case 3: //한글
- rx = new Regex(@"^[가-힣]$", RegexOptions.None);
- break;
- case 4: //한글+영문자
- rx = new Regex(@"^[a-zA-Z]$", RegexOptions.None);
- break;
- case 5: //숫자+영문자+한글
- rx = new Regex(@"^[a-zA-Z0-9가-힣]$", RegexOptions.None);
- break;
- case 6: //숫자+영문자+한글 + 개수
- rx = new Regex(@"^[a-zA-Z0-9가-힣]{4,16}$", RegexOptions.None);
- break;
- default:
- return false;
- }
- return (string.IsNullOrEmpty(plainText)) ? false : rx.IsMatch(plainText);
- }
- //문자열중 하나라도 숫자가 존재하는지 체크
- public bool IsNumeric(string value)
- {
- bool result = false;
- foreach (char cData in value)
- {
- if (false == Char.IsNumber(cData))
- {
- result = false;
- }
- else
- {
- result = true;
- break;
- }
- }
- if (result)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //문자열중 하나라도 문자가 존재하는지 체크
- public bool IsLetter(string value)
- {
- bool result = false;
- foreach (char cData in value)
- {
- if (false == Char.IsLetter(cData))
- {
- result = false;
- }
- else
- {
- result = true;
- break;
- }
- }
- if (result)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private void btnRepeaterSave_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.7.12 디자인개선작업 : 운전설정
- this.panel_Main.Focus();
- // cyim 2015.10.1 시간 동기화 : 라벨은 적용버튼 누르면 보이지만, 전체적용버튼 누르면 사라짐
- this.label_Inform.Visible = false;
- bool chkConfigVoChange = false; //데몬에 넘길 데이터 변경여부
- bool chkConfigVoChangeAll = false; //전체데이터 변경여부
- Util.ChkTxtBox(txtMasterUserId, "관리자ID");
- string ID = txtMasterUserId.Text.Trim().ToLower();
- string passwd = txtMasterPassword.Text.Trim().ToLower();
- string passwdre = txtMasterPasswordRe.Text.Trim().ToLower();
- if (!((temppw == passwd) && (temppw == passwdre)))
- {
- if (!passwd.Equals(passwdre))
- {
- MessageBox.Show("암호와 재입력 암호가 일치하지 않습니다.", Application.ProductName);
- return;
- }
- if (ID.Equals(passwd))
- {
- MessageBox.Show("ID와 비밀번호가 동일하면 안됩니다.", Application.ProductName);
- return;
- }
- if (!IsRegexMatch(6, passwd)) // 개수
- {
- MessageBox.Show("비밀번호는 숫자와 문자의 조합으로 구성되어야합니다(4~16자)", Application.ProductName);
- return;
- }
- if (!IsNumeric(passwd)) //숫자
- {
- MessageBox.Show("비밀번호는 숫자와 문자의 조합으로 구성되어야합니다(4~16자, 숫자 필요)", Application.ProductName);
- return;
- }
- if (!IsLetter(passwd)) //문자
- {
- MessageBox.Show("비밀번호는 숫자와 문자의 조합으로 구성되어야합니다(4~16자, 문자 필요)", Application.ProductName);
- return;
- }
- }
- Util.ChkTxtBox(txtBuildingName, "건물표시명");
- this.Cursor = Cursors.WaitCursor;
- this.configVO.Fire_accumulation_mode = chkFireAccumulationMode.Checked;
- this.configVO.Fire_accumulation_time = Util.StrToInt(cboFireAccumulationTime.SelectedValue, 0);
- this.configVO.Fire_process_mode = chkFireProcessMode.Checked;
- this.configVO.Master_user_id = txtMasterUserId.Text.Trim();
- if (!passwd.Equals("1234567890"))
- {
- this.configVO.Master_password = passwd;
- }
- this.configVO.Building_name = txtBuildingName.Text.Trim();
- //byte[] imgbytes = null;
- if (txtBackgroundImagePath.Text.Length > 0)
- {
- //imgbytes = fileByte(txtBackgroundImagePath.Text.Trim());
- this.configVO.Background_image = txtBackgroundImagePath.Text.Trim(); //imgbytes;
- }
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- if (checkBox_JumpField.Checked == true) this.configVO.Jump_field_flag = "Y";
- else this.configVO.Jump_field_flag = "N";
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- if (checkBox_TestRunFlag.Checked == true) this.configVO.Test_run_flag = "Y";
- else this.configVO.Test_run_flag = "N";
- //축적모드,축적시간,화재모드만 변경여부를 체크하여 쓴다.
- if (mdi.MyConfigVO.Fire_accumulation_mode != this.configVO.Fire_accumulation_mode) chkConfigVoChange = true;
- if (mdi.MyConfigVO.Fire_accumulation_time != this.configVO.Fire_accumulation_time) chkConfigVoChange = true;
- if (mdi.MyConfigVO.Fire_process_mode != this.configVO.Fire_process_mode) chkConfigVoChange = true;
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- if (mdi.MyConfigVO.Jump_field_flag != this.configVO.Jump_field_flag) chkConfigVoChange = true;
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- if (mdi.MyConfigVO.Test_run_flag != this.configVO.Test_run_flag) chkConfigVoChange = true;
- //전체변경여부 체크
- chkConfigVoChangeAll = chkConfigVoChange;
- if (!mdi.MyConfigVO.Master_user_id.Equals(this.configVO.Master_user_id)) chkConfigVoChangeAll = true;
- if (!mdi.MyConfigVO.Master_password.Equals(this.configVO.Master_password)) chkConfigVoChangeAll = true;
- if (!mdi.MyConfigVO.Building_name.Equals(this.configVO.Building_name)) chkConfigVoChangeAll = true;
- if (!mdi.MyConfigVO.Background_image.Equals(this.configVO.Background_image)) chkConfigVoChangeAll = true;
- if (chkConfigVoChangeAll)
- {
- DacReceiverConfig dacReceiverConfig = new DacReceiverConfig(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacReceiverConfig.Config_Update(QUERYMode.InsertAndUpdate, mdi.myReceiverID
- , this.configVO.Fire_accumulation_mode ? "Y" : "N"
- , this.configVO.Fire_accumulation_time, this.configVO.Fire_process_mode ? "Y" : "N"
- , this.configVO.Sound_process_mode ? "Y" : "N"
- , this.configVO.Master_user_id, this.configVO.Master_password
- , this.configVO.Building_name, this.configVO.Background_image
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- , this.configVO.Test_run_flag
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- , this.configVO.Jump_field_flag);
- }
- //데몬통신
- if (chkConfigVoChange)
- {
- /***************************************************************/
- /* 환경설정변경명령 Progress 표시 */
- /***************************************************************/
- frmProgress frm = new frmProgress(mdi); // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- //중계기 설정 데이터를 CmdInfo에 넣어준다..
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "CS";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.CommandData = this.configVO; //변경데이터-명령
- frm.Commandinfo = cmd;
- frm.ConfigVoMy = this.mdi.MyConfigVO; //원본데이터-비교를 위해
- frm.ui = this.mdi.ui;
- frm.ShowDialog();
- /**************************************************************/
- }
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- DacFieldConfig dacfieldconfig = new DacFieldConfig(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- if (this.checkBox_JumpField.Checked == true) mdi.MyConfigVO.Jump_field_flag = "Y";
- else mdi.MyConfigVO.Jump_field_flag = "N";
- dacfieldconfig.UpdateJumpField(mdi.myReceiverID, this.checkBox_JumpField.Checked);
- //자신의 환경정보도 변경한다..
- mdi.MyConfigVO = this.configVO;
- this.Cursor = Cursors.Default;
- //MessageBox.Show("저장 적용 되었습니다.", Application.ProductName);
- //
- // cyim 2016.04.06 : 감지기의 낮시간대 설정
- //
- if (this.groupBox_TBDayTime.Visible == true)
- {
- DacReceiverConfig TB_DayTime = new DacReceiverConfig(mdi.MyReceiverID);
- if (TB_DayTime.TB_DAYTIME_Exist() != null && TB_DayTime.TB_DAYTIME_Exist().Count != 0) // 처음 접근할 당시에 해당 테이블이 있다면 UI 가 새로 생긴다
- {
- TB_DayTime.TB_DAYTIME_Init();
- TB_DayTime.TB_DAYTIME_Set(
- this.textBox_Start_Hour.Text,
- this.textBox_Start_Minute.Text,
- this.textBox_End_Hour.Text,
- this.textBox_End_Minute.Text);
- }
- }
- // cyim 2015.2.10 운전설정 적용하기 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("운전설정 적용 [축적:{0}, 모드:{1}]", chkFireAccumulationMode.Text, chkFireProcessMode.Text));
- MessageBox.Show("적용되었습니다.", Application.ProductName);
- }
- catch (Exception ex)
- {
- MessageBox.Show("실패하였습니다.", Application.ProductName);
- 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);
- }
- }
- private byte[] fileByte(string path)
- {
- byte[] buffer = null;
- try
- {
- string fileName = path;
- if (fileName.Length > 0)
- {
- FileInfo file = new FileInfo(path);
- if (file.Exists)
- {
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- BinaryReader br = new BinaryReader(fs);
- buffer = br.ReadBytes((int)fs.Length);
- br.Close();
- fs.Close();
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw ex;
- }
- return buffer;
- }
- private void btnBackgroundImageSearch_Click(object sender, EventArgs e)
- {
- //'디렉토리 정보를 가져오는 다이어그램을 연다.
- try
- {
- string init_path = Application.StartupPath;
- FindImageFileDialog.InitialDirectory = init_path;
- FindImageFileDialog.Filter = "GIF 이미지(*.gif)|*.gif|JPEG 이미지(*.jpg,*.jpeg,*.jpe)|*.jpg,*.jpeg,*.jpe|BMP 이미지(*.bmp)|*.bmp|모든파일|*.*";
- if (FindImageFileDialog.ShowDialog() == DialogResult.OK)
- {
- txtBackgroundImagePath.Text = FindImageFileDialog.FileName;
- }
- }
- 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);
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- private void checkBox_TestRunFlag_CheckedChanged(object sender, EventArgs e)
- {
- if (this.checkBox_TestRunFlag.Checked == true)
- this.label_TestRunFlag.Visible = true;
- else
- this.label_TestRunFlag.Visible = false;
- }
- //
- // Hidden Key 를 입력
- //
- // cyim 2017.01.23 : Explorer 프로세스 제어 루틴 추가
- private void label_ExplorerDisable_Click(object sender, EventArgs e)
- {
- if (_Data.FireDeskMode == false)
- _Diagnostics.taskkill_explorer();
- }
- private void label_ExplorerEnable_Click(object sender, EventArgs e)
- {
- if (_Data.FireDeskMode == false)
- _Diagnostics.start_explorer();
- }
- }
- }
|