wxr
2023-04-07 a3313818a548d51777ae4e6cc006e9d1e2c1036e
群控备份
1个文件已添加
23个文件已修改
2107 ■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewApiRes.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/ResponseEntity/RegionInfoRes.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI0-Public/DiySelectPopupDialog.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs 1140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs 95 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage.cs 585 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -585,7 +585,7 @@
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
@@ -1857,6 +1857,7 @@
598=选择群控设备
599=请输入组名称
600=添加组合调光
601=请选择两个以上的设备
@@ -3109,6 +3110,7 @@
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
@@ -4344,6 +4346,7 @@
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
2532=Visitor Invitation Record
@@ -5563,6 +5566,7 @@
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
1000=Влажност в стаята
HDL-ON_iOS/Resources/Language.ini
@@ -580,6 +580,13 @@
593=Face photo
594=Please enter member name
595=Delete
596=Group Name
597=Please enter
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
2532=Visitor Invitation Record
@@ -1143,6 +1150,8 @@
8509=Fluorite video door lock
8510=Call from the doorbell
8511=User Education 
@@ -1843,6 +1852,12 @@
593=人脸照片
594=请输入成员名称
595=删除人脸数据
596=组名称
597=请输入
598=选择群控设备
599=请输入组名称
600=添加组合调光
601=请选择两个以上的设备
@@ -2381,6 +2396,7 @@
7167=总控开关
7168=PM10
8501=视频门锁
8502=电量
8503=当前门已关
@@ -2392,6 +2408,13 @@
8509=萤石视频门锁
8510=来自“门铃”呼叫
8511=用户人员
@@ -3082,6 +3105,12 @@
593=Face photo
594=Please enter member name
595=Delete
596=Group Name
597=Please enter
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
@@ -4312,7 +4341,12 @@
593=Face photo
594=Please enter member name
595=Delete
596=Group Name
597=Please enter
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
2532=Visitor Invitation Record
@@ -5527,6 +5561,12 @@
593=Face photo
594=Please enter member name
595=Delete
596=Group Name
597=Please enter
598=Select device
599=Please input name
600=Add combined dimming
601=Please select two or more devices
1000=Влажност в стаята
HDL_ON/Common/ApiUtlis.cs
@@ -348,9 +348,9 @@
#if DEBUG
                        DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl = true;
                        DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl = true;
#endif
                        if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
                        if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                        {
                            var pack = Ins.HttpRequest.GetGroupControlList();
                            if (pack != null)
@@ -359,7 +359,47 @@
                                {
                                    try
                                    {
                                        FunctionList.List.groupControls = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
                                        var groupControlList = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
                                        var readSidList = new List<string>();
                                        foreach(var temp in groupControlList)
                                        {
                                            FunctionList.List.groupControls.Clear();
                                            readSidList.Add(temp.userDeviceGroupControlId);
                                            if (readSidList.Count >= 20)
                                            {
                                                var data = Ins.httpRequest.GetGroupControInfo(readSidList);
                                                if(data != null)
                                                {
                                                    if(data.Code == StateCode.SUCCESS)
                                                    {
                                                        var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString());
                                                        FunctionList.List.groupControls.AddRange(groupControlInfoList);
                                                    }
                                                    else
                                                    {
                                                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                                    }
                                                }
                                                readSidList.Clear();
                                            }
                                        }
                                        if (readSidList.Count > 0)
                                        {
                                            var data = Ins.httpRequest.GetGroupControInfo(readSidList);
                                            if (data != null)
                                            {
                                                if (data.Code == StateCode.SUCCESS)
                                                {
                                                    var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString());
                                                    FunctionList.List.groupControls.AddRange(groupControlInfoList);
                                                }
                                                else
                                                {
                                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                                }
                                            }
                                            readSidList.Clear();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
HDL_ON/Common/R.cs
@@ -4,7 +4,10 @@
{
    public static class StringId
    {
        /// <summary>
        /// 请选择2个以上的设备
        /// </summary>
        public const int PlsSelectMoreData = 601;
        /// <summary>
        /// 添加组合调光
        /// </summary>
HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs
@@ -131,7 +131,7 @@
        /// <param name="i_listAllFun">全部的设备列表,需要手动指定</param>
        /// <param name="SelectEvent">根据选择的条件,筛选之后的设备列表(第一个参数是选择的UID,不管有没有用,总之先返回)</param>
        /// <param name="i_defultSelectId">默认哪个为选择状态</param>
        public void ShowDeviceFunctionView(Button btnFloor, List<Function> i_listAllFun, Action<string, List<Function>> SelectEvent, string i_defultSelectId = null)
        public void ShowDeviceFunctionView(Button btnFloor, List<Function> i_listAllFun, Action<string, List<Function>> SelectEvent, string i_defultSelectId = null, int offsetY = 0)
        {
            //清缓存
            this.ClearMemory();
@@ -155,7 +155,7 @@
                SelectEvent?.Invoke(this.nowShowSelectId, listDevice);
                SelectEvent = null;
            }, i_defultSelectId);
            }, i_defultSelectId, offsetY);
        }
        /// <summary>
HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs
@@ -30,7 +30,7 @@
        /// </summary>
        /// <param name="selectAction">回调选中事件,回调选中的uid</param>
        /// <param name="selectTag">设置选中的tga标记</param>
        public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT)
        public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT, int offsetY = 0)
        {
            //楼层集合数据
            var floorList = SpatialInfo.CurrentSpatial.FloorList;
@@ -54,7 +54,7 @@
                }
                //弹窗一级联动选择窗口
                var roomSelectPopupDialog = new DiySelectPopupDialog();
                roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag);
                roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag,offsetY);
            }
            else
            {
@@ -80,7 +80,7 @@
                }
                //弹窗二级联动选择窗口
                var roomSelectPopupDialog = new DiySelectPopupDialog();
                roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag);
                roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag,offsetY);
            }
 
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -269,7 +269,7 @@
                        deviceOnlinePush,
                        securityStatusChange});
                    //订阅群控状态
                    if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
                    if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                    {
                        await RemoteMqttClient.SubscribeAsync(groupControlStatus);
                    }
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -3206,7 +3206,7 @@
        /// <summary>
        /// 获取群控详情
        /// </summary>
        public ResponsePackNew GetGroupControInfo(String userDeviceGroupControlIds)
        public ResponsePackNew GetGroupControInfo(string userDeviceGroupControlIds)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
@@ -3221,10 +3221,21 @@
        }
        /// <summary>
        /// 获取群控详情
        /// </summary>
        public ResponsePackNew GetGroupControInfo(List<string> ids)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", ids);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson);
            return pack;
        }
        /// <summary>
        /// 添加群控列表
        /// </summary>
        /// <param name="spk"></param>
        /// <returns></returns>
        public ResponsePackNew AddGroupControl(List<GroupControl> groupControls)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
@@ -3233,6 +3244,20 @@
            d.Add("infos", groupControls);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 添加群控列表
        /// </summary>
        public ResponsePackNew DelGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteGroupControl, requestJson);
            return pack;
        }
@@ -3251,6 +3276,51 @@
            return pack;
        }
        /// <summary>
        /// 群控控制
        /// </summary>
        public ResponsePackNew ControlGroupControl(string userDeviceGroupControlId, Dictionary<string, object> pair)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlId", userDeviceGroupControlId);
            List<Dictionary<string, object>> dd = new List<Dictionary<string, object>>();
            dd.Add(pair);
            d.Add("status",dd);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 收藏群控
        /// </summary>
        public ResponsePackNew CollectGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 取消收藏群控
        /// </summary>
        public ResponsePackNew CancelCollectGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectGroupControl, requestJson);
            return pack;
        }
        #endregion
    }
HDL_ON/DAL/Server/HttpUtil.cs
@@ -239,6 +239,18 @@
                else
                {
                    HDL_ON.Utlis.WriteLine($"接口异常:{requestFullUrl} \r\n"+response.Content);
                    if(response.Content!= null)
                    {
                        try
                        {
                            var pack = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
                            if (pack != null)
                            {
                                return pack;
                            }
                        }
                        catch { }
                    }
                    return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
                }
HDL_ON/DAL/Server/NewApiRes.cs
@@ -633,6 +633,11 @@
        /// </summary>
        public bool gatewayStatus;
        /// <summary>
        /// 是否支持群控
        /// </summary>
        public bool isSupportGroupControl = false;
        ///// <summary>
        ///// 
        ///// </summary>
