/// <summary> /// 관측소 선택 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void heightSelectComboBox_SelectedIndexChanged(object sender, EventArgs e) { HeightPointContent content = HeightPointContentMng.GetHeightPointContent(this.heightSelectComboBox.SelectedItem as string); foreach (NCasListViewItem eachTerm in this.heightTermListView.Items) { eachTerm.Checked = false; Refresh(); foreach (HeightPointData eachPoint in content.LstHeightPointData) { if (eachTerm.Name != eachPoint.IpAddr) { continue; } eachTerm.Checked = true; Refresh(); break; } } }
/// <summary> /// 관측소 정보 로드 /// </summary> public static void LoadHeightPointContent() { try { if (!File.Exists(filePath)) { #region 관측소 정보생성 HeightPointData heightPointData = new HeightPointData(); HeightPointContent heightPointContent = new HeightPointContent(); heightPointContent.AddHeightPointData(heightPointData); heightPointContent.Title = "관측소1"; heightPointContent.LastTime = new DateTime(); HeightPointContentMng.AddHeightPointContent(heightPointContent); heightPointData = new HeightPointData(); heightPointContent = new HeightPointContent(); heightPointContent.AddHeightPointData(heightPointData); heightPointContent.Title = "관측소2"; heightPointContent.LastTime = new DateTime(); HeightPointContentMng.AddHeightPointContent(heightPointContent); #endregion SaveHeightPointContent(); return; } using (Stream stream = new FileStream(filePath, FileMode.Open)) { XmlSerializer serializer = new XmlSerializer(typeof(HeightPointContentContainer)); lstHeightPointContent = (HeightPointContentContainer)serializer.Deserialize(stream); } } catch (Exception ex) { NCasLoggingMng.ILoggingException.WriteException("HeightPointContentMng", "LoadHeightPointContent() Method", ex); } }
/// <summary> /// 설정정보 저장 메소드 /// </summary> private void Save() { if (this.firstHeightTimeNumeric.Value > this.secondHeightTimeNumeric.Value) { MessageBox.Show("조위 운영시간 설정 시 시작시간이 더 느릴 수 없습니다.\n설정이 저장되지 않았습니다.", "시도 서해안 경보시스템", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (this.firstWeatherTimeNumeric.Value > this.secondWeatherTimeNumeric.Value) { MessageBox.Show("특보 운영시간 설정 시 시작시간이 더 느릴 수 없습니다.\n설정이 저장되지 않았습니다.", "시도 서해안 경보시스템", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if ((int)this.heightValueNumeric.Value >= (int)this.heightValueNumeric2.Value || (int)this.heightValueNumeric2.Value >= (int)this.heightValueNumeric3.Value || (int)this.heightValueNumeric3.Value >= (int)this.heightValueNumeric4.Value) { MessageBox.Show("조위 단계 별 임계치 설정 값은 상위 단계보다 같거나 높은 값으로\n설정할 수 없습니다. 설정이 저장되지 않았습니다.", "시도 서해안 경보시스템", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } #region 조위정보 저장 HeightOptionMng.LstHeightOptionData[0].UseTime = this.heightUseCheckBox.Checked; HeightOptionMng.LstHeightOptionData[0].FirstTime = (int)this.firstHeightTimeNumeric.Value; HeightOptionMng.LstHeightOptionData[0].SecondTime = (int)this.secondHeightTimeNumeric.Value; HeightOptionMng.LstHeightOptionData[0].UseAuto = this.heightAutoCheckBox.Checked; HeightOptionMng.LstHeightOptionData[0].MaxValue = (int)this.heightValueNumeric.Value; HeightOptionMng.LstHeightOptionData[0].MaxValue2 = (int)this.heightValueNumeric2.Value; HeightOptionMng.LstHeightOptionData[0].MaxValue3 = (int)this.heightValueNumeric3.Value; HeightOptionMng.LstHeightOptionData[0].MaxValue4 = (int)this.heightValueNumeric4.Value; HeightOptionMng.LstHeightOptionData[0].Msg = this.heightSelectMsg; HeightOptionMng.LstHeightOptionData[0].Msg2 = this.heightSelectMsg2; HeightOptionMng.LstHeightOptionData[0].Msg3 = this.heightSelectMsg3; HeightOptionMng.LstHeightOptionData[0].Msg4 = this.heightSelectMsg4; HeightOptionMng.LstHeightOptionData[0].TestOrder = this.heightTestOrderCB.Checked; HeightOptionMng.SaveHeightOptionDatas(); if ((this.heightSelectComboBox.SelectedItem as string) != null) { foreach (HeightPointContent eachPointContent in HeightPointContentMng.LstHeightPointContent) { if (eachPointContent.Title != (this.heightSelectComboBox.SelectedItem as string)) { continue; } eachPointContent.LstHeightPointData.Clear(); HeightPointData tmpData = null; foreach (NCasListViewItem eachLvi in this.heightTermListView.Items) { if (eachLvi.Checked == false) { continue; } tmpData = new HeightPointData(); tmpData.Title = eachLvi.SubItems[1].Text; tmpData.IpAddr = eachLvi.Name; eachPointContent.LstHeightPointData.Add(tmpData); } } HeightPointContentMng.SaveHeightPointContent(); } #endregion #region 특보정보 저장 WeatherOptionMng.LstWeatherOptionData[0].UseTime = this.weatherUseCheckBox.Checked; WeatherOptionMng.LstWeatherOptionData[0].FirstTime = (int)this.firstWeatherTimeNumeric.Value; WeatherOptionMng.LstWeatherOptionData[0].SecondTime = (int)this.secondWeatherTimeNumeric.Value; WeatherOptionMng.LstWeatherOptionData[0].UseAuto = this.weatherAutoCheckBox.Checked; WeatherOptionMng.LstWeatherOptionData[0].TestOrder = this.weatherTestOrderCB.Checked; WeatherOptionMng.SaveWeatherOptionDatas(); #endregion }