| | |
| | | switchView.btnOn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | }; |
| | | switchView.btnOff.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | { |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | int brightnesValue =0; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | keyVlaue = "on_off"; |
| | | LogicMethod.dictionary(dic, "key", "brightness"); |
| | | keyVlaue = "brightness"; |
| | | LogicView.BrightnessView brightness = new LogicView.BrightnessView(); |
| | | brightness.btnTitle.TextID = StringId.brightnesLogic; |
| | | brightness.FLayoutView(frame); |
| | | brightness.btn_subtract.MouseUpEventHandler += (sender2, e2) => |
| | | brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | if (brightnesValue > 0) |
| | | { |
| | | brightnesValue -= 1; |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | } |
| | | }; |
| | | brightness.btn_add.MouseUpEventHandler += (sender3, e3) => |
| | | brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | if (brightnesValue < 100) |
| | | { |
| | | brightnesValue += 1; |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | |
| | | } |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | EventHandler<int> progressclick = (sender2, e2) => |
| | | { |
| | | //if (lightSwitchView.btnState.Text == switchView.btnOn.Text) |
| | | //{ |
| | | // switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | //} |
| | | //else |
| | | //{ |
| | | // switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | //} |
| | | brightnesValue = brightness.seekBarVol.Progress; |
| | | }; |
| | | brightness.seekBarVol.OnProgressChangedEvent += progressclick; |
| | | brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick; |
| | | brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) => |
| | | { |
| | | if (brightnesValue ==0) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); |
| | | selectedState = device.functionType + brightnesValue.ToString(); |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | brightnessView.btnState.Text = brightnesValue.ToString(); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | if (brightnessView.btnState.Text != "") |
| | | { |
| | | brightnesValue = int.Parse(brightnessView.btnState.Text); |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | } |
| | | }; |
| | | |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | switchView.btnOn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | }; |
| | | switchView.btnOff.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | { |
| | |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | GetEditState(device, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | } |
| | | break; |
| | |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | | /// <param name="device">编辑设备</param> |
| | | /// <param name="edit">编辑状态</param> |
| | | /// <param name="index">编辑数据的索引</param> |
| | | /// <param name="button1">显示Btn</param> |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | private void GetEditState(Entity.Function device, bool edit, int index, Button button1, Button button2, Button button3, Button button4) |
| | | private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4) |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status as List<Dictionary<string, string>>; |
| | | |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (dicList.Count != 0) |
| | | { |
| | | //有数据重新赋值 |
| | | dicSateteList = dicList; |
| | | } |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 |
| | |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "on_off": |
| | | { |
| | | if (value == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | break; |
| | | case "brightness": |
| | | { |
| | | |
| | | button2.Text = value; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |