123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- 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 frmVersion : Form
- {
- public frmVersion()
- {
- InitializeComponent();
- // cyim 2013.7.12 디자인개선작업 : 시스템정보 - 버전정보 : 기본결과
- this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- }
- MDIParent mdi = null;
- delegate void deleFormInit();
- int glb_boardNo = 1;
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- 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 frmVersion_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;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- //this.mdi.SelectMenuIndex = 7;
- txtUIVersion.Text = Application.ProductVersion;
- txtDemonVersion.Text = "";
- txtFileVersion.Text = "0.0.0.0";
- Grid_init();
- this.Cursor = Cursors.WaitCursor;
- //완료이벤트
- dCommandResponse d = new dCommandResponse(VersionInfoComplete);
- //명령생성 및 실행
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, d);
- cmd.CommandType = "VI";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.CommandData = null;
- mdi.ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmVersion_Activated(object sender, EventArgs e)
- {
- try
- {
- //this.mdi.SelectMenuIndex = 7;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmVersion_Disposed(object sender, EventArgs e)
- {
- //if (mdi.ui.CommResponseReading)
- //{
- // //MessageBox.Show("응답 대기중입니다.. 잠시만 기다려 주십시요..");
- // return;
- //}
- try
- {
- //this.mdi.SelectMenuIndex = 0;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //*********************************************************************//
- // 버젼정보 완료 응답데이터 이벤트 //
- //*********************************************************************//
- public void VersionInfoComplete(CmdInfo cmd)
- {
- try
- {
- this.Cursor = Cursors.Default;
- //에러응답처리
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadCommandStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
- {
- return;
- }
- RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
- string demonVer = string.Format("{0}.{1}.{2}.{3}", resData2.Reply_value1, resData2.Reply_value2, resData2.Reply_value3, resData2.Reply_value4);
- txtDemonVersion.Text = demonVer;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //*********************************************************************//
- // 버젼정보 완료 응답데이터 이벤트 //
- //*********************************************************************//
- private void BrdVersionInfoComplete(CmdInfo cmd)
- {
- try
- {
- this.Cursor = Cursors.Default;
- //에러응답처리
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadTBoardStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
- {
- button_end(true);
- return;
- }
- if (cmd != null)
- {
- TextBox txt = (TextBox)Util.FineControl(tabPage2, string.Format("txtBoardVer_{0}", glb_boardNo));
- if (txt != null)
- {
- RCVData_ReadTBoardStatus res = (RCVData_ReadTBoardStatus)cmd.ResponseData;
- txt.Text = string.Format("{0}.{1}", res.TBD_MainVersion, res.TBD_SubVersion);
- }
- glb_boardNo++;
- }
- while (glb_boardNo <= 16)
- {
- TextBox txt = (TextBox)Util.FineControl(tabPage2, string.Format("txtBoardVer_{0}", glb_boardNo));
- if (txt != null)
- {
- if (txt.Enabled)
- {
- //해당 textbox가 활성화 되었다면 해당 버젼정보를 가져온다.
- break;
- }
- else
- {
- //다음 textbox를 찾는다.
- glb_boardNo++;
- }
- }
- else
- {
- return;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- button_end(true);
- //MessageBox.Show(ex.Message);
- return;
- }
- try
- {
- if (glb_boardNo < 16)
- {
- CmdInfo cmd2 = new CmdInfo(prt_cmd_define.resd_tbd_state, mdi.myReceiverID);
- cmd2.boardNo = glb_boardNo;
- dCommandResponse d = new dCommandResponse(BrdVersionInfoComplete); //응답후 이벤트 읽기 명령으로 이동
- cmd2.dEvent = d;
- this.mdi.ui.runCommand(cmd2);
- }
- else
- {
- button_end(true);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- button_end(true);
- }
- }
- private void Grid_init()
- {
- try
- {
- if (mdi.ui == null) return;
- ReceiverTypeInfo receiverInfo = mdi.ui.MyReceiverTypeInfo;
- if (receiverInfo == null) return;
- /************************************************************************/
- /* 통신보드 화면 초기화 */
- /************************************************************************/
- BoardTypeInfo[] boardInfos = receiverInfo.MyBoardType; //전체통신보드
- if (boardInfos != null)
- {
- foreach (BoardTypeInfo brd in boardInfos)
- {
- if (brd != null)
- {
- if (brd.UseFlag)
- {
- Label lbl = (Label)Util.FineControl(tabPage2, string.Format("lblBoardID_{0}", brd.BoardNo));
- if (lbl != null)
- {
- lbl.Enabled = true;
- }
- TextBox txt = (TextBox)Util.FineControl(tabPage2, string.Format("txtBoardVer_{0}", brd.BoardNo));
- if (txt != null)
- {
- txt.Enabled = true;
- }
- }
- }
- }
- }
- /************************************************************************/
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw ex;
- }
- }
- private void btnCommRead_Click(object sender, EventArgs e)
- {
- try
- {
- //버튼 비활성 설정
- button_end(false);
- glb_boardNo = 1;
- //통신보드 버젼읽기 명령 시작
- BrdVersionInfoComplete(null);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- button_end(true);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //화면 마우스 커서 및 버튼 다시 클릭 못하도록 설정 및 해제
- private void button_end(Boolean val)
- {
- try
- {
- if (val)
- {
- this.btnCommRead.Enabled = true;
- this.Cursor = Cursors.Default;
- }
- else
- {
- this.btnCommRead.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- bool CheckBoardVersion = false;//2010.10.29,k.s.d, check flag.
- private void tabPage2_Enter(object sender, EventArgs e)
- {//2010.10.29,k.s.d, if tab enter , read board version.
- try
- {
- if (CheckBoardVersion == false)
- {
- glb_boardNo = 1;
- BrdVersionInfoComplete(null);
- }
- CheckBoardVersion = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.12 디자인개선작업 : 시스템정보 - 버전정보
- //
- private void button_Menu_BasicSet_Click(object sender, EventArgs e)
- {
- button_Menu_Color_Init();
- this.tabControl1.SelectTab(0);
- this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- this.panel_Menu.Focus();
- }
- private void button_Menu_CommBoard_Click(object sender, EventArgs e)
- {
- button_Menu_Color_Init();
- this.tabControl1.SelectTab(1);
- this.button_Menu_CommBoard.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- this.panel_Menu.Focus();
- }
- private void button_Menu_Color_Init()
- {
- this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
- this.button_Menu_CommBoard.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
- }
- }
- }
|