/// <summary>
        /// 그룹 정보 로드
        /// </summary>
        public static void LoadGroupContent()
        {
            try
            {
                if (!File.Exists(filePath))
                {
                    #region 그룹 XML파일 생성
                    GroupData groupData = new GroupData();
                    groupData.IsDist = false;
                    GroupContent groupContent = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹1";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹2";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹3";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹4";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹5";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹6";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹7";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹8";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹9";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = false;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "단말그룹10";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = true;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "시군그룹1";
                    GroupContentMng.AddGroupContent(groupContent);

                    groupData        = new GroupData();
                    groupData.IsDist = true;
                    groupContent     = new GroupContent();
                    groupContent.AddGroupData(groupData);
                    groupContent.Title = "시군그룹2";
                    GroupContentMng.AddGroupContent(groupContent);
                    #endregion

                    return;
                }

                using (Stream stream = new FileStream(filePath, FileMode.Open))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(GroupContentContainer));
                    lstGroupContent = (GroupContentContainer)serializer.Deserialize(stream);
                }
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILoggingException.WriteException("GroupContentMng", "LoadGroupContent() Method", ex);
            }
        }
Example #2
0
        /// <summary>
        /// 저장 버튼 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.ncasButton.Name)
                {
                case "termGroupBtn1":
                    GroupContentMng.LstGroupContent[0].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[0].Title = this.groupNameTextBox.Text;
                    GroupData groupData = null;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[0].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn2":
                    GroupContentMng.LstGroupContent[1].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[1].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[1].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn3":
                    GroupContentMng.LstGroupContent[2].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[2].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[2].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn4":
                    GroupContentMng.LstGroupContent[3].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[3].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[3].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn5":
                    GroupContentMng.LstGroupContent[4].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[4].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[4].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn6":
                    GroupContentMng.LstGroupContent[5].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[5].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[5].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn7":
                    GroupContentMng.LstGroupContent[6].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[6].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[6].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn8":
                    GroupContentMng.LstGroupContent[7].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[7].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[7].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn9":
                    GroupContentMng.LstGroupContent[8].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[8].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[8].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "termGroupBtn10":
                    GroupContentMng.LstGroupContent[9].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[9].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[9].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "distGroupBtn1":
                    GroupContentMng.LstGroupContent[10].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[10].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[10].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;

                case "distGroupBtn2":
                    GroupContentMng.LstGroupContent[11].LstGroupData.Clear();
                    GroupContentMng.LstGroupContent[11].Title = this.groupNameTextBox.Text;

                    for (int i = 0; i < this.groupListView.Items.Count; i++)
                    {
                        if (this.groupListView.Items[i].Checked)
                        {
                            groupData        = new GroupData();
                            groupData.IpAddr = this.groupListView.Items[i].Name;
                            groupData.IsDist = false;
                            groupData.Title  = this.groupListView.Items[i].SubItems[1].Text;
                            GroupContentMng.LstGroupContent[11].LstGroupData.Add(groupData);
                        }
                    }

                    GroupContentMng.SaveGroupContent();
                    break;
                }

                MessageBox.Show("그룹 정보가 저장되었습니다.", "그룹 편집", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                NCasLoggingMng.ILoggingException.WriteException("OrderGroupEditForm", "OrderGroupEditForm.saveBtn_Click Method", ex);
                MessageBox.Show("그룹 정보 저장에 실패했습니다.\n다시 시도하세요.", "그룹 편집", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #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;
            }
        }