/// <summary> /// 저장 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveBtn_Click(object sender, EventArgs e) { if (this.SaveValidation()) { AdengUtil.INIWriteValueString(this.setting, this.portNum, this.ComPortCB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.baudRate, this.BaudRateCB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.dataBits, this.DataBitsCB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.stopBit, this.StopBitCB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.udpIp, this.UdpIpTB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.udpPort, this.UdpPortTB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.tcpIp, this.TcpIpTB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.tcpPort, this.TcpPortTB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.tcpSvrIp, this.TcpSvrIpTB.Text, IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.tcpSvrPort, this.TcpSvrPortTB.Text, IniFilePath); string tmpStr = (this.ParityCB.Text == "홀수") ? "2" : (this.ParityCB.Text == "짝수") ? "1" : "0"; AdengUtil.INIWriteValueString(this.setting, this.parity, tmpStr, IniFilePath); this.SaveBtn.Enabled = false; } else { MessageBox.Show("정보를 확인하세요.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 환경 설정창에서 발생하는 TCP 셋팅 값 변경 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void optionForm_OnTcpSettingEvt(object sender, TcpSettingEventArgs e) { AdengUtil.INIWriteValueString(this.setting, this.TCPIP, e.Ip, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.TCPPort, e.Port, this.IniFilePath); this.localTcpIp = e.Ip; this.localTcpPort = int.Parse(e.Port); //바뀐 설정값으로 재연결 this.clientSoc.Disconnect(); this.clientSoc.ConnectTo(this.localTcpIp, this.localTcpPort); }
/// <summary> /// 환경 설정창에서 발생하는 Log 셋팅 값 변경 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void optionForm_OnLogSettingEvt(object sender, LogSettingEventArgs e) { if (e.State) { AdengUtil.INIWriteValueString(this.setting, this.LogFlag, "T", this.IniFilePath); this.logState = true; } else { AdengUtil.INIWriteValueString(this.setting, this.LogFlag, "F", this.IniFilePath); this.logState = false; } }
/// <summary> /// 환경 설정창에서 발생하는 DB 셋팅 값 변경 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void optionForm_OnDbSettingDataEvt(object sender, DbSettingDataEvtArgs e) { AdengUtil.INIWriteValueString(this.setting, this.DBIP, e.DbIp, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBSID, e.DbSid, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBID, e.DbId, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBPW, e.DbPw, this.IniFilePath); if (e.Oracle8) { AdengUtil.INIWriteValueString(this.setting, this.Oracle8i, "T", this.IniFilePath); } else { AdengUtil.INIWriteValueString(this.setting, this.Oracle8i, "F", this.IniFilePath); } }
/// <summary> /// 환경 설정창에서 발생하는 TCP 통신 제어 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void optionForm_OnTcpSocketEvt(object sender, TcpSocketEventArgs e) { if (e.State) //통신연결 { AdengUtil.INIWriteValueString(this.setting, this.TCPIP, e.Ip, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.TCPPort, e.Port, this.IniFilePath); this.localTcpIp = e.Ip; this.localTcpPort = int.Parse(e.Port); this.clientSoc.ConnectTo(this.localTcpIp, this.localTcpPort); } else //연결해제 { this.clientSoc.Disconnect(); this.tcpState = false; this.SetLogListBox(string.Format("TCP {0} / {1} Connect Close!", this.localTcpIp, this.localTcpPort)); this.SetToolLBImage(this.ToolStripStatusLabel3, MewsDBManager.Properties.Resources.IconListRed); this.SetOptionTcpBtn(false); } }
public OrderSelLiveSiren() { InitializeComponent(); label2.Text = LangPack.GetSelSiren(); btnMic.Text = LangPack.GetSiren1(); btnRec.Text = LangPack.GetSiren2(); try { if (AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath) != string.Empty) { msgTime[0] = AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath); } if (AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath) != string.Empty) { msgTime[1] = AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath); } if (!(System.IO.File.Exists(Util.file_Siren + "siren_1.wav"))) { this.LameMp3ToWav(Util.file_Siren + "siren_1.mp3", Util.file_Siren + "siren_1.wav"); } if (!(System.IO.File.Exists(Util.file_Siren + "siren_2.wav"))) { this.LameMp3ToWav(Util.file_Siren + "siren_2.mp3", Util.file_Siren + "siren_2.wav"); } } catch (Exception ex) { AdengUtil.INIWriteValueString(this.setting, "siren1", msgTime[0], IniFilePath); AdengUtil.INIWriteValueString(this.setting, "siren2", msgTime[1], IniFilePath); } }
/// <summary> /// [LocalSetting] 섹션의 키 값 쓰기 /// </summary> /// <param name="keyName">키 이름</param> /// <param name="keyValue">키 값</param> /// <returns></returns> private void WriteKeyValue(string sectionName, string keyName, string keyValue) { AdengUtil.INIWriteValueString(sectionName, keyName, keyValue, INI_PATH); }
/// <summary> /// 환경 설정창에서 발생하는 UDP 셋팅 값 변경 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void optionForm_OnUdpSettingEvt(object sender, TcpSettingEventArgs e) { AdengUtil.INIWriteValueString(this.setting, this.UDPIP, e.Ip, this.IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.UDPPort, e.Port, this.IniFilePath); MessageBox.Show("UDP setting changed. Please program restart!", "EDWS DB Manager", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
/// <summary> /// 초기화 /// </summary> private void init() { //디렉토리가 있는지 체크.. if (!Directory.Exists(this.IniFileDirectoryPath)) { Directory.CreateDirectory(IniFileDirectoryPath); } //파일이 있는지 체크..없으면 파일 생성 if (!File.Exists(IniFilePath)) { AdengUtil.INIWriteValueString(this.setting, this.DBIP, "58.181.17.58", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBSID, "orcl", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBID, "mews33", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.DBPW, "mews", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.Oracle8i, "F", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.TCPIP, "127.0.0.1", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.TCPPort, "9009", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.LogFlag, "F", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.UDPIP, "127.0.0.1", IniFilePath); AdengUtil.INIWriteValueString(this.setting, this.UDPPort, "7001", IniFilePath); } //tcp client socket 생성 this.clientSoc = TCPModClient.getTCPModClient(); this.clientSoc.evConnected += new TCPModClient.ConnectedHandler(clientSoc_evConnected); this.clientSoc.evConnectFailed += new TCPModClient.ConnectedFailedHandler(clientSoc_evConnectFailed); this.clientSoc.evDisconnected += new TCPModClient.DisconnectedHandler(clientSoc_evDisconnected); this.clientSoc.evReceived += new TCPModClient.ReceivedHandler(clientSoc_evReceived); this.clientSoc.evSendFailed += new TCPModClient.SendFailedHandler(clientSoc_evSendFailed); this.clientSoc.evTimeout += new TCPModClient.TimeOutHandler(clientSoc_evTimeout); //udp socket 생성 try { this.udpSoc = new AdengUdpSocket(AdengUtil.INIReadValueString(this.setting, this.UDPIP, this.IniFilePath), int.Parse(AdengUtil.INIReadValueString(this.setting, this.UDPPort, this.IniFilePath))); this.udpSoc.recvEvtHandler += new RecvEvtHandler(udpSoc_recvEvtHandler); this.SetLogListBox("UDP Success!"); } catch (Exception ex) { this.SetLogListBox("UDP Fail!"); } //data Manager 생성 this.dataMng = DBMngDataMng.getInstance(); this.dataMng.OnTermStateTCPSendEvt += new EventHandler <TermStateTCPSendEvtArgs>(dataMng_OnTermStateTCPSendEvt); //queue 생성 this.insertQ = new Queue <PrtBase>(); try { //로그 셋팅 값을 가져온다. this.logState = (AdengUtil.INIReadValueString(this.setting, this.LogFlag, IniFilePath) == "T" ? true : false); //TCP 연결 this.localTcpIp = AdengUtil.INIReadValueString(this.setting, this.TCPIP, this.IniFilePath); this.localTcpPort = int.Parse(AdengUtil.INIReadValueString(this.setting, this.TCPPort, this.IniFilePath)); this.clientSoc.ConnectTo(this.localTcpIp, this.localTcpPort); } catch (Exception ex) { Debug.WriteLine("MewsMain.init - " + ex.Message); } //폴링 데이터 처리 PrtBase p9 = PrtMng.GetPrtObject(9); p9.MakeData(); byte[] buff = PrtMng.MakeFrame(p9); this.clientSoc.BtPoll = buff; //기초데이터 로드 (단말) if (this.TryConnect()) { if (this.dataMng.InitDataLoad()) { this.SetLogListBox("Init Data Load Success!"); } else { this.SetLogListBox("Init Data Load Fail (DB Read Fail!)"); } } else { this.SetLogListBox("Init Data Load Fail (DB Connect Fail!)"); } //처리한 큐 카운트를 라벨에 셋팅한다. this.procCountTD = new Thread(new ThreadStart(this.SetDataProcCnt)); this.procCountTD.IsBackground = true; this.procCountTD.Start(); //큐처리 this.proc.runAsyncProcess += new InvokeValue(proc_runAsyncProcess); this.proc.Start(); //프로그램 제목 최신 버전 표시 this.Text += version1; //시작 로그 if (this.logState) { MTextLog.WriteTextLog(true, this.Text + " START"); } }