| | |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | string current = Language.StringByID(MyInternationalizationString.current); |
| | | devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 2 - 20 - 50); |
| | | devicefra.Height = Application.GetRealHeight(140 + 160 * 2 + 20 + 50); |
| | | devicefra.Y = Application.GetRealHeight(1920 - 140 - 600); |
| | | devicefra.Height = Application.GetRealHeight(140 + 600); |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | var Btntemperaturevalue = new Button |
| | | SelectedDeviceStatuscondition = "TemperatureSensor"; |
| | | #region 布局View |
| | | var PickerViewfra = new FrameLayout |
| | | { |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | Height = Application.GetRealHeight(60), |
| | | Width = Application.GetRealWidth(400), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | X = Application.GetRealWidth(80), |
| | | Y = timetype.Bottom + Application.GetRealHeight(70), |
| | | TextSize = 14, |
| | | Y = Application.GetRealHeight(140), |
| | | Height = Application.GetRealHeight(600), |
| | | }; |
| | | devicefra.AddChidren(Btntemperaturevalue); |
| | | devicefra.AddChidren(PickerViewfra); |
| | | |
| | | var horizontalSeekBarVol = new DiyImageSeekBar |
| | | |
| | | var mUIPickerView = new UIPickerView |
| | | { |
| | | Y = timetype.Bottom + Application.GetRealHeight(70 + 60 + 70), |
| | | X = Application.GetRealWidth(80), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(160), |
| | | IsProgressTextShow = false,//显示百分比 |
| | | IsClickable = true,//进度条是否滑动 |
| | | ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//选中进度条颜色 |
| | | ThumbImagePath = "ZigeeLogic/progressbtn_2.png",//进度条按钮图标 |
| | | ThumbImageHeight = Application.GetRealHeight(56),//进度条按钮图标的高度(默认正方形:宽和高一样) |
| | | ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,//进度条原颜色 |
| | | //ProgressTextSize = 13,//显示百分比字体大小 |
| | | SeekBarViewHeight = Application.GetRealHeight(10),//进度条的高度 |
| | | Height = Application.GetRealHeight(600 - 5), |
| | | }; |
| | | devicefra.AddChidren(horizontalSeekBarVol); |
| | | PickerViewfra.AddChidren(mUIPickerView); |
| | | |
| | | EventHandler<int> progressclick = (sender, e) => |
| | | var mList1 = new List<string> { ">", "<", "=", "≥", "≤" }; |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | | for (int i = 1; i <=100; i++) |
| | | { |
| | | |
| | | SelectedDeviceStatuscondition = "TemperatureSensor"; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString()); |
| | | |
| | | Btntemperaturevalue.Text = current + ">" + horizontalSeekBarVol.Progress.ToString() + "℃"; |
| | | |
| | | } |
| | | else |
| | | { |
| | | Btntemperaturevalue.Text = current + "<" + horizontalSeekBarVol.Progress.ToString() + "%"; |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());//温度值 |
| | | } |
| | | |
| | | }; |
| | | horizontalSeekBarVol.OnProgressChangedEvent += progressclick; |
| | | horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; |
| | | |
| | | |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | mList2.Add(i.ToString()); |
| | | } |
| | | if (temperatureSensor.SensorDiv == 1) { |
| | | mList3.Add("℃"); |
| | | dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); |
| | | dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | dictionary(deviceConditionsInfo, "Range", "0");//0大于AttriButeData1时触发动作 |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", "0"); |
| | | dictionary(deviceConditionsInfo, "Range", "1");//1:等于AttriButeData1时触发动作 |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", "50");//默认温度值50℃ |
| | | dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | Btntemperaturevalue.Text = current + ">0℃"; |
| | | |
| | | } |
| | | else |
| | | { |
| | | Btntemperaturevalue.Text = current + "<0%"; |
| | | } else { |
| | | mList3.Add("%"); |
| | | dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); |
| | | dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | dictionary(deviceConditionsInfo, "Range", "2");//2小于AttriButeData1时触发动作 |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", "0");//温度值 |
| | | dictionary(deviceConditionsInfo, "Range", "1");//1:等于AttriButeData1时触发动作 |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", "50");//默认湿度值50% |
| | | dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | } |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | |
| | | #endregion |
| | | |
| | | mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => |
| | | { |
| | | SelectedDeviceStatuscondition = "TemperatureSensor"; |
| | | dictionary(deviceConditionsInfo, "AttriButeData1", mList2[s2]); |
| | | switch (mList1[s1]) |
| | | { |
| | | case ">": { |
| | | dictionary(deviceConditionsInfo, "Range", "0"); |
| | | } break; |
| | | case "<": { |
| | | dictionary(deviceConditionsInfo, "Range", "2"); |
| | | } break; |
| | | case "=": { |
| | | dictionary(deviceConditionsInfo, "Range", "1"); |
| | | } break; |
| | | case "≥": { |
| | | dictionary(deviceConditionsInfo, "Range", "6"); |
| | | } break; |
| | | case "≤": { |
| | | dictionary(deviceConditionsInfo, "Range", "7"); |
| | | } break; |
| | | } |
| | | }; |
| | | |
| | | //默认=,50 |
| | | int index1 = 2, index2 = 49; |
| | | if (edit && devices != null) |
| | | { |
| | | horizontalSeekBarVol.Progress = int.Parse(devices["AttriButeData1"]); |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | SelectedDeviceStatuscondition = ""; |
| | | string s = ""; |
| | | switch (devices["Range"]) |
| | | { |
| | | |
| | | Btntemperaturevalue.Text = current + ">" + devices["AttriButeData1"] + "℃"; |
| | | |
| | | case "0": |
| | | { |
| | | s = ">"; |
| | | } |
| | | break; |
| | | case "1": |
| | | { |
| | | s = "="; |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | s = "<"; |
| | | } |
| | | break; |
| | | case "6": |
| | | { |
| | | s = "≥"; |
| | | } |
| | | break; |
| | | case "7": |
| | | { |
| | | s = "≤"; |
| | | } |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | Btntemperaturevalue.Text = current + "<" + devices["AttriButeData1"] + "%"; |
| | | } |
| | | //查找索引 |
| | | index1 = mList1.IndexOf(s); |
| | | index2 = mList2.IndexOf(devices["AttriButeData1"]); |
| | | |
| | | } |
| | | ///更新最新状态; |
| | | mUIPickerView.setCurrentItems(index1, index2, 0); |
| | | |
| | | } |
| | | break; |