123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace FPER
- {
- public partial class frmDriveTest : Form
- {
- public frmDriveTest()
- {
- InitializeComponent();
- // cyim 2016.03.25 : 전원값 화면에 표시못하는 문제 보완 (주기적으로 갱신)
- timer_Protect.Enabled = true;
- }
- LogFileCreate LFC = new LogFileCreate();
- MDIParent mdi = null;
- delegate void deleFormInit();
- bool sBatteryTestCommandStart = false;
- int sBatteryTestAction = 0;
- int sBatteryTestSecond = 20;
- int iStatusCount = 0;
- // bool sKeypadTestCommandStart = false;
- // int sKeypadTestAction = 0;
- delegate void SetVoltageCallback(float cnt);
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- //DoBatteryTest(false);
- mdi.winDriveTestForm = null;//k.s.d 20101023, Driver Test form Handle set null ( init bug fix )
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- 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 frmDriveTest_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
- {
- this.mdi = (MDIParent)this.MdiParent;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- //foreach (Control currentControl in tabPage3.Controls)
- //{
- // if (currentControl is TextBox)
- // {
- // TextBox txt = (TextBox)currentControl;
- // txt.Text = "";
- // }
- //}
- foreach (Control currentControl in panel_Bottom.Controls)
- {
- if (currentControl is TextBox)
- {
- TextBox txt = (TextBox)currentControl;
- txt.Text = "";
- }
- }
- txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
- //전압읽기 명령 생성
- this.mdi.ui.Voltage_Read(null);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmDriveTest_Activated(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 5;
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- // 차후에 데몬에서 교류 혹은 예비전원 이상이 되면 테스트를 종료시킨다
- // 단, 예비전원 테스트 폼이 활성화되어 있다는 전제하에서만 동작된다
- this.mdi.Form_Active_frmDriveTest = true; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmDriveTest_Disposed(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 0;
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- this.mdi.Form_Active_frmDriveTest = false; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // cyim 2016.03.21 테스트 도중에 다른 메뉴로 진입할때 테스트 종료를 데몬에 명령
- DoBatteryTest(false);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //전압 표시
- public void Display_24Voltage(float vol)
- {
- try
- {
- if (this.txt24Voltage.InvokeRequired)
- {
- Console.WriteLine("Display_24Voltage = {0}", vol);
- SetVoltageCallback d = new SetVoltageCallback(Display_24Voltage);
- this.txt24Voltage.Invoke(d, new object[] { vol });
- }
- else
- {
- this.txt24Voltage.Text = String.Format("{0:0.00}V", vol);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //전압 표시
- public void Display_5Voltage(float vol)
- {
- try
- {
- if (this.txt5Voltage.InvokeRequired)
- {
- SetVoltageCallback d = new SetVoltageCallback(Display_5Voltage);
- this.txt5Voltage.Invoke(d, new object[] { vol });
- }
- else
- {
- this.txt5Voltage.Text = String.Format("{0:0.00}V", vol);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //전압 표시
- public void Display_3Voltage(float vol)
- {
- try
- {
- if (this.txt3Voltage.InvokeRequired)
- {
- SetVoltageCallback d = new SetVoltageCallback(Display_3Voltage);
- this.txt3Voltage.Invoke(d, new object[] { vol });
- }
- else
- {
- this.txt3Voltage.Text = String.Format("{0:0.00}V", vol);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //전압 표시
- public void Display_BatteryVoltage(float vol)
- {
- try
- {
- if (this.txtBatteryVoltage.InvokeRequired)
- {
- SetVoltageCallback d = new SetVoltageCallback(Display_BatteryVoltage);
- this.txtBatteryVoltage.Invoke(d, new object[] { vol }); // cyim 폼 전체를 invoke 하지 않도록 한다
- }
- else
- {
- this.txtBatteryVoltage.Text = String.Format("{0:0.00}V", vol);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 배터리 테스트 버튼을 눌렀을때..
- public void btnBatteryTest_Click(object sender, EventArgs e)
- {
- // 먼저 배터리 테스트 대기 메시지를 띄운다. (1초 이상 기다려야 하니까..)
- //lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- if (mdi.AC_TestError == true && mdi.Battery_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
- else if (mdi.Battery_TestError == true && mdi.AC_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (예비전원 확인)";
- else
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (전원 확인)";
- LFC.Log("타입: 수신기 조작 로그, 메세지: BATTERY 테스트");
- // 비상전원 상태를 읽어오도록 한다.
- mdi.ui.ReadIO15Input();
- // 타이머를 활성화한다. (1초 후에 타이머 루틴으로 점프한다. 상태 확인을 위한 시간을 확보한다.)
- iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
- StatusTimer.Enabled = true;
- }
- // 배터리 테스트 루틴. (키패드 배터리 테스트 입력에 대한 처리)
- public void DoBatteryTest2(bool status)
- {
- //lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
- if (status == false)
- {
- DoBatteryTest(false); // 배터리 테스트 종료
- }
- //mdi.ui.ReadIO15Input();
- //// 상태 확인용으로 지연시킨다.
- //StatusTimer.Enabled = true;
- //if (status == false) // 시작
- //{
- // sBatteryTestAction = 0; // 시작하기 위해서.. 배터리 테스트 상태를 종료로 세팅한다.
- //}
- // cyim 2015.3.31 예비전원 테스트 루틴 통일
- btnBatteryTest_Click(null, null);
- }
- // 배터리 테스트 루틴.
- public void DoBatteryTest(bool status)
- {
- try
- {
- if (status == true)
- {
- if ((mdi.ui.bPowerStatus == true) && (mdi.ui.bEmergencyPowerStatus == true)) // 전원 오류 상태가 아니라면
- {
- sBatteryTestAction = 1;//시작명령
- sBatteryTestCommandStart = true;
- btnBatteryTest.Text = " 시험종료";
- sBatteryTestCommandStart = true;
- timer1.Interval = 1000;
- timer1.Enabled = true;
- timer1.Start();
- lblBatteryTestResult.Text = "BATTERY 테스트 시작";
- lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
- lblBatteryTestResult.Show();
- lblBatteryTestMessage.Show();
- lblBatteryTestMessage2.Show();
- }
- }
- else
- {
- sBatteryTestAction = 0; //종료명령
- sBatteryTestCommandStart = false;
- //sBatteryTestAction = 0;//시작명령
- btnBatteryTest.Text = " 시험시작";
- sBatteryTestSecond = 20;
- txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
- timer1.Enabled = false;
- lblBatteryTestResult.Text = "BATTERY 테스트 완료";
- lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
- lblBatteryTestResult.Show();
- lblBatteryTestMessage.Hide();
- lblBatteryTestMessage2.Hide();
- }
- //완료이벤트
- dCommandResponse d = new dCommandResponse(BatteryTestComplete);
- //명령생성 및 실행
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
- cmd.CommandType = "TB";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.CommandData = null;
- cmd.Status = sBatteryTestAction; //1-시작,0-종료
- mdi.ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- btnBatteryTest.Enabled = true;
- this.Cursor = Cursors.Default;
- }
- }
- //화면 마우스 커서 및 버튼 다시 클릭 못하도록 설정 및 해제
- private void button_end(Button btn, Boolean val)
- {
- if (val)
- {
- btn.Enabled = true;
- this.Cursor = Cursors.Default;
- }
- else
- {
- btn.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
- }
- }
- //*********************************************************************//
- // 배터리 테스트 완료 응답데이터 이벤트 //
- //*********************************************************************//
- public void BatteryTestComplete(CmdInfo cmd)
- {
- try
- {
- //button_end(btnBatteryTest, true);
- btnBatteryTest.Enabled = true;
- this.Cursor = Cursors.Default;
- //에러응답처리
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadCommandStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
- {
- //에러가 발생하였으므로 원복
- sBatteryTestCommandStart = false;
- timer1.Stop();
- timer1.Enabled = false;
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- DoBatteryTest(false);
- return;
- }
- sBatteryTestCommandStart = true;
- if (sBatteryTestAction == 1)
- {
- btnBatteryTest.Text = " 시험종료";
- sBatteryTestCommandStart = true;
- timer1.Interval = 1000;
- timer1.Enabled = true;
- timer1.Start();
- lblBatteryTestMessage.Show(); //k.s.d 20101023, Test End Message show, hide
- lblBatteryTestMessage2.Show();
- }
- else
- {
- sBatteryTestCommandStart = false;
- sBatteryTestAction = 0;//시작명령
- btnBatteryTest.Text = " 시험시작";
- sBatteryTestSecond = 20;
- txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
- timer1.Enabled = false;
- lblBatteryTestMessage.Hide(); //k.s.d 20101023, Test End Message show, hide
- lblBatteryTestMessage2.Hide();
- }
- this.mdi.ui.Voltage_Read(null);
- //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
- ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- //MessageBox.Show(msg, Application.ProductName);
- //button_end(btnBatteryTest,true);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
- private int timer_Protect_Tick_Cnt = 0;
- private void timer_Protect_Tick(object sender, EventArgs e)
- {
- try
- {
- // cyim 2017.05.08 : 예외처리 코드 추가
- if (this.mdi == null
- || this.mdi.ui == null
- || this.txt24Voltage == null
- || this.timer1 == null
- || this.StatusTimer == null)
- return;
- // cyim 2016.03.25 : 전원값 화면에 표시못하는 문제 보완 (주기적 갱신)
- //다른 타이머가 동작중이면 사용못함
- if (this.timer1.Enabled == true || this.StatusTimer.Enabled == true)
- return;
- timer_Protect_Tick_Cnt++;
- if (timer_Protect_Tick_Cnt == 1)
- {
- this.mdi.ui.Voltage_Read(null);
- this.txt24Voltage.Text = mdi.Power_Main_vol24;
- timer_Protect_Tick_Cnt = 0;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- try
- {
- //timer1.Stop();
- //timer1.Enabled = false;
- // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완 : 데몬에게 테스트 종료 및 전원값 요청을 동시에 하지 않는다
- if (sBatteryTestSecond > 1 && sBatteryTestSecond < 20)
- this.mdi.ui.Voltage_Read(null);
- if (sBatteryTestCommandStart)
- {
- sBatteryTestSecond--;
- txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
- if (sBatteryTestSecond < 1)
- {
- sBatteryTestSecond = 0;
- sBatteryTestCommandStart = false;
- lblBatteryTestResult.Text = "BATTERY 테스트 완료";
- lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
- lblBatteryTestResult.Show(); //k.s.d 20101023, Test End Message show, hide
- btnBatteryTest_Click(btnBatteryTest, System.EventArgs.Empty);
- }
- }
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- if ((mdi.ui.bPowerStatus == false) || (mdi.ui.bEmergencyPowerStatus == false))
- {
- DoBatteryTest(false);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmDriverTestClose(object sender, FormClosedEventArgs e)
- { //k.s.d 20101023, test end when form close.
- try
- {
- DoBatteryTest(false);
- mdi.winDriveTestForm = null;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // IO15의 교류전원 상태를 확인하기 위해서.. 타이머를 사용했음.
- // 교류전원 응답이 늦게 올라오기 때문에.. 응답이 온 후에 (bReceivePowerStatus == true)
- // 배터리 테스트 처리를 수행함.
- private void StatusTimer_Tick(object sender, EventArgs e)
- {
- iStatusCount++;
- if (iStatusCount > 20)
- {
- StatusTimer.Enabled = false;
- iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
- }
- // cyim 2016.03.21 배터리 테스트 버튼을 눌렀을때 늦게 전원정보가 오는 경우가 발생한다. 타이머를 조금 늦게 가동하자
- if (iStatusCount == 1) return;
- // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
- if (mdi.AC_TestError == true && mdi.Battery_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
- else if (mdi.Battery_TestError == true && mdi.AC_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (예비전원 확인)";
- else
- lblBatteryTestResult.Text = "BATTERY 테스트 대기 (전원 확인)";
- if (mdi.ui.bReceivePowerStatus == true)
- {
- // 교류전원 상태 확인용 타이머를 끈다.
- StatusTimer.Enabled = false;
- iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
- // 배터리 테스트 중이면..
- if (sBatteryTestAction == 1)
- {
- //sBatteryTestAction = 0; //종료명령
- DoBatteryTest(false);
- //this.mdi.ui.Voltage_Read(null);
- Console.WriteLine("DoBatteryTest(false);");
- }
- else
- {
- DoBatteryTest(true);
- Console.WriteLine("DoBatteryTest(true);");
- }
- }
- else
- {
- // cyim 2015.7.23 MTB 보드가 없는 경우 예비전원테스트 화면에서 테스트 버튼 누르면 오류 발생
- if (mdi.AC_TestError == true && mdi.Battery_TestError == true) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- {
- lblBatteryTestResult.Text = "통신 응답 없음 ";
- lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
- lblBatteryTestResult.Show();
- // 카운터 종료
- StatusTimer.Enabled = false;
- iStatusCount = 0;
- }
- }
- }
- //private void btnKeypadIn_1_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_1.Text = "Pass";
- //}
- //private void btnKeypadIn_2_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_2.Text = "Pass";
- //}
- //private void btnKeypadIn_3_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_3.Text = "Pass";
- //}
- //private void btnKeypadIn_4_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_4.Text = "Pass";
- //}
- //private void btnKeypadIn_5_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_5.Text = "Pass";
- //}
- //private void btnKeypadIn_6_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_6.Text = "Pass";
- //}
- //private void btnKeypadIn_7_Click(object sender, EventArgs e)
- //{
- // txtKeypadIn_Result_7.Text = "Pass";
- //}
- //private void btnKeyPadTest_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // string msg = string.Format("키패드 테스트 {0}명령을 내리시겠습니까?", sKeypadTestAction == 1 ? "종료" : "시작");
- // if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- // {
- // if (sKeypadTestAction == 1)
- // {
- // sKeypadTestAction = 0; //종료명령
- // }
- // else
- // {
- // sKeypadTestAction = 1;//시작명령
- // }
- // //버튼 비활성 설정
- // button_end(btnKeyPadTest, false);
- // //완료이벤트
- // dCommandResponse d = new dCommandResponse(KeypadTestComplete);
- // //명령생성 및 실행
- // CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
- // cmd.CommandType = "TK";
- // cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- // cmd.CommandData = null;
- // cmd.Status = sKeypadTestAction; //1-시작,0-종료
- // mdi.ui.runCommand(cmd);
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- // }
- //}
- ////*********************************************************************//
- //// 키패드 테스트 완료 응답데이터 이벤트 //
- ////*********************************************************************//
- //public void KeypadTestComplete(CmdInfo cmd)
- //{
- // button_end(btnKeyPadTest, true);
- // //에러응답처리
- // if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected))
- // {
- // //에러가 발생하였으므로 원복
- // sKeypadTestCommandStart = false;
- // return;
- // }
- // sKeypadTestCommandStart = true;
- // if (sKeypadTestAction == 1)
- // {
- // KeypadTestButtonEnabled(true);
- // btnKeyPadTest.Text = "시험종료";
- // sKeypadTestCommandStart = true;
- // }
- // else
- // {
- // KeypadTestButtonEnabled(false);
- // sKeypadTestCommandStart = false;
- // sKeypadTestAction = 0; //시작명령
- // btnKeyPadTest.Text = "시험시작";
- // }
- // //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
- // ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- // //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- // //MessageBox.Show(msg, Application.ProductName);
- // //button_end(btnBatteryTest,true);
- //}
- //private void KeypadTestButtonEnabled(bool action)
- //{
- // btnKeypadIn_1.Enabled = action;
- // btnKeypadIn_2.Enabled = action;
- // btnKeypadIn_3.Enabled = action;
- // btnKeypadIn_4.Enabled = action;
- // btnKeypadIn_5.Enabled = action;
- // btnKeypadIn_6.Enabled = action;
- // btnKeypadIn_7.Enabled = action;
- // btnKeypadOut_1.Enabled = action;
- // btnKeypadOut_2.Enabled = action;
- // btnKeypadOut_3.Enabled = action;
- // btnKeypadOut_4.Enabled = action;
- // btnKeypadOut_5.Enabled = action;
- // btnKeypadOut_6.Enabled = action;
- // btnKeypadOut_7.Enabled = action;
- // btnKeypadOut_8.Enabled = action;
- // btnKeypadOut_9.Enabled = action;
- // btnKeypadOut_10.Enabled = action;
- // btnKeypadOut_11.Enabled = action;
- // btnKeypadOut_12.Enabled = action;
- // btnKeypadOut_13.Enabled = action;
- // btnKeypadOut_14.Enabled = action;
- // btnKeypadOut_15.Enabled = action;
- // btnKeypadOut_16.Enabled = action;
- // btnKeypadOut_17.Enabled = action;
- //}
- //private void btnKeypadOut_1_Click(object sender, EventArgs e)
- //{
- // try
- // {
- // if (sKeypadTestAction != 1)
- // {
- // MessageBox.Show("키패드 테스트가 시작되지 않았습니다.", Application.ProductName);
- // return;
- // }
- // if (MessageBox.Show("키패드 화재 테스트 출력명령을 내리시겠습니까?"
- // , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- // {
- // //버튼 비활성 설정
- // button_end(btnKeypadOut_1, false);
- // ////완료이벤트
- // //dCommandResponse d = new dCommandResponse(KeypadOutButtonComplete);
- // ////명령생성 및 실행
- // //CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
- // //cmd.CommandType = "TK";
- // //cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- // //cmd.CommandData = null;
- // //cmd.Status = sKeypadTestAction; //1-시작,0-종료
- // //mdi.ui.runCommand(cmd);
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- // }
- //}
- //public void KeypadOutButtonComplete(CmdInfo cmd)
- //{
- // button_end(btnKeypadOut_1, true);
- // //에러응답처리
- // if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected))
- // {
- // //에러가 발생하였으므로 원복
- // sKeypadTestCommandStart = false;
- // return;
- // }
- // sKeypadTestCommandStart = true;
- // if (sKeypadTestAction == 1)
- // {
- // KeypadTestButtonEnabled(true);
- // btnKeyPadTest.Text = "시험종료";
- // sKeypadTestCommandStart = true;
- // }
- // else
- // {
- // KeypadTestButtonEnabled(false);
- // sKeypadTestCommandStart = false;
- // sKeypadTestAction = 0; //시작명령
- // btnKeyPadTest.Text = "시험시작";
- // }
- // //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
- // ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- // //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
- // //MessageBox.Show(msg, Application.ProductName);
- // //button_end(btnBatteryTest,true);
- //}
- }
- }
|