/// <summary>
        /// 측기의 데이터를 리스트뷰에 셋팅한다.
        /// </summary>
        /// <param name="_wdi"></param>
        private void SetLVWDeviceItemData(WDeviceItem _wdi, byte _cmd)
        {
            switch (_cmd)
            {
            case 1:
                switch (_wdi.FKDeviceItem)
                {
                case (uint)WeatherDataMng.WIType.강수임계치1단계:
                    this.WData1LV.Items[_wdi.FKDevice.ToString()].SubItems[10].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;

                case (uint)WeatherDataMng.WIType.강수임계치2단계:
                    this.WData1LV.Items[_wdi.FKDevice.ToString()].SubItems[11].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;

                case (uint)WeatherDataMng.WIType.강수임계치3단계:
                    this.WData1LV.Items[_wdi.FKDevice.ToString()].SubItems[12].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;
                }
                break;

            case 2:
                switch (_wdi.FKDeviceItem)
                {
                case (uint)WeatherDataMng.WIType.수위임계치1단계:
                    this.WData2LV.Items[_wdi.FKDevice.ToString()].SubItems[10].Text = string.Format("{0}", double.Parse(_wdi.Value));
                    break;

                case (uint)WeatherDataMng.WIType.수위임계치2단계:
                    this.WData2LV.Items[_wdi.FKDevice.ToString()].SubItems[11].Text = string.Format("{0}", double.Parse(_wdi.Value));
                    break;

                case (uint)WeatherDataMng.WIType.수위임계치3단계:
                    this.WData2LV.Items[_wdi.FKDevice.ToString()].SubItems[12].Text = string.Format("{0}", double.Parse(_wdi.Value));
                    break;
                }
                break;

            case 3:
                switch (_wdi.FKDeviceItem)
                {
                case (uint)WeatherDataMng.WIType.속임계치1단계:
                    this.WData3LV.Items[_wdi.FKDevice.ToString()].SubItems[9].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;

                case (uint)WeatherDataMng.WIType.속임계치2단계:
                    this.WData3LV.Items[_wdi.FKDevice.ToString()].SubItems[10].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;

                case (uint)WeatherDataMng.WIType.속임계치3단계:
                    this.WData3LV.Items[_wdi.FKDevice.ToString()].SubItems[11].Text = string.Format("{0}", double.Parse(_wdi.Value) * 0.1);
                    break;
                }
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 측기 알람 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataMng_onWDeviceAlarmEvt(object sender, WDeviceAlarmItemsEventArgs e)
        {
            if (e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.FAN || e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.DOOR)
            {
                WDeviceItem wDeviceItem = new WDeviceItem(
                    e.WDeviceAlarm.PKID,
                    e.WDeviceAlarm.FKDevice,
                    e.WDeviceAlarm.FKDeviceItem,
                    e.WDeviceAlarm.DDTime,
                    e.WDeviceAlarm.Value);

                if (this.WeatherListView.InvokeRequired)
                {
                    this.Invoke(new InvokeSetWDeviceItemData(this.SetWDeviceItemDataM), new object[] { wDeviceItem });
                }
                else
                {
                    this.SetWDeviceItemDataM(wDeviceItem);
                }
            }
            else if (e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리1전압상태 ||
                     e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리1온도상태)
            {
                WDeviceItem wDeviceItem = new WDeviceItem(
                    e.WDeviceAlarm.PKID,
                    e.WDeviceAlarm.FKDevice,
                    (uint)WeatherDataMng.WIType.배터리상태,
                    e.WDeviceAlarm.DDTime,
                    e.WDeviceAlarm.Value);

                if (this.WeatherListView.InvokeRequired)
                {
                    this.Invoke(new InvokeSetWDeviceItemData(this.SetWDeviceItemDataM), new object[] { wDeviceItem });
                }
                else
                {
                    this.SetWDeviceItemDataM(wDeviceItem);
                }
            }
            else if (e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리2전압상태 ||
                     e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리2온도상태)
            {
                WDeviceItem wDeviceItem = new WDeviceItem(
                    e.WDeviceAlarm.PKID,
                    e.WDeviceAlarm.FKDevice,
                    (uint)WeatherDataMng.WIType.배터리2상태,
                    e.WDeviceAlarm.DDTime,
                    e.WDeviceAlarm.Value);

                if (this.WeatherListView.InvokeRequired)
                {
                    this.Invoke(new InvokeSetWDeviceItemData(this.SetWDeviceItemDataM), new object[] { wDeviceItem });
                }
                else
                {
                    this.SetWDeviceItemDataM(wDeviceItem);
                }
            }
            else if (e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리1교체시기)
            {
                WDeviceItem wDeviceItem = new WDeviceItem(
                    e.WDeviceAlarm.PKID,
                    e.WDeviceAlarm.FKDevice,
                    (uint)WeatherDataMng.WIType.배터리상태,
                    e.WDeviceAlarm.DDTime,
                    "1");

                if (this.WeatherListView.InvokeRequired)
                {
                    this.Invoke(new InvokeSetWDeviceItemData(this.SetWDeviceItemDataM), new object[] { wDeviceItem });
                }
                else
                {
                    this.SetWDeviceItemDataM(wDeviceItem);
                }
            }
            else if (e.WDeviceAlarm.FKDeviceItem == (uint)WeatherDataMng.WIType.배터리2교체시기)
            {
                WDeviceItem wDeviceItem = new WDeviceItem(
                    e.WDeviceAlarm.PKID,
                    e.WDeviceAlarm.FKDevice,
                    (uint)WeatherDataMng.WIType.배터리2상태,
                    e.WDeviceAlarm.DDTime,
                    "1");

                if (this.WeatherListView.InvokeRequired)
                {
                    this.Invoke(new InvokeSetWDeviceItemData(this.SetWDeviceItemDataM), new object[] { wDeviceItem });
                }
                else
                {
                    this.SetWDeviceItemDataM(wDeviceItem);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 측기의 데이터 또는 상태 값 등을 받아 리스트에 셋팅한다.
        /// </summary>
        /// <param name="_wdi"></param>
        public void SetWDeviceItemDataM(WDeviceItem _wdi)
        {
            switch (_wdi.FKDeviceItem)
            {
            case (uint)WeatherDataMng.WIType.동일레벨무시시간:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[6].Text = string.Format("{0} 분", uint.Parse(_wdi.Value));
                break;

            case (uint)WeatherDataMng.WIType.하향레벨무시시간:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[7].Text = string.Format("{0} 분", uint.Parse(_wdi.Value));
                break;

            case (uint)WeatherDataMng.WIType.배터리전압:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[8].Text = string.Format("{0} (V)", double.Parse(_wdi.Value) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리전류:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[9].Text = string.Format("{0}/{1} (A)",
                                                                                                      (_wdi.Value[0] == '+') ? "충전 중" : "방전 중", double.Parse(_wdi.Value.Substring(1, 4)) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리저항:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[10].Text = string.Format("{0} (mΩ)", double.Parse(_wdi.Value) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리온도:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[11].Text = string.Format("{0} {1} (℃)",
                                                                                                       (_wdi.Value[0] == '+') ? "영상" : "영하", double.Parse(_wdi.Value.Substring(1, 4)) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리수명:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[12].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" :
                                                                                                       (_wdi.Value == "1") ? "점검 요망" : "교환");
                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[12].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1" || _wdi.Value == "2")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[12].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.배터리상태:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[13].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" : "이상");

                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[13].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[13].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.배터리2전압:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[14].Text = string.Format("{0} (V)", double.Parse(_wdi.Value) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리2전류:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[15].Text = string.Format("{0}/{1} (A)",
                                                                                                       (_wdi.Value[0] == '+') ? "충전 중" : "방전 중", double.Parse(_wdi.Value.Substring(1, 4)) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리2저항:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[16].Text = string.Format("{0} (mΩ)", double.Parse(_wdi.Value) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리2온도:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[17].Text = string.Format("{0} {1} (℃)",
                                                                                                       (_wdi.Value[0] == '+') ? "영상" : "영하", double.Parse(_wdi.Value.Substring(1, 4)) * 0.1);
                break;

            case (uint)WeatherDataMng.WIType.배터리2수명:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[18].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" :
                                                                                                       (_wdi.Value == "1") ? "점검 요망" : "교환");
                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[18].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1" || _wdi.Value == "2")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[18].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.배터리2상태:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[19].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" : "이상");

                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[19].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[19].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.FAN:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[20].Text = string.Format("{0}", (_wdi.Value == "0") ? "이상" :
                                                                                                       (_wdi.Value == "1") ? "정상(ON)" : "정상(OFF)");

                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[20].ForeColor = Color.OrangeRed;
                }
                else if (_wdi.Value == "1" || _wdi.Value == "2")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[20].ForeColor = Color.Black;
                }
                break;

            case (uint)WeatherDataMng.WIType.DOOR:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[21].Text = string.Format("{0}", (_wdi.Value == "0") ? "닫힘" : "열림");

                if (_wdi.Value == "0")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[21].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[21].ForeColor = Color.Blue;
                }
                break;

            case (uint)WeatherDataMng.WIType.펌웨어버전:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[22].Text = string.Format("20{0},{1}", _wdi.Value.Substring(0, 6), _wdi.Value[6]);
                break;

            case (uint)WeatherDataMng.WIType.CDMA감도:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[23].Text = string.Format("{0} (dbm)", _wdi.Value);
                break;

            case (uint)WeatherDataMng.WIType.IP:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[24].Text = string.Format("{0}", _wdi.Value);
                break;

            case (uint)WeatherDataMng.WIType.PORT:
                this.WeatherListView.Items[_wdi.FKDevice.ToString()].SubItems[25].Text = string.Format("{0}", uint.Parse(_wdi.Value));
                break;
            }

            if (this.WeatherListView.SelectedItems.Count == 1)
            {
                if (this.WeatherListView.SelectedItems[0].Name == _wdi.FKDevice.ToString())
                {
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].Selected = false;
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].Focused  = false;
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].Selected = true;
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].Focused  = true;
                    this.WeatherListView.Items[_wdi.FKDevice.ToString()].EnsureVisible();
                }
            }
        }
        /// <summary>
        /// 측기의 데이터 또는 상태 값 등을 받아 리스트에 셋팅한다.
        /// </summary>
        /// <param name="_wdi"></param>
        public void SetWDeviceItemDataM(WDeviceItem _wdi)
        {
            switch (_wdi.FKDeviceItem)
            {
            case (uint)WeatherDataMng.WIType.강수센서상태:
                this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[3].Text = string.Format("{0}",
                                                                                                       (_wdi.Value == "0") ? "정상" :
                                                                                                       (_wdi.Value == "1") ? "이상" :
                                                                                                       (_wdi.Value == "2") ? "이상(합선)" : "이상(단선)");

                if (_wdi.Value == "0")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[3].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1" || _wdi.Value == "2" || _wdi.Value == "3")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[3].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.수위센서상태:
                this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[4].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" : "이상");

                if (_wdi.Value == "0")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[4].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[4].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.속센서상태:
                this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[5].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" : "이상");

                if (_wdi.Value == "0")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[5].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[5].ForeColor = Color.OrangeRed;
                }
                break;

            case (uint)WeatherDataMng.WIType.태양전지:
                this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[6].Text = string.Format("{0}", (_wdi.Value == "0") ? "정상" : "저전압");

                if (_wdi.Value == "0")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[6].ForeColor = Color.Black;
                }
                else if (_wdi.Value == "1")
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].SubItems[6].ForeColor = Color.OrangeRed;
                }
                break;
            }

            if (this.SelfTestDeviceLV.SelectedItems.Count == 1)
            {
                if (this.SelfTestDeviceLV.SelectedItems[0].Name == _wdi.FKDevice.ToString())
                {
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].Selected = false;
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].Focused  = false;
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].Selected = true;
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].Focused  = true;
                    this.SelfTestDeviceLV.Items[_wdi.FKDevice.ToString()].EnsureVisible();
                }
            }
        }