示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <summary>
        /// 통제소 장비 ListView 업데이트
        /// </summary>
        private void setServerStatusUpdate()
        {
            foreach (NCasListViewItem listViewItem in this.serverStatusListView.Items)
            {
                if (listViewItem == null)
                {
                    continue;
                }

                if (listViewItem.Name == string.Empty)
                {
                    continue;
                }

                PDevInfo pDevInfo = this.main.MmfMng.GetPDevInfoByIp(listViewItem.Name);

                if (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.Noraml)
                {
                    listViewItem.ImageIndex = 1;
                }
                else
                {
                    listViewItem.ImageIndex = 0;
                }

                listViewItem.SubItems[3].Text = (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.None) ? "없음" :
                                                (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.NoAnswer) ? "무응답" :
                                                (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.Abnormal) ? "이상" : "정상";

                if ((pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.Abnormal) || (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.NoAnswer))
                {
                    listViewItem.SubItems[4].Text = NCasUtilityMng.INCasCommUtility.MakeDateTimeFormatForCasSystem(pDevInfo.DevStsInfo.OccurTimeToDateTime);
                }
                else if (pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.Noraml || pDevInfo.DevStsInfo.Status == NCasDefineNormalStatus.None)
                {
                    listViewItem.SubItems[4].Text = string.Empty;
                }
            }
        }
示例#3
0
        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;
            }
        }
示例#4
0
        /// <summary>
        /// OnLoad override method
        /// </summary>
        /// <param name="e"></param>
        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;
                this.InitDualSession(NCasUtilityMng.INCasEtcUtility.GetIPv4());

                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.PipePcaScreenPlc);
                this.recvUdpKey.ReceivedData += new NCasUdpRecvEventHandler(recvUdpKey_ReceivedData);

                this.recvUdpGis = new NCasUdpSocket();
                this.recvUdpGis.Listen(this.IP_LOOPBACK, (int)NCasPipes.PipePcaScreen);
                this.recvUdpGis.ReceivedData += new NCasUdpRecvEventHandler(recvUdpGis_ReceivedData);

                this.recvUdpLauncher = new NCasUdpSocket();
                this.recvUdpLauncher.Listen(this.IP_LOOPBACK, (int)NCasPipes.PipePcaScreenLauncher);
                this.recvUdpLauncher.ReceivedData += new NCasUdpRecvEventHandler(recvUdpLauncher_ReceivedData);

                this.recvCenterAlarm = new NCasUdpSocket();
                this.recvCenterAlarm.Listen(this.IP_LOOPBACK, (int)NCasPipes.PipePcaScreenAlm);
                this.recvCenterAlarm.ReceivedData += new NCasUdpRecvEventHandler(recvCenterAlarm_ReceivedData);

                KeyDataMng.LoadKeyDatas();
                DeviceStatusMng.LoadDeviceStatusDatas();
                PasswordMng.LoadPassword();
                GroupContentMng.LoadGroupContent();
                NCasContentsMng.LoadTtsOptionFromFile();
                TtsDelayTimeMng.LoadTtsDelayTime();
                TeleSendDelayTimeMng.LoadTeleDelayTime();

                this.ttsDelayTime  = int.Parse(TtsDelayTimeMng.TtsDelayTime);
                this.teleDelayTime = int.Parse(TeleSendDelayTimeMng.TeleDelayTime);
                this.pAlmScreenBiz = new PAlmScreenBiz(this);
                this.InitDeviceStatus();
                this.InitView();
                NCasAnimator.InitAnimator();
                this.OpenView(ViewKind.None);
                this.InitLogoImage(this.provInfo.Code);
                this.StartTimer(1000);
                this.Text = "민방위 시도 경보대시스템 " + NCasUtilityMng.INCasEtcUtility.GetVersionInfo();
                PDevInfo pDevInfo = this.mmfMng.GetPDevInfoByIp(NCasUtilityMng.INCasEtcUtility.GetIPv4());

                if (pDevInfo == null)
                {
                    MessageBox.Show("IP가 정상적이지 않습니다.\n네트워크를 확인하세요.", "시도 경보대시스템", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    NCasLoggingMng.ILogging.WriteLog("MainForm", "IP가 정상적이지 않습니다.");
                    return;
                }

                if (!(pDevInfo.DevId == NCasDefineDeviceKind.AlarmCtrlSys1 || pDevInfo.DevId == NCasDefineDeviceKind.AlarmCtrlSys2))
                {
                    MessageBox.Show("IP가 정상적이지 않습니다.\n네트워크를 확인하세요.", "시도 경보대시스템", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    NCasLoggingMng.ILogging.WriteLog("MainForm", "IP가 정상적이지 않습니다.");
                }

                NCasEnvironmentMng.NCasEnvConfig.LoggingContext.UseDebugLogging = true;
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILoggingException.WriteException("MainForm", "MainForm.OnLoad(EventArgs e) Method", ex);
                return;
            }
        }