| | |
| | | /// </summary> |
| | | public void LoadDiv(List<Function> functions,Action action) |
| | | { |
| | | btnIcon = new Button() |
| | | try |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png" |
| | | }; |
| | | bodyDiv.AddChidren(btnIcon); |
| | | |
| | | btnName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(24), |
| | | Text = function.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | bodyDiv.AddChidren(btnName); |
| | | |
| | | btnFromFloor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10 + 24), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(18), |
| | | Text = function.GetRoomListName(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | bodyDiv.AddChidren(btnFromFloor); |
| | | |
| | | btnSelect = new Button() |
| | | { |
| | | X = Application.GetRealWidth(303), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png", |
| | | IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null, |
| | | Tag = "ChooseIcon" |
| | | }; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | btnSelect.X = Application.GetRealWidth(323); |
| | | } |
| | | bodyDiv.AddChidren(btnSelect); |
| | | |
| | | btnSelect.MouseUpEventHandler = (sender, e) => { |
| | | Application.HideSoftInput(); |
| | | btnSelect.IsSelected = !btnSelect.IsSelected; |
| | | if(btnSelect.IsSelected) |
| | | btnIcon = new Button() |
| | | { |
| | | var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId); |
| | | if (addTemp == null) |
| | | { |
| | | functions.Add(function); |
| | | } |
| | | } |
| | | else |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png" |
| | | }; |
| | | bodyDiv.AddChidren(btnIcon); |
| | | |
| | | btnName = new Button() |
| | | { |
| | | var removeTemp = functions.Find((obj) => obj.sid == function.sid); |
| | | if (removeTemp != null) |
| | | { |
| | | functions.Remove(removeTemp); |
| | | } |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(24), |
| | | Text = function.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | bodyDiv.AddChidren(btnName); |
| | | |
| | | btnFromFloor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10 + 24), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(18), |
| | | Text = function.GetRoomListName(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | bodyDiv.AddChidren(btnFromFloor); |
| | | |
| | | btnSelect = new Button() |
| | | { |
| | | X = Application.GetRealWidth(303), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png", |
| | | IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null, |
| | | Tag = "ChooseIcon" |
| | | }; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | btnSelect.X = Application.GetRealWidth(323); |
| | | } |
| | | ///刷新界面 |
| | | //if (functions.Count == 0 || functions.Count == 1) |
| | | //{ |
| | | bodyDiv.AddChidren(btnSelect); |
| | | |
| | | btnSelect.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Application.HideSoftInput(); |
| | | btnSelect.IsSelected = !btnSelect.IsSelected; |
| | | if (btnSelect.IsSelected) |
| | | { |
| | | var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId); |
| | | if (addTemp == null) |
| | | { |
| | | functions.Add(function); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var removeTemp = functions.Find((obj) => obj.sid == function.sid); |
| | | if (removeTemp != null) |
| | | { |
| | | functions.Remove(removeTemp); |
| | | } |
| | | } |
| | | ///刷新界面 |
| | | //if (functions.Count == 0 || functions.Count == 1) |
| | | //{ |
| | | action(); |
| | | //} |
| | | }; |
| | | //} |
| | | }; |
| | | }catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | |