/// <summary> /// 단일 관측소 정보 가져오기 /// </summary> /// <param name="title"></param> /// <returns></returns> public static HeightPointContent GetHeightPointContent(string title) { HeightPointContent heightPointContent = new HeightPointContent(); foreach (HeightPointContent eachHeightPointContent in lstHeightPointContent.LstHeightPointContent) { if (eachHeightPointContent.Title == title) { heightPointContent = eachHeightPointContent; break; } } return(heightPointContent); }
/// <summary> /// 단일 관측소 정보 저장 /// </summary> /// <param name="groupContent"></param> public static void AddHeightPointContent(HeightPointContent heightPointContent) { foreach (HeightPointContent Content in lstHeightPointContent.LstHeightPointContent) { if (Content.Title == heightPointContent.Title) //기존에 있는 관측소면.. { Content.LstHeightPointData.Clear(); Content.LstHeightPointData = heightPointContent.LstHeightPointData; SaveHeightPointContent(); return; } } lstHeightPointContent.LstHeightPointContent.Add(heightPointContent); SaveHeightPointContent(); }
/// <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); } }