| | |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | ///亮度 |
| | | LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); |
| | | brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; |
| | | brightnessView.btnText.TextID = StringId.brightnesLogic; |
| | | fLayout.AddChidren(brightnessView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | keyVlaue = "on_off"; |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, 2); |
| | | 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); |
| | | }; |
| | | 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); |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | { |
| | | if (lightSwitchView.btnState.Text == switchView.btnOn.Text) |
| | | { |
| | | switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | else |
| | | { |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | } |
| | | }; |
| | | ///亮度点击事件 |
| | | brightnessView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | keyVlaue = "on_off"; |
| | | LogicView.BrightnessView brightness = new LogicView.BrightnessView(); |
| | | brightness.btnTitle.TextID = StringId.brightnesLogic; |
| | | brightness.FLayoutView(frame); |
| | | brightness.btn_subtract.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | }; |
| | | brightness.btn_add.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | RemView(frame); |
| | | lightSwitchView.btnState.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | { |
| | | //if (lightSwitchView.btnState.Text == switchView.btnOn.Text) |
| | | //{ |
| | | // switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | //} |
| | | //else |
| | | //{ |
| | | // switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | //} |
| | | } |
| | | }; |
| | | |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | break; |
| | | case FunctionType.RGB: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case FunctionType.RGBW: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case FunctionType.CCT: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case FunctionType.Relay: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | keyVlaue = "on_off"; |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, 3); |
| | | 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); |
| | | }; |
| | | 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); |
| | | }; |
| | | if (lightSwitchView.btnState.Text != "") |
| | | { |
| | | if (lightSwitchView.btnState.Text == switchView.btnOn.Text) |
| | | { |
| | | switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | else |
| | | { |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | } |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | | #region 保存 |
| | | ///保存View |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | /// <param name="len"></param> |
| | | public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len) |
| | | public void SwitchViewMethod1(FrameLayout frame, Entity.Function device, Button button, int len) |
| | | { |
| | | |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |