1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- namespace FPER
- {
- public partial class frmProgress : Form
- {
- private CmdInfo commandinfo;
- private SocketUI socketUI;
- private Boolean complete = false;
- private controlWriteDevType[] devTypes;
- private RepeaterDeviceTypeInfo[] repinfo;
- private BoardTypeInfo[] brdinfos;
- private ReceiverConfigVo configVoChg;
- private ReceiverConfigVo configVoMy;
- private ReceiverTypeInfo configReceiverPoint;
- bool configReceiverPointAllWrite = false;
- public ReceiverConfigVo ConfigVoMy { set { this.configVoMy = value; } }
- public CmdInfo Commandinfo { get { return this.commandinfo; } set { this.commandinfo = value; } }
- public SocketUI ui { get { return this.socketUI; } set { this.socketUI = value; } }
- public int download_type = 0;
-
- public MDIParent mdi = null;
- public frmProgress(MDIParent pMdi)
- {
- InitializeComponent();
- mdi = pMdi;
- }
- private void frmProgress_Load(object sender, EventArgs e)
- {
- try
- {
- progressBar1.Value = 0;
- btnOK.Enabled = false;
-
- progress_Run();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void SetLinkageCut()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
-
- progressBar1.Maximum = 100;
- progressBar1.Value += 1;
- progressBar1.Refresh();
- btnOK.Visible = false;
- lblDescription.Visible = false;
-
- listView1.Visible = false;
- ProgressLabel.Visible = true;
-
- dCommandResponse d = new dCommandResponse(command_complete);
- this.commandinfo.dEvent = d;
- this.commandinfo.CommId = 1;
- this.commandinfo.loopNo = 0;
-
- ui.runCommand(this.commandinfo);
- progressBar1.Value = 50;
-
-
-
-
-
-
-
- progressBar1.Refresh();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- this.Cursor = Cursors.Default;
- }
- }
-
- private void progress_Run()
- {
- try
- {
- if (this.commandinfo == null) return;
- progressBar1.Value = 0;
- listView1.Items.Clear();
- this.Show();
- if (!ui.Connected)
- {
- MessageBox.Show("통신상태를 확인하세요..", Application.ProductName);
- this.Close();
- return;
- }
- if (download_type != 0)
- {
- this.SetLinkageCut();
- return;
- }
- switch (this.commandinfo.Command)
- {
-
- case prt_cmd_define.write_repeater_info_unit:
- this.Text = "중계기 정보 UNIT 쓰기중.....";
- lblDescription.Text = "중계기 정보 UNIT 쓰기";
- if (this.commandinfo.boardNo > 0)
- {
- progressBar1.Maximum = 127;
- if (this.commandinfo.CommandData != null)
- {
-
- this.repinfo = (RepeaterDeviceTypeInfo[])this.commandinfo.CommandData;
-
- repeater_info_unit_write_progress();
- }
- else
- {
- MessageBox.Show("데이터가 유효하지 않습니다.. 설정데이터를 알수 없습니다.");
-
- CompleteProgress();
- }
- }
- else
- {
- this.Text = "중계기 정보 UNIT 전체 쓰기중.....";
- lblDescription.Text = "중계기 정보 UNIT 전체 쓰기";
- progressBar1.Maximum = 16 * 2 * 127;
-
- this.configReceiverPointAllWrite = true;
-
-
- UIReceiverInfo cfg = new UIReceiverInfo(this.commandinfo.receiverID);
- this.configReceiverPoint = cfg.ReadAll_ReceiverTypeInfo(mdi);
- this.commandinfo.CommandData = null;
- this.commandinfo.boardNo = 1;
- this.commandinfo.loopNo = 0;
- this.commandinfo.repeaterNo = 0;
-
- bool runBoardIdOK = false;
- while (!runBoardIdOK)
- {
- BoardTypeInfo brdinfo = this.configReceiverPoint.Get_RepeaterType(this.commandinfo.boardNo);
- if (brdinfo != null)
- {
-
- if (this.commandinfo.loopNo == 0)
- {
- this.repinfo = brdinfo.Loop0_RepeaterType;
- }
- else if (this.commandinfo.loopNo == 1)
- {
- this.repinfo = brdinfo.Loop1_RepeaterType;
- }
- else if (this.commandinfo.loopNo == 2)
- {
- this.repinfo = brdinfo.Loop2_RepeaterType;
- }
- else if (this.commandinfo.loopNo == 3)
- {
- this.repinfo = brdinfo.Loop3_RepeaterType;
- }
- runBoardIdOK = true;
- }
- }
- if (runBoardIdOK)
- {
-
- repeater_info_unit_all_write_progress();
- }
- else
- {
- MessageBox.Show("설정된 통신보드가 없습니다..");
-
- CompleteProgress();
- }
- }
- break;
- case prt_cmd_define.read_command_status:
- switch (this.commandinfo.CommandType)
- {
-
- case "DC":
- {
- this.Text = "차단설정 명령중..";
- if (this.commandinfo.CommandData != null)
- {
- if (this.commandinfo.ApplyRange.Equals("L"))
- {
- lblDescription.Text = "계통차단명령";
- this.brdinfos = (BoardTypeInfo[])this.commandinfo.CommandData;
- progressBar1.Maximum = this.brdinfos.Length;
- }
- else if (this.commandinfo.ApplyRange.Equals("R"))
- {
- lblDescription.Text = "중계기차단명령";
- this.repinfo = (RepeaterDeviceTypeInfo[])this.commandinfo.CommandData;
- progressBar1.Maximum = this.repinfo.Length;
- }
- else if (this.commandinfo.ApplyRange.Equals("A"))
- {
- lblDescription.Text = "연동타입차단명령";
- this.devTypes = (controlWriteDevType[])this.commandinfo.CommandData;
- progressBar1.Maximum = this.devTypes.Length;
- }
- else if (this.commandinfo.ApplyRange.Equals("I"))
- {
- lblDescription.Text = "입력회로 차단명령";
- progressBar1.Maximum = 2;
- }
- else if (this.commandinfo.ApplyRange.Equals("O"))
- {
- lblDescription.Text = "출력회로 차단명령";
- progressBar1.Maximum = 2;
- }
- cut_flag_progress();
- }
- else
- {
- MessageBox.Show("데이터가 유효하지 않습니다.. 설정데이터를 알수 없습니다.");
-
- CompleteProgress();
- }
- break;
- }
-
- case "CS":
- {
- progressBar1.Maximum = 4;
- this.Text = "환경설정 변경중..";
- lblDescription.Text = "환경설정 변경명령";
- if (this.commandinfo.CommandData != null)
- {
- this.configVoChg = (ReceiverConfigVo)this.commandinfo.CommandData;
- config_change_progress();
- }
- else
- {
- MessageBox.Show("데이터가 유효하지 않습니다.. 설정데이터를 알수 없습니다.");
-
- CompleteProgress();
- }
- break;
- }
- default:
- lblDescription.Text = "알수없는명령";
- break;
- }
- break;
- default:
- break;
- }
- this.Refresh();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
-
- }
- }
-
- private void config_change_progress()
- {
- try
- {
-
- bool runCommandOK = false;
- progressBar1.Value += 1;
- progressBar1.Refresh();
-
- dCommandResponse d = new dCommandResponse(command_complete);
- this.commandinfo.dEvent = d;
- if (this.configVoChg.Fire_accumulation_mode != this.configVoMy.Fire_accumulation_mode)
- {
-
- bool mode = this.configVoChg.Fire_accumulation_mode;
- this.commandinfo.SubType = "A";
- this.commandinfo.Status = mode ? 1 : 0;
- this.configVoMy.Fire_accumulation_mode = mode;
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- return;
- }
-
- if (this.configVoChg.Fire_accumulation_mode && this.configVoChg.Fire_accumulation_time != this.configVoMy.Fire_accumulation_time)
- {
-
- this.commandinfo.SubType = "T";
- this.commandinfo.Status = this.configVoChg.Fire_accumulation_time;
- this.configVoMy.Fire_accumulation_time = this.configVoChg.Fire_accumulation_time;
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- return;
- }
- if (this.configVoChg.Fire_process_mode != this.configVoMy.Fire_process_mode)
- {
-
- bool mode = this.configVoChg.Fire_process_mode;
- this.commandinfo.SubType = "F";
- this.commandinfo.Status = mode ? 1 : 0;
- this.configVoMy.Fire_process_mode = mode;
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- return;
- }
-
-
- if (!runCommandOK) CompleteProgress();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void cut_flag_progress()
- {
- try
- {
-
- bool runCommandOK = false;
- progressBar1.Value += 1;
- progressBar1.Refresh();
-
- dCommandResponse d = new dCommandResponse(command_complete);
- this.commandinfo.dEvent = d;
- switch (this.commandinfo.ApplyRange)
- {
- case "A":
- {
- foreach (controlWriteDevType devtp in this.devTypes)
- {
- if (devtp.ChangeFlag)
- {
- this.commandinfo.CommId = 1;
- this.commandinfo.loopNo = 0;
- this.commandinfo.Status = devtp.Use_flag ? 0 : 1;
- this.commandinfo.SubType = devtp.Dev_type.Substring(1);
- devtp.ChangeFlagReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
- }
- if (!runCommandOK) CompleteProgress();
- break;
- }
- case "C": break;
- case "B": break;
- case "L":
- {
-
- int boardID_init = 0;
- int boardID_cnt = 0;
-
- if (mdi.ReceiverModel == "IFC3300")
- {
- boardID_init = 0;
- boardID_cnt = 65;
- }
- else
- {
- boardID_init = 0;
- boardID_cnt = 16;
- }
- for (int i = boardID_init; i < boardID_cnt; i++)
- {
- if (this.brdinfos[i] != null)
- {
- if (this.brdinfos[i].Loop0CutFlagChange)
- {
- this.commandinfo.boardNo = i + 1;
- this.commandinfo.loopNo = 0;
- this.commandinfo.Status = this.brdinfos[i].Loop0CutFlag ? 0 : 1;
- this.brdinfos[i].Loop0CutFlagChangeReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
- else if (this.brdinfos[i].Loop1CutFlagChange)
- {
- this.commandinfo.boardNo = i + 1;
- this.commandinfo.loopNo = 1;
- this.commandinfo.Status = this.brdinfos[i].Loop1CutFlag ? 0 : 1;
- this.brdinfos[i].Loop1CutFlagChangeReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
-
- else if (this.brdinfos[i].Loop2CutFlagChange)
- {
- this.commandinfo.boardNo = i + 1;
- this.commandinfo.loopNo = 2;
- this.commandinfo.Status = this.brdinfos[i].Loop2CutFlag ? 0 : 1;
- this.brdinfos[i].Loop2CutFlagChangeReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
- else if (this.brdinfos[i].Loop3CutFlagChange)
- {
- this.commandinfo.boardNo = i + 1;
- this.commandinfo.loopNo = 3;
- this.commandinfo.Status = this.brdinfos[i].Loop3CutFlag ? 0 : 1;
- this.brdinfos[i].Loop3CutFlagChangeReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
- }
- }
- if (!runCommandOK) CompleteProgress();
- break;
- }
- case "R":
- {
- for (int i = 0; i < this.repinfo.Length; i++)
- {
- if (this.repinfo[i] != null)
- {
- if (this.repinfo[i].CutFlagChange)
- {
- this.commandinfo.repeaterNo = this.repinfo[i].RepeaterNo;
- this.commandinfo.Status = this.repinfo[i].CutFlag ? 0 : 1;
- this.repinfo[i].CutFlagChangeReset();
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- break;
- }
- }
- }
- if (!runCommandOK) CompleteProgress();
- break;
- }
- case "D": break;
- case "I":
- if (this.commandinfo.CommandData.ToString().Equals("CUTCOMMAND"))
- {
- this.commandinfo.CommandData = "COMPLETE";
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- }
- if (!runCommandOK) CompleteProgress();
- break;
- case "O":
- if (this.commandinfo.CommandData.ToString().Equals("CUTCOMMAND"))
- {
- this.commandinfo.CommandData = "COMPLETE";
-
- runCommandOK = true;
- ui.runCommand(this.commandinfo);
- }
- if (!runCommandOK) CompleteProgress();
- break;
- default: break;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void repeater_info_unit_write_progress()
- {
- try
- {
-
- dCommandResponse d = new dCommandResponse(command_complete);
- this.commandinfo.dEvent = d;
-
- int repeaterNo = this.commandinfo.repeaterNo + 1;
- if (repeaterNo <= 127)
- {
- progressBar1.Value += 1;
- progressBar1.Refresh();
- int repeaterType = 0;
- bool CutFlag = false;
- bool FireResetFlag = false;
- if (repinfo[repeaterNo - 1] != null)
- {
- if (repinfo[repeaterNo - 1].UseFlag)
- {
-
-
-
-
-
-
- if (repinfo[repeaterNo - 1].RepeaterType == "A")
- repeaterType = 1;
- else if (repinfo[repeaterNo - 1].RepeaterType == "B")
- repeaterType = 2;
- else if (repinfo[repeaterNo - 1].RepeaterType == "C")
- repeaterType = 4;
- else if (repinfo[repeaterNo - 1].RepeaterType == "D")
- repeaterType = 5;
- CutFlag = repinfo[repeaterNo - 1].CutFlag;
- FireResetFlag = repinfo[repeaterNo - 1].FireResetFlag;
- }
- else
- {
- repeaterType = 0;
- CutFlag = false;
- FireResetFlag = false;
- }
- }
-
- this.commandinfo.repeaterNo = repeaterNo;
-
- RepeaterData data = new RepeaterData((byte)repeaterNo);
- data.Set_Info_Data(CutFlag, FireResetFlag, false, false, repeaterType);
- this.commandinfo.CommandData = data;
-
- ui.runCommand(this.commandinfo);
- }
- else
- {
-
- CompleteProgress();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void repeater_info_unit_all_write_progress()
- {
- try
- {
-
- bool runCommandOK = false;
-
- bool runBoardIdOK = true;
- while (!runCommandOK)
- {
-
- dCommandResponse d = new dCommandResponse(command_complete);
- this.commandinfo.dEvent = d;
-
- int repeaterNo = this.commandinfo.repeaterNo + 1;
- int loopNo = this.commandinfo.loopNo;
- int boardId = this.commandinfo.boardNo;
- if (repeaterNo > 127)
- {
- repeaterNo = 1;
- runBoardIdOK = false;
- while (!runBoardIdOK)
- {
- ++loopNo;
- if (loopNo > 1)
- {
- loopNo = 0;
- ++boardId;
-
- int boardID_cnt = 0;
-
- if (mdi.ReceiverModel == "IFC3300")
- {
- boardID_cnt = 64;
- }
- else
- {
- boardID_cnt = 16;
- }
-
-
- if (boardId > boardID_cnt)
- {
- runBoardIdOK = false;
-
- CompleteProgress();
- return;
- }
- }
- BoardTypeInfo brdinfo = this.configReceiverPoint.Get_RepeaterType(boardId);
- if (brdinfo != null)
- {
- runBoardIdOK = true;
-
- if (loopNo == 0)
- {
- this.repinfo = brdinfo.Loop0_RepeaterType;
- }
- else if (loopNo == 1)
- {
- this.repinfo = brdinfo.Loop1_RepeaterType;
- }
- else if (loopNo == 2)
- {
- this.repinfo = brdinfo.Loop2_RepeaterType;
- }
- else if (loopNo == 3)
- {
- this.repinfo = brdinfo.Loop3_RepeaterType;
- }
- }
- }
- }
- progressBar1.Value += 1;
- progressBar1.Refresh();
-
- this.commandinfo.repeaterNo = repeaterNo;
-
- this.commandinfo.boardNo = boardId;
- this.commandinfo.loopNo = loopNo;
- int repeaterType = 0;
- bool CutFlag = false;
- bool FireResetFlag = false;
- if (this.repinfo[repeaterNo - 1] != null)
- {
- if (this.repinfo[repeaterNo - 1].UseFlag)
- {
-
-
-
-
-
-
- if (repinfo[repeaterNo - 1].RepeaterType == "A")
- repeaterType = 1;
- else if (repinfo[repeaterNo - 1].RepeaterType == "B")
- repeaterType = 2;
- else if (repinfo[repeaterNo - 1].RepeaterType == "C")
- repeaterType = 4;
- else if (repinfo[repeaterNo - 1].RepeaterType == "D")
- repeaterType = 5;
- CutFlag = this.repinfo[repeaterNo - 1].CutFlag;
- FireResetFlag = repinfo[repeaterNo - 1].FireResetFlag;
- }
- else
- {
- repeaterType = 0;
- CutFlag = false;
- FireResetFlag = false;
- }
- }
- runCommandOK = true;
- RepeaterData data = new RepeaterData((byte)repeaterNo);
- data.Set_Info_Data(CutFlag, FireResetFlag, false, false, repeaterType);
- this.commandinfo.CommandData = data;
-
- ui.runCommand(this.commandinfo);
- break;
- }
-
-
-
-
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- public void command_complete(CmdInfo resInfo)
- {
- try
- {
- if (this.complete) return;
- switch (this.commandinfo.Command)
- {
-
- case prt_cmd_define.write_repeater_info_unit:
- {
- if (this.configReceiverPointAllWrite)
- {
-
-
-
- String thisLog = String.Format("통신보드#{0} 계통#{1} 중계기#{2} UNIT 정보 쓰기", resInfo.boardNo, resInfo.loopNo, resInfo.repeaterNo);
- lblDescription.Text = thisLog;
- if (resInfo.ErrResponse)
- {
- ListViewLogAdd(thisLog + ":" + resInfo.ErrMessage);
- Application.DoEvents();
- }
- else
- {
- ListViewLogAdd(thisLog + ": 완료");
- }
-
- repeater_info_unit_all_write_progress();
-
- }
- else
- {
-
-
-
- String thisLog = String.Format("통신보드#{0} 계통#{1} 중계기#{2} UNIT 정보 쓰기", resInfo.boardNo, resInfo.loopNo, resInfo.repeaterNo);
- lblDescription.Text = thisLog;
- if (resInfo.ErrResponse)
- {
- ListViewLogAdd(thisLog + ":" + resInfo.ErrMessage);
- Application.DoEvents();
- }
- else
- {
- ListViewLogAdd(thisLog + ": 완료");
- }
-
- repeater_info_unit_write_progress();
-
- }
- break;
- }
- case prt_cmd_define.read_command_status:
- {
- switch (this.commandinfo.CommandType)
- {
- case "DC":
- {
- this.Text = "차단설정 명령중..";
- string actionMsg = resInfo.Status == 0 ? "설정" : "해제";
- String thisLog = "차단설정 명령";
- if (this.commandinfo.ApplyRange.Equals("L"))
- {
- thisLog = String.Format("통신보드#{0} 계통#{1} 차단{2}명령", resInfo.boardNo, resInfo.loopNo, actionMsg);
- }
- else if (this.commandinfo.ApplyRange.Equals("R"))
- {
- thisLog = String.Format("통신보드#{0} 계통#{1} 중계기#{2} 차단{3}명령", resInfo.boardNo, resInfo.loopNo, resInfo.repeaterNo, actionMsg);
- }
- else if (this.commandinfo.ApplyRange.Equals("I"))
- {
- thisLog = String.Format("통신보드#{0} 계통#{1} 중계기#{2} 입력회로#{3} 차단{4}명령", resInfo.boardNo, resInfo.loopNo, resInfo.repeaterNo, resInfo.DeviceId, actionMsg);
- }
- else if (this.commandinfo.ApplyRange.Equals("O"))
- {
- thisLog = String.Format("통신보드#{0} 계통#{1} 중계기#{2} 출력회로#{3} 차단{4}명령", resInfo.boardNo, resInfo.loopNo, resInfo.repeaterNo, resInfo.DeviceId, actionMsg);
- }
- else if (this.commandinfo.ApplyRange.Equals("A"))
- {
-
- actionMsg = resInfo.Status == 1 ? "정지" : "연동";
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(resInfo.receiverID);
- string deviceTypeName = dacDeviceConfig.Device_Type_Name(code_InOutType.Output, string.Format("O{0}", resInfo.SubType));
- thisLog = String.Format("{0} 연동타입 {1}명령", deviceTypeName, actionMsg);
- }
- lblDescription.Text = thisLog;
- if (resInfo.ErrResponse)
- {
- ListViewLogAdd(thisLog + ":" + resInfo.ErrMessage);
- Application.DoEvents();
- }
- else
- {
- ListViewLogAdd(thisLog + ": 완료");
- }
-
- if (download_type != 0)
- {
- CompleteProgress(true, 1000);
- }
- else
- {
- cut_flag_progress();
- }
- break;
- }
-
- case "CS":
- {
- this.Text = "환경설정 변경중..";
- String thisLog = "알수없음.";
- switch (resInfo.SubType)
- {
- case "A": thisLog = "축적모드 변경"; break;
- case "T": thisLog = "축적시간 변경"; break;
- case "F": thisLog = "화재모드 변경"; break;
- case "S": thisLog = "지구음향모드 변경"; break;
- }
- lblDescription.Text = thisLog;
- if (resInfo.ErrResponse)
- {
- ListViewLogAdd(thisLog + ":" + resInfo.ErrMessage);
- Application.DoEvents();
- }
- else
- {
- ListViewLogAdd(thisLog + ": 완료");
- }
-
- config_change_progress();
- break;
- }
- default: break;
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void CompleteProgress()
- {
- try
- {
- this.complete = true;
- progressBar1.Value = progressBar1.Maximum;
- btnOK.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void ListViewLogAdd(String msg)
- {
- try
- {
- int cnt = listView1.Items.Count;
- ListViewItem item = new ListViewItem(Convert.ToString(cnt + 1));
- item.SubItems.Add(msg);
- listView1.Items.Add(item);
- listView1.EnsureVisible(cnt);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void CompleteProgress(bool closePopup, int time)
- {
- try
- {
- this.complete = true;
- progressBar1.Value = progressBar1.Maximum;
- btnOK.Enabled = true;
- if (closePopup == true)
- {
- m_closetime_start = Environment.TickCount;
- m_closetime = time;
- timer_Close_Tick(null, EventArgs.Empty);
- timer_Close.Enabled = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- int m_closetime_start = 0;
- int m_closetime = 0;
- private void timer_Close_Tick(object sender, EventArgs e)
- {
- try
- {
-
- if (m_closetime_start + m_closetime < Environment.TickCount)
- {
- this.Cursor = Cursors.Default;
- this.Close();
- }
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- }
- }
|