HDL_ON/Entity/Function/Function.cs
@@ -562,11 +562,14 @@
            new System.Threading.Thread(() =>
            {
                if (spk == SPK.GroupControl) {
                    var groupControl = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
                    if (collect)
                    {
                        result = ApiUtlis.Ins.HttpRequest.CollectGroupControl(groupControl.userDeviceGroupControlId).Code;
                    }
                    else
                    {
                        result = ApiUtlis.Ins.HttpRequest.CancelCollectGroupControl(groupControl.userDeviceGroupControlId).Code;
                    }
                }
                else
@@ -1514,7 +1517,7 @@
        public const string HvacAC = "hvac.ac";
        /// <summary>
        /// 毛细管空调
        /// </summary>
        /// </summaryc
        public const string HvacCac = "hvac.cac";
        /// <summary>
HDL_ON/Entity/ResponseEntity/RegionInfoRes.cs
@@ -131,10 +131,6 @@
        /// 交付链接
        /// </summary>
        public string deliverUrl;
        /// <summary>
        /// 是否支持群控
        /// </summary>
        public bool isSupportGroupControl = false;
    }
}
HDL_ON/HDL_ON.projitems
@@ -544,6 +544,7 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\CommonMethod.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockListPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\GroupControlPage.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
HDL_ON/UI/UI0-Public/DiySelectPopupDialog.cs
@@ -70,7 +70,7 @@
        /// <param name="mSecondList">二级数据集合</param>
        /// <param name="SelectAction">选择回调事件</param>
        /// <param name="selectTagId"></param>
        public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT)
        public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT, int offsetY = 0)
        {
            if (mFirstList == null)
            {
@@ -109,7 +109,7 @@
                }
                //View显示
                ShowDoubleBaseView();
                ShowDoubleBaseView(offsetY);
                //数据内容填充
                RefreshDoubleBaseView();
                //选中效果
@@ -206,7 +206,7 @@
        /// <summary>
        /// 显示二级view
        /// </summary>
        void ShowDoubleBaseView()
        void ShowDoubleBaseView(int offsetY = 0)
        {
            bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1;
            this.AddChidren(bodyView);
@@ -218,7 +218,7 @@
            BackView = new FrameLayout()
            {
                X = Application.GetRealWidth(10),
                Y = Application.GetRealHeight(104),
                Y = Application.GetRealHeight(104+ offsetY),
                Width = Application.GetRealWidth(283),
                Height = Application.GetRealWidth(242),
            };
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -725,7 +725,7 @@
            {
                int index = 0;
                var list = FunctionList.List.GetDeviceFunctionList();
                list.AddRange(FunctionList.List.groupControls);//加入群控
                foreach (var function in list)
                {
                    //音乐模块有主从关系,需要特殊处理
HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
@@ -78,7 +78,10 @@
            }
            btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png";
            if(function.spk == SPK.GroupControl)
            {
                btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/lightswitch.png";
            }
            if (SPK.CurtainSpkList().Contains(function.spk))
            {//窗帘没有开关按钮
                CurtainFragment();
HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -405,6 +405,17 @@
        /// </summary>
        void LoadEvent_DivSkipEvent()
        {
            if (function.spk == SPK.GroupControl)
            {
                EventHandler<MouseEventArgs> handler = (sender, e) => {
                    var dialog = new GroupControlPage(FunctionList.List.groupControls.Find((obj) => obj.sid == function.sid));
                    dialog.ShowDialog();
                };
                this.MouseUpEventHandler = handler;
                btnName.MouseUpEventHandler = handler;
                btnFromFloor.MouseUpEventHandler = handler;
                return;
            }
            var eventHandler = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollectionIcon, btnName, btnFromFloor, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.room,this.action);
            this.MouseUpEventHandler = eventHandler;
            btnName.MouseUpEventHandler = eventHandler;
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -39,7 +39,7 @@
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            if (titleId == StringId.Lights && !DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
            if (titleId == StringId.Lights && !DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
            {
                Action action = () =>
                {
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
@@ -55,6 +55,10 @@
        /// 是否新增群控
        /// </summary>
        bool isAdd = true;
        /// <summary>
        /// 编辑的组控数据
        /// </summary>
        string editDataString = "";
        GroupControl groupControl;
@@ -71,6 +75,7 @@
            {
                isAdd = false;
                this.groupControl = groupControl;
                editDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
            }
            groupControlLightList = new List<Function>();
            backActon = action;
@@ -172,6 +177,7 @@
            locationMagtView.AddChidren(btnLocationInfoRight);
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                Application.HideSoftInput();
                //修改功能所属房间之后的回调事件
                Action chooseRoomBackAction = () => {
                    try
@@ -278,7 +284,6 @@
            bodyView.AddChidren(functionListView);
            LoadLightRow(lightList);
            functionListView.AddChidren(new Button()
            {
                Height = Application.GetRealHeight(10),
@@ -308,6 +313,7 @@
                TextSize = CSS_FontSize.SubheadingFontSize,
                SelectedTextColor = CSS_Color.MainBackgroundColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                IsSelected = !isAdd
            };
            bottomView.AddChidren(btnConfrim);
            btnConfrim.MouseUpEventHandler = (sender, e) => {
@@ -320,59 +326,96 @@
                        new PublicAssmebly().TipMsg(StringId.Tip, StringId.PlsEntryGroupName);
                        return;
                    }
                    groupControl.name = name;
                    groupControl.sids.Clear();
                    foreach (var light in groupControlLightList)
                    if (groupControlLightList.Count < 2)
                    {
                        new PublicAssmebly().TipMsg(StringId.Tip, StringId.PlsSelectMoreData);
                        return;
                    }
                    if (isAdd)
                    {
                        groupControl.name = name;
                        groupControl.sids.Clear();
                        foreach (var light in groupControlLightList)
                        {
                            try
                            {
                                var gc = new GroupControlFunction();
                                gc.sid = light.sid;
                                gc.spk = light.spk;
                                groupControl.sids.Add(gc);
                            }
                            catch (Exception ex)
                            {
                                MainPage.Log($"新增群控转换数据异常:{ex.Message}");
                            }
                        }
                        try
                        {
                            var gc = new GroupControlFunction();
                            gc.sid = light.sid;
                            gc.spk = light.spk;
                            groupControl.sids.Add(gc);
                            groupControl.type = groupControlType.type;
                            groupControl.sid = groupControl.NewGroupControlSid();
                            var pack = Common.ApiUtlis.Ins.HttpRequest.AddGroupControl(new List<GroupControl>() { groupControl });
                            if (pack != null)
                            {
                                if (pack.Code == StateCode.SUCCESS)
                                {
                                    backActon?.Invoke();
                                    this.RemoveFromParent();
                                }
                                else
                                {
                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"新增群控转换数据异常:{ex.Message}");
                            MainPage.Log($"新增群控异常:{ex.Message}");
                        }
                    }
                    try
                    else
                    {
                        var http = new HttpServerRequest();
                        groupControl.type = groupControlType.type;
                        groupControl.sid = groupControl.NewGroupControlSid();
                        var pack = http.AddGroupControl(new List<GroupControl>() { groupControl });
                        if (pack != null)
                        try
                        {
                            if(pack.Code == StateCode.SUCCESS)
                            var newEditDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
                            //没有更新数据则直接退出
                            if (newEditDataString == editDataString)
                            {
                                backActon?.Invoke();
                                this.RemoveFromParent();
                                return;
                            }
                            else
                            var pack = Common.ApiUtlis.Ins.HttpRequest.EditGroupControl(new List<GroupControl>() { groupControl });
                            if (pack != null)
                            {
                                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                if (pack.Code == StateCode.SUCCESS)
                                {
                                    backActon?.Invoke();
                                    this.RemoveFromParent();
                                }
                                else
                                {
                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MainPage.Log($"新增群控异常:{ex.Message}");
                        catch (Exception ex)
                        {
                            MainPage.Log($"编辑群控异常:{ex.Message}");
                        }
                    }
                }
            };
            #endregion
            //加载功能筛选组件
            LoadDialog_ChangeFloor();
            new Thread(() => {
                var http = new HttpServerRequest();
                if (isAdd)
                {
                    var pack = http.GetGroupControlTypes("light.switch");
                    var pack = Common.ApiUtlis.Ins.HttpRequest.GetGroupControlTypes("light.switch");
                    if (pack != null)
                    {
                        if (pack.Code == StateCode.SUCCESS)
@@ -384,6 +427,9 @@
                                if (groupControlTypes != null && groupControlTypes.Count > 0)
                                {
                                    groupControlType = groupControlTypes[0];
                                    Application.RunOnMainThread(() => {
                                        LoadLightRow(lightList);
                                    });
                                }
                            }
                            catch (Exception ex)
@@ -399,7 +445,7 @@
                }
                else
                {
                    var pack = http.GetGroupControInfo(groupControl.userDeviceGroupControlId);
                    var pack = Common.ApiUtlis.Ins.HttpRequest.GetGroupControInfo(groupControl.userDeviceGroupControlId);
                    if (pack != null)
                    {
                        if (pack.Code == StateCode.SUCCESS)
@@ -411,6 +457,10 @@
                                if (groupControlTemps != null && groupControlTemps.Count > 0)
                                {
                                    groupControl = groupControlTemps[0];
                                    Application.RunOnMainThread(() =>
                                    {
                                        LoadLightRow(lightList);
                                    });
                                }
                            }
                            catch (Exception ex)
@@ -558,6 +608,7 @@
            string nowSelectId = null;
            btnFloor.MouseUpEventHandler += (sender, e) =>
            {
                Application.HideSoftInput();
                //显示下拉列表
                var form = new FloorRoomSelectPopupView();
                form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) =>
@@ -580,1044 +631,11 @@
                    nowSelectId = selectId;
                    //重新加载界面
                    LoadLightRow(listFunc);
                }, nowSelectId);
                }, nowSelectId,100);
            };
        }
    }
    //public class LightRow : FrameLayout
    //{
    //    #region 区域控件
    //    static FrameLayout bodyDiv;
    //    /// <summary>
    //    /// 功能/场景icon
    //    /// </summary>
    //    Button btnIcon;
    //    /// <summary>
    //    /// 功能名称/场景名称
    //    /// </summary>
    //    Button btnName;
    //    /// <summary>
    //    /// 楼层信息显示按钮
    //    /// </summary>
    //    Button btnFromFloor;
    //    /// <summary>
    //    /// 选中按钮
    //    /// </summary>
    //    Button btnSelect;
    //    #endregion
    //    #region 区域变量
    //    Function function;
    //    #endregion
    //    public LightRow(Function func)
    //    {
    //        bodyDiv = this;
    //        bodyDiv.Tag = func.sid;
    //        function = func;
    //    }
    //    /// <summary>
    //    /// 加载控制卡片区域
    //    /// </summary>
    //    public void LoadDiv(List<Function> functions, Action action)
    //    {
    //        btnIcon = new Button()
    //        {
    //            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
    //        };
    //        bodyDiv.AddChidren(btnSelect);
    //        btnSelect.MouseUpEventHandler = (sender, e) => {
    //            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.deviceId == function.deviceId);
    //                if (removeTemp != null)
    //                {
    //                    functions.Remove(removeTemp);
    //                }
    //            }
    //            ///刷新界面
    //            if (functions.Count == 0 || functions.Count == 1)
    //            {
    //                action();
    //            }
    //        };
    //    }
    //}
    ///// <summary>
    ///// 灯光场景编辑弹窗
    ///// </summary>
    //public class LightSceneEditDialog : Dialog
    //{
    //    Dictionary<string, string> d = new Dictionary<string, string>();
    //    List<Function> listSwitch = new List<Function>();
    //    List<Function> lightDimming = new List<Function>();
    //    List<Function> lightCCT = new List<Function>();
    //    List<Function> lightRGB = new List<Function>();
    //    /// <summary>
    //    /// 传入的灯光列表
    //    /// 加入场景控制功能列表
    //    /// </summary>
    //    List<Function> lights;
    //    /// <summary>
    //    /// 临时灯光对象
    //    /// 处理灯光方法
    //    /// </summary>
    //    Light tempLight = new Light();
    //    //发送数据收集
    //    Dictionary<string, string> commandDic = new Dictionary<string, string>();
    //    Scene scene;
    //    Action<Scene> backAction;
    //    public LightSceneEditDialog(List<Function> functions, Scene inParScene, Action<Scene> action)
    //    {
    //        lights = functions;
    //        scene = inParScene;
    //        backAction = action;
    //    }
    //    public void ShowDialog()
    //    {
    //        commandDic.Clear();
    //        commandDic.Add(FunctionAttributeKey.OnOff, "off");
    //        listSwitch = lights.FindAll((obj) => obj.spk == SPK.LightSwitch);
    //        lightDimming = lights.FindAll((obj) => obj.spk == SPK.LightDimming);
    //        lightCCT = lights.FindAll((obj) => obj.spk == SPK.LightCCT);
    //        lightRGB = lights.FindAll((obj) => obj.spk == SPK.LightRGB);
    //        var hadDimming = lightDimming.Count > 0;
    //        var hadCCT = lightCCT.Count > 0;
    //        var hadRGB = lightRGB.Count > 0;
    //        if (hadRGB)
    //        {
    //            commandDic.Add(FunctionAttributeKey.RGB, lightRGB[0].GetAttrState(FunctionAttributeKey.RGB));
    //            commandDic.Add(FunctionAttributeKey.Brightness, lightRGB[0].GetAttrState(FunctionAttributeKey.Brightness));
    //        }
    //        if (hadCCT)
    //        {
    //            commandDic.Add(FunctionAttributeKey.CCT, lightCCT[0].GetAttrState(FunctionAttributeKey.CCT));
    //            if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness))
    //            {
    //                commandDic.Add(FunctionAttributeKey.Brightness, lightCCT[0].GetAttrState(FunctionAttributeKey.Brightness));
    //            }
    //        }
    //        if (hadDimming)
    //        {
    //            if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness))
    //            {
    //                commandDic.Add(FunctionAttributeKey.Brightness, lightDimming[0].GetAttrState(FunctionAttributeKey.Brightness));
    //            }
    //        }
    //        var bodyView = new FrameLayout();
    //        this.AddChidren(bodyView);
    //        bodyView.MouseUpEventHandler = (sender, e) => {
    //            this.Close();
    //        };
    //        var contentView = new FrameLayout()
    //        {
    //            BackgroundColor = CSS_Color.MainBackgroundColor,
    //            Width = Application.GetRealWidth(343),
    //            Radius = (uint)Application.GetRealWidth(12),
    //        };
    //        bodyView.AddChidren(contentView);
    //        #region 标题区
    //        var titleView = new FrameLayout()
    //        {
    //            Width = Application.GetRealWidth(343),
    //            Height = Application.GetRealHeight(52),
    //        };
    //        contentView.AddChidren(titleView);
    //        var btnTitle = new Button()
    //        {
    //            Height = Application.GetRealHeight(52),
    //            Gravity = Gravity.Center,
    //            TextSize = CSS_FontSize.SubheadingFontSize,
    //            TextColor = CSS_Color.MainColor,
    //            TextID = StringId.CombinedDimming,
    //            TextAlignment = TextAlignment.Center,
    //        };
    //        if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247
    //        {
    //            btnTitle.Width = Application.GetRealWidth(197);
    //            btnTitle.IsMoreLines = true;
    //        }
    //        else
    //        {
    //            btnTitle.Width = btnTitle.GetTextWidth() + Application.GetRealWidth(10);
    //            btnTitle.IsMoreLines = false;
    //        }
    //        titleView.AddChidren(btnTitle);
    //        var btnEditIcon = new Button()
    //        {
    //            Width = Application.GetRealWidth(24),
    //            Height = Application.GetRealWidth(24),
    //            X = Application.GetRealWidth(12) + btnTitle.Right,
    //            Gravity = Gravity.CenterVertical,
    //            UnSelectedImagePath = "Public/Edit.png",
    //        };
    //        if (string.IsNullOrEmpty(scene.userSceneId))
    //        {
    //            titleView.AddChidren(btnEditIcon);
    //        }
    //        else
    //        {
    //            btnTitle.Text = scene.name;
    //            btnTitle.Width = btnTitle.GetTextWidth() + Application.GetRealWidth(10);
    //            btnTitle.Gravity = Gravity.Center;
    //        }
    //        Action<string> callBack = (str) =>
    //        {
    //            //名称不能为空
    //            if (string.IsNullOrEmpty(str))
    //            {
    //                new Tip()
    //                {
    //                    CloseTime = 1,
    //                    Text = Language.StringByID(StringId.NameCannotBeEmpty),
    //                    Direction = AMPopTipDirection.None,
    //                }.Show(bodyView);
    //                return;
    //            }
    //            btnTitle.Text = str;
    //            scene.name = str;
    //            if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247
    //            {
    //                btnTitle.Width = Application.GetRealWidth(197);
    //            }
    //            else
    //            {
    //                btnTitle.Width = btnTitle.GetTextWidth();
    //            }
    //        };
    //        EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
    //        {
    //            List<string> sceneNameList = new List<string>();
    //            foreach (var tempScene in FunctionList.List.scenes)
    //            {
    //                sceneNameList.Add(tempScene.name);
    //            }
    //            new PublicAssmebly().LoadDialog_EditParater(StringId.SceneName, scene.name, callBack, StringId.SceneNameCannotBeEmpty, StringId.SceneNameAlreadyExists, sceneNameList);
    //        };
    //        btnTitle.MouseUpEventHandler = eventHandler;
    //        btnEditIcon.MouseUpEventHandler = eventHandler;
    //        titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
    //        #endregion
    //        //var dimmingLight = lights.Find((obj) => obj.spk == SPK.LightDimming);
    //        //var cctLight = lights.Find((obj) => obj.spk == SPK.LightCCT);
    //        //var rgbLight = lights.Find((obj) => obj.spk == SPK.LightRGB);
    //        var dimmingLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightDimming);
    //        var cctLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightCCT);
    //        var rgbLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightRGB);
    //        var brightnessValue = 0;
    //        var cctValue = 27;
    //        //if(rgbLight!= null)
    //        //{
    //        //    int.TryParse(rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
    //        //}
    //        //if (cctLight != null)
    //        //{
    //        //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
    //        //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
    //        //}
    //        //if(dimmingLight!=null)
    //        //{
    //        //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out brightnessValue);
    //        //}
    //        //属性设置区域
    //        var attrView = new VerticalScrolViewLayout()
    //        {
    //            Y = Application.GetRealHeight(52),
    //            Width = Application.GetRealWidth(343),
    //            ScrollEnabled = false,
    //        };
    //        //属性设置区域高度
    //        int attrViewHight = Application.GetRealHeight(18 + 22);
    //        //只有继电器
    //        if (!hadDimming && !hadCCT && !hadRGB)
    //        {
    //            attrViewHight += Application.GetRealHeight(50);
    //            attrView.Height = attrViewHight;
    //            contentView.AddChidren(attrView);
    //            attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
    //            var view = new FrameLayout()
    //            {
    //                Width = Application.GetRealWidth(343),
    //                Height = Application.GetRealHeight(50),
    //            };
    //            attrView.AddChidren(view);
    //            var btnClose = new Button()
    //            {
    //                X = Application.GetRealWidth(50),
    //                Gravity = Gravity.CenterVertical,
    //                Width = Application.GetRealWidth(98),
    //                Height = Application.GetRealHeight(40),
    //                TextColor = CSS_Color.TextualColor,
    //                SelectedBackgroundColor = CSS_Color.MainColor,
    //                SelectedTextColor = CSS_Color.MainBackgroundColor,
    //                BackgroundColor = CSS_Color.DividingLineColor,
    //                TextID = StringId.OFF,
    //                TextSize = CSS_FontSize.TextFontSize,
    //                Radius = (uint)Application.GetRealWidth(5),
    //                IsSelected = true,
    //                //BorderWidth = 1,
    //                //BorderColor = 0x00000000
    //            };
    //            view.AddChidren(btnClose);
    //            var btnOpen = new Button()
    //            {
    //                X = Application.GetRealWidth(100 + 98),
    //                Gravity = Gravity.CenterVertical,
    //                Width = Application.GetRealWidth(98),
    //                Height = Application.GetRealHeight(40),
    //                TextColor = CSS_Color.TextualColor,
    //                SelectedBackgroundColor = CSS_Color.MainColor,
    //                SelectedTextColor = CSS_Color.MainBackgroundColor,
    //                BackgroundColor = CSS_Color.DividingLineColor,
    //                TextID = StringId.On,
    //                TextSize = CSS_FontSize.TextFontSize,
    //                Radius = (uint)Application.GetRealWidth(5),
    //            };
    //            view.AddChidren(btnOpen);
    //            btnClose.MouseUpEventHandler = (sender, e) =>
    //            {
    //                btnClose.IsSelected = true;
    //                btnOpen.IsSelected = false;
    //                commandDic[FunctionAttributeKey.OnOff] = "off";
    //                d.Clear();
    //                d.Add(FunctionAttributeKey.OnOff, "off");
    //                foreach (var light in lights)
    //                {
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //            };
    //            btnOpen.MouseUpEventHandler = (sender, e) =>
    //            {
    //                btnClose.IsSelected = false;
    //                btnOpen.IsSelected = true;
    //                commandDic[FunctionAttributeKey.OnOff] = "on";
    //                d.Clear();
    //                d.Add(FunctionAttributeKey.OnOff, "on");
    //                foreach (var light in lights)
    //                {
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //            };
    //        }
    //        else
    //        {
    //            if (hadRGB)
    //            {
    //                attrViewHight += Application.GetRealHeight(248);
    //                hadDimming = true;
    //            }
    //            if (hadCCT)
    //            {
    //                attrViewHight += Application.GetRealHeight(54 + 11);
    //                hadDimming = true;
    //            }
    //            if (hadDimming)
    //            {
    //                attrViewHight += Application.GetRealHeight(54 + 11);
    //            }
    //            attrView.Height = attrViewHight;
    //            contentView.AddChidren(attrView);
    //            attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
    //            if (hadDimming)
    //            {
    //                LoadDimmingAttrView(attrView);
    //            }
    //            if (hadCCT)
    //            {
    //                LoadCctAttrView(attrView);
    //            }
    //            if (hadRGB)
    //            {
    //                LoadRgbAttrView(attrView);
    //            }
    //        }
    //        contentView.Height = Application.GetRealHeight(52 + 44) + attrViewHight;
    //        contentView.Gravity = Gravity.Center;
    //        #region bottom View
    //        var bottomView = new FrameLayout()
    //        {
    //            Y = Application.GetRealHeight(52) + attrViewHight,
    //            Height = Application.GetRealHeight(46),
    //        };
    //        contentView.AddChidren(bottomView);
    //        bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
    //        if (string.IsNullOrEmpty(scene.userSceneId))
    //        {
    //            var btnCacel = new Button()
    //            {
    //                Width = Application.GetRealWidth(172),
    //                Height = Application.GetRealHeight(44),
    //                TextAlignment = TextAlignment.Center,
    //                TextSize = CSS_FontSize.SubheadingFontSize,
    //                TextColor = CSS_Color.TextualColor,
    //                TextID = StringId.Cancel,
    //            };
    //            bottomView.AddChidren(btnCacel);
    //            var btnSave = new Button()
    //            {
    //                X = Application.GetRealWidth(172),
    //                Width = Application.GetRealWidth(172),
    //                Height = Application.GetRealHeight(46),
    //                BackgroundColor = CSS_Color.MainColor,
    //                TextColor = CSS_Color.MainBackgroundColor,
    //                TextAlignment = TextAlignment.Center,
    //                TextSize = CSS_FontSize.SubheadingFontSize,
    //                TextID = StringId.Save
    //            };
    //            bottomView.AddChidren(btnSave);
    //            //例:右下圆角 大小为50
    //            int mRectCornerID = HDLUtils.RectCornerBottomRight;
    //            btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
    //            btnCacel.MouseUpEventHandler = (sender, e) =>
    //            {
    //                this.Close();
    //                //var waitPage = new Loading();
    //                //MainPage.BaseView.AddChidren(waitPage);
    //                //waitPage.Start(Language.StringByID(StringId.PleaseWait));
    //                //new Thread(() =>
    //                //{
    //                //    try
    //                //    {
    //                //        foreach (var light in lights)
    //                //        {
    //                //            Dictionary<string, string> sendDate = new Dictionary<string, string>();
    //                //            //赋值场景功能数据
    //                //            foreach (var attr in light.GetAttributes())
    //                //            {
    //                //                if (commandDic.ContainsKey(attr))
    //                //                {
    //                //                    try
    //                //                    {
    //                //                        sendDate.Add(attr, commandDic[attr]);
    //                //                    }
    //                //                    catch { }
    //                //                }
    //                //            }
    //                //                Control.Ins.SendWriteCommand(light, sendDate);
    //                //            Thread.Sleep(50);
    //                //        }
    //                //    }
    //                //    catch
    //                //    { }
    //                //    finally
    //                //    {
    //                //        Application.RunOnMainThread(() =>
    //                //        {
    //                //            waitPage.Hide();
    //                //            new PublicAssmebly().TipMsgAutoClose("组合控制已执行", true);
    //                //            if (waitPage != null)
    //                //            {
    //                //                //backAction(null);
    //                //                waitPage.RemoveFromParent();
    //                //            }
    //                //        });
    //                //    }
    //                //})
    //                //{ IsBackground = true }.Start();
    //            };
    //            btnSave.MouseUpEventHandler = (sender, e) =>
    //            {
    //                if (string.IsNullOrEmpty(scene.name))
    //                {
    //                    new Tip()
    //                    {
    //                        CloseTime = 1,
    //                        Text = Language.StringByID(StringId.NameCannotBeEmpty),
    //                        Direction = AMPopTipDirection.None,
    //                    }.Show(bodyView);
    //                    return;
    //                }
    //                foreach (var tempRoom in FunctionList.List.scenes)
    //                {
    //                    if (scene.name == tempRoom.name)
    //                    {
    //                        new PublicAssmebly().TipMsg(StringId.Tip, StringId.NameAlreadyExists);
    //                        return;
    //                    }
    //                }
    //                var waitPage = new Loading();
    //                MainPage.BaseView.AddChidren(waitPage);
    //                waitPage.Start(Language.StringByID(StringId.PleaseWait));
    //                new Thread(() =>
    //                {
    //                    try
    //                    {
    //                        var serverScene = new Scene();
    //                        for (int i = 0; i < lights.Count; i++)
    //                        {
    //                            var light = lights[i];
    //                            //赋值场景功能数据
    //                            foreach (var attr in light.GetAttributes())
    //                            {
    //                                if (commandDic.ContainsKey(attr))
    //                                {
    //                                    try
    //                                    {
    //                                        light.SetAttrState(attr, commandDic[attr]);
    //                                    }
    //                                    catch { }
    //                                }
    //                            }
    //                            //转换场景的功能对象
    //                            var sceneFunction = light.ConvertSceneFunction();
    //                            //查询有没有存在
    //                            var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
    //                            //赋值
    //                            if (temp != null)
    //                            {
    //                                temp = sceneFunction;
    //                            }
    //                            else
    //                            {
    //                                scene.functions.Add(sceneFunction);
    //                            }
    //                        }
    //                        var result = FunctionList.List.AddScene(scene, out serverScene);
    //                        Application.RunOnMainThread(() =>
    //                        {
    //                            if (result == StateCode.SUCCESS)
    //                            {
    //                                scene.userSceneId = serverScene.userSceneId;
    //                                FunctionList.List.scenes.Add(scene);
    //                                backAction?.Invoke(scene);
    //                                this.Close();
    //                            }
    //                            else
    //                            {
    //                                if (result == "124005")
    //                                    IMessageCommon.Current.ShowErrorInfoAlter(Language.StringByID(StringId.GatewayOffline));
    //                                else
    //                                    IMessageCommon.Current.ShowErrorInfoAlter(result);
    //                            }
    //                        });
    //                    }
    //                    catch { }
    //                    finally
    //                    {
    //                        Application.RunOnMainThread(() =>
    //                        {
    //                            waitPage.Hide();
    //                            waitPage.RemoveFromParent();
    //                        });
    //                    }
    //                })
    //                { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start();
    //            };
    //        }
    //        else
    //        {
    //            var btnCacel = new Button()
    //            {
    //                Height = Application.GetRealHeight(44),
    //                TextAlignment = TextAlignment.Center,
    //                TextSize = CSS_FontSize.SubheadingFontSize,
    //                TextColor = CSS_Color.TextualColor,
    //                TextID = StringId.Close,
    //            };
    //            bottomView.AddChidren(btnCacel);
    //            //例:右下圆角 大小为50
    //            //int mRectCornerID = HDLUtils.RectCornerBottomRight;
    //            //btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
    //            btnCacel.MouseUpEventHandler = (sender, e) =>
    //            {
    //                this.Close();
    //            };
    //        }
    //        #endregion
    //        this.Show();
    //    }
    //    /// <summary>
    //    /// 加载调光属性设置控件
    //    /// </summary>
    //    /// <param name="attrView"></param>
    //    void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
    //    {
    //        string briValue = "";
    //        commandDic.TryGetValue(FunctionAttributeKey.Brightness, out briValue);
    //        var dimmingView = new FrameLayout()
    //        {
    //            Height = Application.GetRealHeight(54 + 11)
    //        };
    //        attrView.AddChidren(dimmingView);
    //        #region 亮度调节
    //        var btnBrightnessText = new Button()
    //        {
    //            X = Application.GetRealWidth(35),
    //            Y = Application.GetRealHeight(1),
    //            Width = Application.GetRealWidth(224),
    //            Height = Application.GetRealHeight(25),
    //            TextAlignment = TextAlignment.CenterLeft,
    //            TextColor = CSS_Color.FirstLevelTitleColor,
    //            TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
    //            TextID = StringId.Brightness,
    //        };
    //        btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Brightness] + "%";
    //        dimmingView.AddChidren(btnBrightnessText);
    //        var btnMinValuesText = new Button()
    //        {
    //            X = Application.GetRealWidth(35),
    //            Y = btnBrightnessText.Bottom,
    //            Width = Application.GetRealWidth(40),
    //            Height = Application.GetRealHeight(21),
    //            Text = "0%",
    //            TextAlignment = TextAlignment.CenterLeft,
    //            TextColor = CSS_Color.PromptingColor1,
    //            TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
    //        };
    //        dimmingView.AddChidren(btnMinValuesText);
    //        var dimmerBar = new DiyImageSeekBar()
    //        {
    //            X = Application.GetRealWidth(45 + 10),
    //            Y = Application.GetRealHeight(11),
    //            Width = Application.GetRealWidth(220),
    //            Height = Application.GetRealHeight(54),
    //            SeekBarViewHeight = Application.GetRealHeight(8),
    //            ThumbImagePath = "Public/ThumbImage.png",
    //            ThumbImageHeight = Application.GetRealHeight(54),
    //            ProgressTextColor = CSS_Color.FirstLevelTitleColor,
    //            ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
    //            ProgressBarColor = CSS_Color.AuxiliaryColor1,
    //            MaxValue = 100,
    //            Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Brightness]),
    //            SeekBarPadding = Application.GetRealWidth(20),
    //            IsProgressTextShow = false,
    //            ProgressChangeDelayTime = 0,
    //        };
    //        dimmingView.AddChidren(dimmerBar);
    //        dimmerBar.OnProgressChangedEvent = (sender, e) => {
    //            btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
    //        };
    //        dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
    //            commandDic[FunctionAttributeKey.Brightness] = dimmerBar.Progress.ToString();
    //            btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
    //            foreach (var light in lights)
    //            {
    //                if (light.spk == SPK.LightSwitch)
    //                {
    //                    d.Clear();
    //                    d.Add(FunctionAttributeKey.OnOff, e > 0 ? "on" : "off");
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //                else
    //                {
    //                    d.Clear();
    //                    d.Add(FunctionAttributeKey.Brightness, e.ToString());
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //            }
    //        };
    //        var btnMaxValuesText = new Button()
    //        {
    //            X = dimmerBar.Right,
    //            Y = btnBrightnessText.Bottom,
    //            Width = Application.GetRealWidth(55),
    //            Height = Application.GetRealHeight(21),
    //            Text = "100%",
    //            TextAlignment = TextAlignment.CenterLeft,
    //            TextColor = CSS_Color.PromptingColor1,
    //            TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
    //        };
    //        dimmingView.AddChidren(btnMaxValuesText);
    //        #endregion
    //    }
    //    /// <summary>
    //    /// 加载cct属性设置控件
    //    /// </summary>
    //    /// <param name="attrView"></param>
    //    void LoadCctAttrView(VerticalScrolViewLayout attrView)
    //    {
    //        #region 色温
    //        string valueStr = "2700";
    //        commandDic.TryGetValue(FunctionAttributeKey.CCT, out valueStr);
    //        int value = Convert.ToInt32(valueStr) / 100;
    //        var cctView = new FrameLayout()
    //        {
    //            Height = Application.GetRealHeight(54 + 11)
    //        };
    //        attrView.AddChidren(cctView);
    //        //色温
    //        var btnTempClolor = new Button();
    //        btnTempClolor.X = Application.GetRealWidth(35);
    //        btnTempClolor.Y = Application.GetRealHeight(1);
    //        btnTempClolor.Width = Application.GetRealWidth(224);
    //        btnTempClolor.Height = Application.GetRealHeight(21);
    //        btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
    //        btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
    //        btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
    //        btnTempClolor.TextID = StringId.ColorTemperature;
    //        cctView.AddChidren(btnTempClolor);
    //        //2700K
    //        var btnTempClolorMin = new Button()
    //        {
    //            X = Application.GetRealWidth(35),
    //            Y = btnTempClolor.Bottom,
    //            Width = Application.GetRealWidth(40),
    //            Height = Application.GetRealHeight(21),
    //        };
    //        btnTempClolorMin.Width = Application.GetRealWidth(54);
    //        btnTempClolorMin.Height = Application.GetRealHeight(21);
    //        btnTempClolorMin.Text = "2700K";
    //        btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
    //        btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
    //        btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
    //        cctView.AddChidren(btnTempClolorMin);
    //        //滑动条的背景图片
    //        var btnColorTemplatrueBack = new Button()
    //        {
    //            X = Application.GetRealWidth(55 + 22 + 15),
    //            Y = Application.GetRealHeight(11),
    //            Width = Application.GetRealWidth(180),
    //            Height = Application.GetRealHeight(54),
    //        };
    //        btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
    //        btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
    //        btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
    //        cctView.AddChidren(btnColorTemplatrueBack);
    //        //滑动条控件
    //        var barColorTemplatrue = new CCTSeekBarControl()
    //        {
    //            X = Application.GetRealWidth(55 + 22),
    //            Y = Application.GetRealHeight(11),
    //            Width = Application.GetRealWidth(220),
    //            Height = Application.GetRealHeight(54),
    //        };
    //        barColorTemplatrue.MinValue = 27;
    //        barColorTemplatrue.MaxValue = 65;
    //        barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
    //        barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
    //        barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
    //        cctView.AddChidren(barColorTemplatrue);
    //        barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
    //        barColorTemplatrue.Progress = value;
    //        //设置初始值
    //        btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
    //        barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
    //        {
    //            btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
    //        };
    //        barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
    //        {
    //            commandDic[FunctionAttributeKey.CCT] = (barColorTemplatrue.Progress * 100).ToString();
    //            d.Clear();
    //            d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
    //            foreach (var light in lightCCT)
    //            {
    //                if (light.spk == SPK.LightCCT)
    //                {
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //            }
    //        };
    //        //变更背景图的Y轴坐标
    //        btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
    //        //6500K
    //        var btnTempClolorMax = new Button();
    //        btnTempClolorMax.Y = btnTempClolorMin.Y;
    //        btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
    //        btnTempClolorMax.Width = Application.GetRealWidth(54);
    //        btnTempClolorMax.Height = Application.GetRealHeight(21);
    //        btnTempClolorMax.Text = "6500K";
    //        btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
    //        btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
    //        btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
    //        cctView.AddChidren(btnTempClolorMax);
    //        #endregion
    //    }
    //    /// <summary>
    //    /// 加载rgb属性设置控件
    //    /// </summary>
    //    /// <param name="attrView"></param>
    //    void LoadRgbAttrView(VerticalScrolViewLayout attrView)
    //    {
    //        #region RGB
    //        string value = "255,255,255";
    //        commandDic.TryGetValue(FunctionAttributeKey.RGB, out value);
    //        var rgbView = new FrameLayout()
    //        {
    //            Height = Application.GetRealHeight(248)
    //        };
    //        attrView.AddChidren(rgbView);
    //        var btnCurColor = new Button()
    //        {
    //            X = Application.GetRealWidth(24),
    //            Y = Application.GetRealHeight(10),
    //            Width = Application.GetMinRealAverage(24),
    //            Height = Application.GetMinRealAverage(24),
    //            Radius = (uint)Application.GetMinRealAverage(8),
    //            BorderColor = CSS_Color.PromptingColor2,
    //            BorderWidth = 1,
    //            BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(commandDic[FunctionAttributeKey.RGB]))
    //        };
    //        rgbView.AddChidren(btnCurColor);
    //        //色盘的桌布控件(限制那个白色滑动球使用)
    //        var framePickerBack = new FrameLayout();
    //        framePickerBack.Gravity = Gravity.CenterHorizontal;
    //        framePickerBack.Y = Application.GetRealHeight(20);
    //        framePickerBack.Width = Application.GetMinRealAverage(198);
    //        framePickerBack.Height = Application.GetMinRealAverage(198);
    //        rgbView.AddChidren(framePickerBack);
    //        var colorPicker = new ColorPicker()
    //        {
    //            ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
    //        };
    //        framePickerBack.AddChidren(colorPicker);
    //        //白点控件
    //        var btnWhiteRound = new Button();
    //        btnWhiteRound.Width = Application.GetRealWidth(24);
    //        btnWhiteRound.Height = Application.GetRealWidth(24);
    //        btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
    //        btnWhiteRound.Visible = false;
    //        framePickerBack.AddChidren(btnWhiteRound);
    //        //当前点击的【点】是否正确
    //        bool pointIsRight = false;
    //        //圆的半径(考虑边界,需要设置它的半径比较小一点)
    //        int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
    //        colorPicker.MouseUpEventHandler = (sender2, e) => {
    //            d.Clear();
    //            d.Add(FunctionAttributeKey.RGB, commandDic[FunctionAttributeKey.RGB]);
    //            foreach (var light in lightCCT)
    //            {
    //                if (light.spk == SPK.LightCCT)
    //                {
    //                    Control.Ins.SendWriteCommand(light, d);
    //                }
    //            }
    //        };
    //        colorPicker.ColorChaged += (sender2, e2) => {
    //            string rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
    //            commandDic[FunctionAttributeKey.RGB] = rgbString;
    //            btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
    //            foreach (var rgbTemp in lightRGB)
    //            {
    //                rgbTemp.SetAttrState(FunctionAttributeKey.RGB, rgbString);
    //            }
    //        };
    //        colorPicker.MouseDownEventHandler += (sender, e) =>
    //        {
    //            pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
    //            if (pointIsRight == false)
    //            {
    //                //点的区域不是圆盘内
    //                return;
    //            }
    //            //显示白点
    //            btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
    //            btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
    //            if (btnWhiteRound.Visible == false)
    //            {
    //                btnWhiteRound.Visible = true;
    //            }
    //        };
    //        colorPicker.MouseUpEventHandler = (sender, e) => {
    //            foreach (var rgbTemp in lightRGB)
    //            {
    //                Dictionary<string, string> d = new Dictionary<string, string>();
    //                d.Add(FunctionAttributeKey.RGB, tempLight.GetRGBcolorString(rgbTemp));
    //                Control.Ins.SendWriteCommand(rgbTemp, d, false, 0);
    //            }
    //        };
    //        colorPicker.MouseMoveEventHandler += (sender, e) =>
    //        {
    //            //当鼠标点下事件处理
    //            colorPicker.MouseDownEventHandler(sender, e);
    //        };
    //        #endregion
    //    }
    //    /// <summary>
    //    /// 检测点击点
    //    /// </summary>
    //    /// <param name="circleR">圆的半径</param>
    //    /// <param name="circleX">圆心X轴</param>
    //    /// <param name="circleY">圆心Y轴</param>
    //    /// <param name="pointX">点击点的X轴</param>
    //    /// <param name="pointY">点击点的Y轴</param>
    //    /// <returns></returns>
    //    private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
    //    {
    //        int dwidth = circleX - pointX;
    //        if (dwidth < 0) { dwidth *= -1; }
    //        int dHeight = circleY - pointY;
    //        if (dHeight < 0) { dHeight *= -1; }
    //        //根据三角函数,求三角形的斜边长
    //        int dlength = dwidth * dwidth + dHeight * dHeight;
    //        //半径长度(不开方,所以是按平方算)
    //        circleR *= circleR;
    //        if (dlength < circleR)
    //        {
    //            //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
    //            return true;
    //        }
    //        return false;
    //    }
    //}
}
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
@@ -26,7 +27,7 @@
                    {
                        var page = new AddGroupControlPage(null,
                            ()=> {
                                ReadGroupControlList();
                            });
                        MainPage.BasePageView.AddChidren(page);
                        page.LoadPage();
@@ -43,13 +44,27 @@
            };
            bodyView.AddChidren(contentView);
            ReadGroupControlList();
            #region
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            #endregion
        }
        /// <summary>
        /// 读取组控数据
        /// </summary>
        private void ReadGroupControlList()
        {
            new System.Threading.Thread(() => {
                var http = new HttpServerRequest();
                var pack = http.GetGroupControlList();
                if(pack != null)
                var pack = ApiUtlis.Ins.HttpRequest.GetGroupControlList();
                if (pack != null)
                {
                    if(pack.Code == StateCode.SUCCESS  )
                    if (pack.Code == StateCode.SUCCESS)
                    {
                        try
                        {
@@ -69,14 +84,8 @@
                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                    }
                }
            }) { IsBackground = true }.Start();
            #region
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            #endregion
            })
            { IsBackground = true }.Start();
        }
@@ -117,10 +126,11 @@
                foreach (var groupControl in list)
                {
                    var functionRow = new FrameLayout()
                    var functionRow = new RowLayout()
                    {
                        Height = Application.GetRealHeight(65),
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        LineColor = 0x00000000
                    };
                    contentView.AddChidren(functionRow);
@@ -186,6 +196,63 @@
                    btnFunctionName.MouseUpEventHandler = eventHandler;
                    btnFunctionLocationInfo.MouseUpEventHandler = eventHandler;
                    var btnDelGroupControl = new Button()
                    {
                        TextColor = CSS_Color.MainBackgroundColor,
                        BackgroundColor = CSS_Color.WarningColor,
                        TextID = StringId.Del,
                        TextAlignment = TextAlignment.Center,
                    };
                    functionRow.AddRightView(btnDelGroupControl);
                    btnDelGroupControl.MouseUpEventHandler = (sender1, e1) => {
                        var waitPage = new Loading();
                        this.AddChidren(waitPage);
                        waitPage.Start("");
                        new System.Threading.Thread(() =>
                        {
                            try
                            {
                                var pack = ApiUtlis.Ins.HttpRequest.DelGroupControl(groupControl.userDeviceGroupControlId);
                                if (pack != null)
                                {
                                    Application.RunOnMainThread(() =>
                                    {
                                        try
                                        {
                                            if (pack.Code == StateCode.SUCCESS)
                                            {
                                                list.Remove(groupControl);
                                                LoadGroupControlView(list);
                                            }
                                            else
                                            {
                                                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                                            }
                                        }catch(Exception ex)
                                        {
                                            MainPage.Log($"刷新组控数据异常:{ex.Message}");
                                        }
                                    });
                                }
                            }catch(Exception ex)
                            {
                                MainPage.Log($"删除组控异常:{ex.Message}");
                            }
                            finally
                            {
                                Application.RunOnMainThread(() => {
                                    if (waitPage != null)
                                    {
                                        waitPage.Hide();
                                        waitPage.RemoveFromParent();
                                        waitPage = null;
                                    }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                    };
                }
            }
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using Shared;
namespace HDL_ON.Entity
@@ -86,8 +88,6 @@
        /// </summary>
        public List<GroupControlFunction> sids = new List<GroupControlFunction>();
        ///// <summary>
        ///// 获取设备添加到房间的房间名称
        ///// </summary>
@@ -114,6 +114,38 @@
        //    }
        //    return roomNameList;
        //}
        /// <summary>
        /// 群控控制
        /// </summary>
        /// <param name="pairs"></param>
        public void Control(Dictionary<string,object> pairs)
        {
            try
            {
                var controlValues = new Dictionary<string, object>();
                foreach(var p in pairs)
                {
                    controlValues.Add("key", p.Key);
                    controlValues.Add("value", p.Value);
                }
                var pack = ApiUtlis.Ins.HttpRequest.ControlGroupControl(userDeviceGroupControlId, controlValues);
                if (pack != null)
                {
                    if (pack.Code == StateCode.SUCCESS)
                    {
                        //DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl.
                    }
                    else
                    {
                        MainPage.Log($"群控控制失败,Code: {pack.Code}");
                    }
                }
            }
            catch (Exception ex){
                MainPage.Log($"群控控制失败: {ex.Message}");
            }
        }
    }
    public class GroupControlFunction
@@ -126,6 +158,8 @@
        /// 功能spk
        /// </summary>
        public string spk = string.Empty;
    }
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -297,7 +297,7 @@
            #region 住宅信息区域
            if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare
                && DB_ResidenceData.Instance.GatewayType == 1
                && DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
                && DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
            {
                residenceInfoView = new FrameLayout()
                {
@@ -587,7 +587,7 @@
                    residenceAddFunctionView.AddChidren(btnResidenceAddFunctionText);
                    #endregion
                    if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
                    if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                    {
                        residenceFunctionCount++;
                        #region ---组合调光
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage.cs
New file
@@ -0,0 +1,585 @@

using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 灯光场景编辑弹窗
    /// </summary>
    public class GroupControlPage : Dialog
    {
        GroupControl group;
        public GroupControlPage(GroupControl groupControl)
        {
            group = groupControl;
            if(group == null)
            {
                group = new GroupControl();
            }
        }
        public void ShowDialog()
        {
            var hadDimming = false;
            var hadCCT = false;
            var hadRGB = false;
            foreach (var temp in group.sids)
            {
                if (temp.spk == SPK.LightRGB)
                {
                    hadRGB = true;
                }
                else if (temp.spk == SPK.LightCCT)
                {
                    hadCCT = true;
                }else if (temp.spk == SPK.LightDimming)
                {
                    hadDimming = true;
                }
                if(hadDimming && hadCCT && hadRGB)
                {
                    break;
                }
            }
            var bodyView = new FrameLayout();
            this.AddChidren(bodyView);
            //bodyView.MouseUpEventHandler = (sender, e) =>
            //{
            //    this.Close();
            //};
            var contentView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Width = Application.GetRealWidth(343),
                Radius = (uint)Application.GetRealWidth(12),
            };
            bodyView.AddChidren(contentView);
            #region 标题区
            var titleView = new FrameLayout()
            {
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(52),
            };
            contentView.AddChidren(titleView);
            var btnTitle = new Button()
            {
                Height = Application.GetRealHeight(52),
                Gravity = Gravity.Center,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.MainColor,
                TextID = StringId.CombinedDimming,
                TextAlignment = TextAlignment.Center,
            };
            if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247
            {
                btnTitle.Width = Application.GetRealWidth(197);
                btnTitle.IsMoreLines = true;
            }
            else
            {
                btnTitle.Width = btnTitle.GetTextWidth() + Application.GetRealWidth(10);
                btnTitle.IsMoreLines = false;
            }
            titleView.AddChidren(btnTitle);
            var btnEditIcon = new Button()
            {
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                X = Application.GetRealWidth(12) + btnTitle.Right,
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "Public/Edit.png",
            };
            btnTitle.Text = group.name;
            btnTitle.Width = btnTitle.GetTextWidth() + Application.GetRealWidth(10);
            btnTitle.Gravity = Gravity.Center;
            titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
            #endregion
            //属性设置区域
            var attrView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(52),
                Width = Application.GetRealWidth(343),
                ScrollEnabled = false,
            };
            //属性设置区域高度
            int attrViewHight = Application.GetRealHeight(18 + 22);
            //只有继电器
            if (!hadDimming && !hadCCT && !hadRGB)
            {
                attrViewHight += Application.GetRealHeight(50);
                attrView.Height = attrViewHight;
                contentView.AddChidren(attrView);
                attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
                var view = new FrameLayout()
                {
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(50),
                };
                attrView.AddChidren(view);
                var btnClose = new Button()
                {
                    X = Application.GetRealWidth(50),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(98),
                    Height = Application.GetRealHeight(40),
                    TextColor = CSS_Color.TextualColor,
                    SelectedBackgroundColor = CSS_Color.MainColor,
                    SelectedTextColor = CSS_Color.MainBackgroundColor,
                    BackgroundColor = CSS_Color.DividingLineColor,
                    TextID = StringId.OFF,
                    TextSize = CSS_FontSize.TextFontSize,
                    Radius = (uint)Application.GetRealWidth(5),
                    IsSelected = true,
                    //BorderWidth = 1,
                    //BorderColor = 0x00000000
                };
                view.AddChidren(btnClose);
                var btnOpen = new Button()
                {
                    X = Application.GetRealWidth(100 + 98),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(98),
                    Height = Application.GetRealHeight(40),
                    TextColor = CSS_Color.TextualColor,
                    SelectedBackgroundColor = CSS_Color.MainColor,
                    SelectedTextColor = CSS_Color.MainBackgroundColor,
                    BackgroundColor = CSS_Color.DividingLineColor,
                    TextID = StringId.On,
                    TextSize = CSS_FontSize.TextFontSize,
                    Radius = (uint)Application.GetRealWidth(5),
                };
                view.AddChidren(btnOpen);
                btnClose.MouseUpEventHandler = (sender, e) =>
                {
                    btnClose.IsSelected = true;
                    btnOpen.IsSelected = false;
                    var d = new Dictionary<string, object>();
                    d.Add(FunctionAttributeKey.OnOff, "off");
                    group.Control(d);
                };
                btnOpen.MouseUpEventHandler = (sender, e) =>
                {
                    btnClose.IsSelected = false;
                    btnOpen.IsSelected = true;
                    var d = new Dictionary<string, object>();
                    d.Add(FunctionAttributeKey.OnOff, "on");
                    group.Control(d);
                };
            }
            else
            {
                if (hadRGB)
                {
                    attrViewHight += Application.GetRealHeight(248);
                    hadDimming = true;
                }
                if (hadCCT)
                {
                    attrViewHight += Application.GetRealHeight(54 + 11);
                    hadDimming = true;
                }
                if (hadDimming)
                {
                    attrViewHight += Application.GetRealHeight(54 + 11);
                }
                attrView.Height = attrViewHight;
                contentView.AddChidren(attrView);
                attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
                if (hadDimming)
                {
                    LoadDimmingAttrView(attrView);
                }
                if (hadCCT)
                {
                    LoadCctAttrView(attrView);
                }
                if (hadRGB)
                {
                    LoadRgbAttrView(attrView);
                }
            }
            contentView.Height = Application.GetRealHeight(52 + 44) + attrViewHight;
            contentView.Gravity = Gravity.Center;
            var bottomView = new FrameLayout()
            {
                Y = Application.GetRealHeight(52) + attrViewHight,
                Height = Application.GetRealHeight(46),
            };
            contentView.AddChidren(bottomView);
            bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
            var btnCloseDialog = new Button()
            {
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextID = StringId.Close,
                TextSize = CSS_FontSize.SubheadingFontSize,
            };
            bottomView.AddChidren(btnCloseDialog);
            btnCloseDialog.MouseUpEventHandler = (sender, e) => {
                this.Close();
            };
            this.Show();
        }
        /// <summary>
        /// 加载调光属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
        {
            var dimmingView = new FrameLayout()
            {
                Height = Application.GetRealHeight(54 + 11)
            };
            attrView.AddChidren(dimmingView);
            #region 亮度调节
            var btnBrightnessText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(1),
                Width = Application.GetRealWidth(224),
                Height = Application.GetRealHeight(25),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.Brightness,
            };
            btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + group.GetAttrState(FunctionAttributeKey.Brightness) + "%";
            dimmingView.AddChidren(btnBrightnessText);
            var btnMinValuesText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealHeight(21),
                Text = "0%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            dimmingView.AddChidren(btnMinValuesText);
            var dimmerBar = new DiyImageSeekBar()
            {
                X = Application.GetRealWidth(45 + 10),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealHeight(54),
                SeekBarViewHeight = Application.GetRealHeight(8),
                ThumbImagePath = "Public/ThumbImage.png",
                ThumbImageHeight = Application.GetRealHeight(54),
                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                ProgressBarColor = CSS_Color.AuxiliaryColor1,
                MaxValue = 100,
                SeekBarPadding = Application.GetRealWidth(20),
                IsProgressTextShow = false,
                ProgressChangeDelayTime = 0,
            };
            dimmingView.AddChidren(dimmerBar);
            dimmerBar.OnProgressChangedEvent = (sender, e) =>
            {
                btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
            };
            dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
            {
                btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
                var d = new Dictionary<string, object>();
                d.Add(FunctionAttributeKey.Brightness, e.ToString());
                group.Control(d);
            };
            var btnMaxValuesText = new Button()
            {
                X = dimmerBar.Right,
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(55),
                Height = Application.GetRealHeight(21),
                Text = "100%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            dimmingView.AddChidren(btnMaxValuesText);
            #endregion
        }
        /// <summary>
        /// 加载cct属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadCctAttrView(VerticalScrolViewLayout attrView)
        {
            #region 色温
            var cctView = new FrameLayout()
            {
                Height = Application.GetRealHeight(54 + 11)
            };
            attrView.AddChidren(cctView);
            //色温
            var btnTempClolor = new Button();
            btnTempClolor.X = Application.GetRealWidth(35);
            btnTempClolor.Y = Application.GetRealHeight(1);
            btnTempClolor.Width = Application.GetRealWidth(224);
            btnTempClolor.Height = Application.GetRealHeight(21);
            btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
            btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            btnTempClolor.TextID = StringId.ColorTemperature;
            cctView.AddChidren(btnTempClolor);
            //2700K
            var btnTempClolorMin = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = btnTempClolor.Bottom,
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealHeight(21),
            };
            btnTempClolorMin.Width = Application.GetRealWidth(54);
            btnTempClolorMin.Height = Application.GetRealHeight(21);
            btnTempClolorMin.Text = "2700K";
            btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            cctView.AddChidren(btnTempClolorMin);
            //滑动条的背景图片
            var btnColorTemplatrueBack = new Button()
            {
                X = Application.GetRealWidth(55 + 22 + 15),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(54),
            };
            btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
            btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
            btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
            cctView.AddChidren(btnColorTemplatrueBack);
            //滑动条控件
            var barColorTemplatrue = new CCTSeekBarControl()
            {
                X = Application.GetRealWidth(55 + 22),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealHeight(54),
            };
            barColorTemplatrue.MinValue = 27;
            barColorTemplatrue.MaxValue = 65;
            barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
            barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
            barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
            cctView.AddChidren(barColorTemplatrue);
            barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
            //设置初始值
            btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
            barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
            {
                btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
            };
            barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
            {
                var d = new Dictionary<string, object>();
                d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
                group.Control(d);
            };
            //变更背景图的Y轴坐标
            btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
            //6500K
            var btnTempClolorMax = new Button();
            btnTempClolorMax.Y = btnTempClolorMin.Y;
            btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
            btnTempClolorMax.Width = Application.GetRealWidth(54);
            btnTempClolorMax.Height = Application.GetRealHeight(21);
            btnTempClolorMax.Text = "6500K";
            btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
            btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            cctView.AddChidren(btnTempClolorMax);
            #endregion
        }
        /// <summary>
        /// 加载rgb属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadRgbAttrView(VerticalScrolViewLayout attrView)
        {
            #region RGB
            var rgbView = new FrameLayout()
            {
                Height = Application.GetRealHeight(248)
            };
            attrView.AddChidren(rgbView);
            var btnCurColor = new Button()
            {
                X = Application.GetRealWidth(24),
                Y = Application.GetRealHeight(10),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                Radius = (uint)Application.GetMinRealAverage(8),
                BorderColor = CSS_Color.PromptingColor2,
                BorderWidth = 1,
                //BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(commandDic[FunctionAttributeKey.RGB]))
            };
            rgbView.AddChidren(btnCurColor);
            //色盘的桌布控件(限制那个白色滑动球使用)
            var framePickerBack = new FrameLayout();
            framePickerBack.Gravity = Gravity.CenterHorizontal;
            framePickerBack.Y = Application.GetRealHeight(20);
            framePickerBack.Width = Application.GetMinRealAverage(198);
            framePickerBack.Height = Application.GetMinRealAverage(198);
            rgbView.AddChidren(framePickerBack);
            var colorPicker = new ColorPicker()
            {
                ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
            };
            framePickerBack.AddChidren(colorPicker);
            //白点控件
            var btnWhiteRound = new Button();
            btnWhiteRound.Width = Application.GetRealWidth(24);
            btnWhiteRound.Height = Application.GetRealWidth(24);
            btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
            btnWhiteRound.Visible = false;
            framePickerBack.AddChidren(btnWhiteRound);
            //当前点击的【点】是否正确
            bool pointIsRight = false;
            //圆的半径(考虑边界,需要设置它的半径比较小一点)
            int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
            string rgbString = "255,255,255";
            var rgbTemp = new Light();
            colorPicker.MouseUpEventHandler = (sender2, e2) =>
            {
                var d = new Dictionary<string, object>();
                d.Add(FunctionAttributeKey.RGB, rgbString);
                group.Control(d);
            };
            colorPicker.ColorChaged += (sender2, e2) =>
            {
                rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                btnCurColor.BackgroundColor = (uint)(0xFF000000 + rgbTemp.GetRGBcolor(rgbString));
                var d = new Dictionary<string, object>();
                d.Add(FunctionAttributeKey.RGB, rgbString);
                group.Control(d);
            };
            colorPicker.MouseDownEventHandler += (sender, e) =>
            {
                pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
                if (pointIsRight == false)
                {
                    //点的区域不是圆盘内
                    return;
                }
                //显示白点
                btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
                btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
                if (btnWhiteRound.Visible == false)
                {
                    btnWhiteRound.Visible = true;
                }
            };
            colorPicker.MouseMoveEventHandler += (sender, e) =>
            {
                //当鼠标点下事件处理
                colorPicker.MouseDownEventHandler(sender, e);
            };
            #endregion
        }
        /// <summary>
        /// 检测点击点
        /// </summary>
        /// <param name="circleR">圆的半径</param>
        /// <param name="circleX">圆心X轴</param>
        /// <param name="circleY">圆心Y轴</param>
        /// <param name="pointX">点击点的X轴</param>
        /// <param name="pointY">点击点的Y轴</param>
        /// <returns></returns>
        private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
        {
            int dwidth = circleX - pointX;
            if (dwidth < 0) { dwidth *= -1; }
            int dHeight = circleY - pointY;
            if (dHeight < 0) { dHeight *= -1; }
            //根据三角函数,求三角形的斜边长
            int dlength = dwidth * dwidth + dHeight * dHeight;
            //半径长度(不开方,所以是按平方算)
            circleR *= circleR;
            if (dlength < circleR)
            {
                //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
                return true;
            }
            return false;
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -421,13 +421,14 @@
                SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png",
                IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null
            };
            if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
            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)
                {