| | |
| | | Application.RunOnMainThread(() => { |
| | | if (bodyView == null) |
| | | return; |
| | | UpdataFunctionOnCount(function.functionCategory); |
| | | UpdataFunctionOnCount(function.functionCategory,function.functionType); |
| | | UpdataCloseAllButton(function); |
| | | }); |
| | | } |
| | |
| | | /// 更新功能打开数量 |
| | | /// </summary> |
| | | /// <param name="functionCategory"></param> |
| | | static void UpdataFunctionOnCount(FunctionCategory functionCategory) |
| | | static void UpdataFunctionOnCount(FunctionCategory functionCategory,FunctionType functionType) |
| | | { |
| | | for (int i = 0; i < bodyView.functionsPageView.ChildrenCount; i++) |
| | | { |
| | |
| | | string btnText = "0/0"; |
| | | switch (functionCategory) |
| | | { |
| | | case FunctionCategory.AC: |
| | | btnText = DB_ResidenceData.residenceData.functionList.aCs.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.lights.Count; |
| | | case FunctionCategory.Thermostat: |
| | | switch (functionType) |
| | | { |
| | | case FunctionType.FloorHeating: |
| | | break; |
| | | case FunctionType.AC: |
| | | btnText = DB_ResidenceData.residenceData.functionList.aCs.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.aCs.Count; |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.Curtain: |
| | | btnText = DB_ResidenceData.residenceData.functionList.curtains.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.lights.Count; |
| | | btnText = DB_ResidenceData.residenceData.functionList.curtains.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.curtains.Count; |
| | | break; |
| | | case FunctionCategory.Light: |
| | | btnText = DB_ResidenceData.residenceData.functionList.lights.FindAll((obj) => obj.on_off == "on").Count + "/" + DB_ResidenceData.residenceData.functionList.lights.Count; |
| | |
| | | { |
| | | try |
| | | { |
| | | btn.Visible = false; |
| | | foreach (var f in room.functions) |
| | | { |
| | | if(f.functionCategory == FunctionCategory.Scene) |
| | | { |
| | | continue; |
| | | } |
| | | if (f.on_off == "on") |
| | | { |
| | | btn.Visible = true; |
| | | return; |
| | | } |
| | | } |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Action action = () => |
| | |
| | | }; |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.TipCloseAllFunctionInRoom, action); |
| | | }; |
| | | foreach (var f in room.functions) |
| | | { |
| | | if (f.functionCategory == FunctionCategory.Scene) |
| | | { |
| | | continue; |
| | | } |
| | | if (f.on_off == "on") |
| | | { |
| | | btn.Visible = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 关闭打开全部选中类型功能 |
| | | /// </summary> |
| | | void LoadEvent_SwitchFunction(Button btn,FunctionCategory functionCategory) |
| | | void LoadEvent_SwitchFunction(Button btn, ShowFunction functionCategory) |
| | | { |
| | | btn.MouseUpEventHandler = (sender, e) => { |
| | | btn.IsSelected = !btn.IsSelected; |
| | | switch(functionCategory) |
| | | { |
| | | case FunctionCategory.AC: |
| | | case ShowFunction.AC: |
| | | foreach(var f in DB_ResidenceData.residenceData.functionList.aCs) |
| | | { |
| | | f.on_off = btn.IsSelected ? "on" : "off"; |
| | | Control.Send(CommandType_A.write, f); |
| | | } |
| | | break; |
| | | case FunctionCategory.Curtain: |
| | | case ShowFunction.Curtain: |
| | | |
| | | break; |
| | | case FunctionCategory.Light: |
| | | case ShowFunction.Light: |
| | | foreach (var f in DB_ResidenceData.residenceData.functionList.lights) |
| | | { |
| | | f.on_off = btn.IsSelected ? "on" : "off"; |