/// <summary> /// 서버 로컬IP를 받아 Dual Session을 관리 및 초기화한다. /// </summary> /// <param name="localIpAddr">서버 로컬IP</param> private void InitDualSession(string localIpAddr) { try { PDevInfo devInfo = this.mmfMng.GetPDevInfoByIp(localIpAddr); if (devInfo == null) { MessageBox.Show("IP가 정상적이지 않습니다.", "듀얼시스템 관리", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (devInfo.DevId == NCasDefineDeviceKind.AlarmCtrlSys1) { this.profile = new NCasProfile(); this.profile.IpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(localIpAddr, 0, 0, 0, 1); this.profile.Port = (int)NCasPortID.PortIdIntDualAll; this.profile.Name = "AlarmCtrlSys2"; this.dualSessionMng = new NCasNetSessionServerMng(); this.dualSessionMng.PollingDatas = new byte[] { 0x01 }; this.dualSessionMng.RecvNetSessionClient += new NCasNetSessionRecvEventHandler(dualSessionMng_RecvNetSessionClient); (this.dualSessionMng as NCasNetSessionServerMng).AddProfile(profile); (this.dualSessionMng as NCasNetSessionServerMng).StartSessionServerMng(localIpAddr, (int)NCasPortID.PortIdIntDualAll); } else if (devInfo.DevId == NCasDefineDeviceKind.AlarmCtrlSys2) { this.profile = new NCasProfile(); this.profile.IpAddr = NCasUtilityMng.INCasCommUtility.SubtractIpAddr(localIpAddr, 0, 0, 0, 1); this.profile.Port = (int)NCasPortID.PortIdIntDualAll; this.profile.Name = "AlarmCtrlSys1"; this.dualSessionMng = new NCasNetSessionClientMng(); this.dualSessionMng.PollingDatas = new byte[] { 0x01 }; this.dualSessionMng.RecvNetSessionClient += new NCasNetSessionRecvEventHandler(dualSessionMng_RecvNetSessionClient); (this.dualSessionMng as NCasNetSessionClientMng).AddProfile(profile); (this.dualSessionMng as NCasNetSessionClientMng).StartSessionClientMng(); } } catch (Exception ex) { NCasLoggingMng.ILogging.WriteLog("MainForm", "DUAL시스템 세션 초기화 시 Exception - " + ex.Message); MessageBox.Show("IP가 정상적이지 않습니다.", "듀얼시스템 관리", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { NCasBizActivator.Active(NCASBIZ.NCasDefine.NCasDefineActivatorCode.ForProv); this.InitMmfInfo(NCasUtilityMng.INCasEtcUtility.GetIPv4()); NCasEnvironmentMng.NCasEnvConfig.NetSessionContext.UseConnectionChecking = true; NCasEnvironmentMng.NCasEnvConfig.NetSessionContext.UsePolling = true; NCasEnvironmentMng.NCasEnvConfig.LoggingContext.UseDebugLogging = true; NCasProfile profile = new NCasProfile(); #if release profile.IpAddr = NCasUtilityMng.INCasCommUtility.AddIpAddr(NCasUtilityMng.INCasEtcUtility.GetIPv4(), 0, 0, 0, 1); #endif #if debug profile.IpAddr = "158.181.17.226"; #endif profile.Port = this.PDMainSessionPort; profile.Name = "PDMainScreen"; this.pDMainTcpServer = new NCasNetSessionServerMng(); this.pDMainTcpServer.PollingDatas = new byte[] { 0x01 }; this.pDMainTcpServer.RecvNetSessionClient += new NCasNetSessionRecvEventHandler(pDMainTcpServer_RecvNetSessionClient); this.pDMainTcpServer.AddProfile(profile); this.pDMainTcpServer.StartSessionServerMng(NCasUtilityMng.INCasEtcUtility.GetIPv4(), this.PDMainSessionPort); this.udpCasMon = new NCasUdpSocket(); this.udpCasMon.Listen(IP_LOOPBACK, (int)NCasPortID.PortIdRecvCasMonData); this.udpCasMon.ReceivedData += new NCasUdpRecvEventHandler(udpCasMon_ReceivedData); this.recvUdpKey = new NCasUdpSocket(); this.recvUdpKey.Listen(this.IP_LOOPBACK, (int)NCasPipes.PipePdaDevAlmKey); this.recvUdpKey.ReceivedData += new NCasUdpRecvEventHandler(recvUdpKey_ReceivedData); this.recvUdpLauncher = new NCasUdpSocket(); this.recvUdpLauncher.Listen(this.IP_LOOPBACK, (int)NCasPipes.PipePdaScreenLauncher); this.recvUdpLauncher.ReceivedData += new NCasUdpRecvEventHandler(recvUdpLauncher_ReceivedData); DeviceStatusMng.LoadDeviceStatusDatas(); PasswordMng.LoadPassword(); NCasContentsMng.LoadTtsOptionFromFile(); TtsDelayTimeMng.LoadTtsDelayTime(); GroupContentMng.LoadGroupContent(); DistIconMng.LoadDistIconDatas(); DisasterBroadFlagMng.LoadDisasterBroadFlag(); this.ttsDelayTime = int.Parse(TtsDelayTimeMng.TtsDelayTime); this.pDAlmScreenBiz = new PDAlmScreenBiz(this); this.InitView(); NCasAnimator.InitAnimator(); this.OpenView(ViewKind.None); this.InitLogoImage(this.provInfo.Code); this.StartTimer(1000); this.Text = "민방위 시도 지진해일 경보시스템 " + NCasUtilityMng.INCasEtcUtility.GetVersionInfo(); this.labelTotalTermCount.Text = this.provInfo.GetUsableAlarmTermCnt().ToString(); #if release PDevInfo pDevInfo = this.mmfMng.GetPDevInfoByIp(NCasUtilityMng.INCasEtcUtility.GetIPv4()); #endif #if debug PDevInfo pDevInfo = this.mmfMng.GetPDevInfoByIp("10.96.1.231"); #endif if (pDevInfo == null) { MessageBox.Show("IP가 정상적이지 않습니다.\n네트워크를 확인하세요.", "시도 지진해일 경보시스템", MessageBoxButtons.OK, MessageBoxIcon.Error); NCasLoggingMng.ILogging.WriteLog("MainForm", "IP가 정상적이지 않습니다."); } if (!(pDevInfo.DevId == NCasDefineDeviceKind.JijinAlarmCtrlSys1)) { MessageBox.Show("IP가 정상적이지 않습니다.\n네트워크를 확인하세요.", "시도 지진해일 경보시스템", MessageBoxButtons.OK, MessageBoxIcon.Error); NCasLoggingMng.ILogging.WriteLog("MainForm", "IP가 정상적이지 않습니다."); } } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("MainForm", "MainForm.OnLoad(EventArgs e) Method", ex); return; } }
/// <summary> /// profile과 연결상태를 입력받아 화면에 표시한다. /// </summary> /// <param name="nCasProfile"></param> /// <param name="isConnect"></param> public void SetProfileStatus(NCasProfile nCasProfile, bool isConnect){ }