Пример #1
0
        /// <summary>
        /// 재난운영대에서 수신되는 데이터 리시브 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pDMainTcpServer_RecvNetSessionClient(object sender, NCasNetSessionRecvEventArgs e)
        {
            if (e.Len == 1)
            {
                return;
            }

            byte[] tmpBuff = new byte[e.Len];
            System.Buffer.BlockCopy(e.Buff, 0, tmpBuff, 0, e.Len);
            XmlSerializer         serializer            = new XmlSerializer(typeof(DistIconDataContainer), new Type[] { typeof(DistIconData) });
            string                tmpStr                = Encoding.UTF8.GetString(tmpBuff, 0, tmpBuff.Length);
            StringReader          sr                    = new StringReader(tmpStr);
            DistIconDataContainer distIconDataContainer = (DistIconDataContainer)serializer.Deserialize(sr);

            DistIconMng.LstDistIconData = distIconDataContainer.LstDistIconData;
            DistIconMng.SaveDistIconDatas();
            OrderView19201080 orderView = (OrderView19201080)this.dicViews[ViewKind.OrderView19201080];

            MethodInvoker invoker = delegate()
            {
                orderView.SetDistIconReArrange();
            };

            if (this.InvokeRequired)
            {
                Invoke(invoker);
            }
            else
            {
                invoker();
            }
        }
Пример #2
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;
            }
        }