wei
2020-12-23 271faaf6664166dc368639b9f2e577f63f901be5
20201223-99

卡顿优化
RGB当前颜色更新
场景残留修复
空调通风模式禁止调节温度
25个文件已修改
608 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control_Udp.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/DB_ResidenceData.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 115 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/FunctionList.cs 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Room.cs 156 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,14 +1,10 @@
<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Function.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs">
    <Files>
      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="188" Column="14" />
      <File FileName="HDL_ON/Entity/FunctionList.cs" Line="584" Column="40" />
      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="322" Column="21" />
      <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="312" Column="32" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="692" Column="10" />
      <File FileName="HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs" Line="81" Column="38" />
      <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="177" Column="75" />
      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="346" Column="30" />
      <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="862" Column="25" />
      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" Line="28" Column="84" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
@@ -21,16 +17,30 @@
                <Node name="Server" expanded="True" />
              </Node>
              <Node name="Entity" expanded="True">
                <Node name="Function" expanded="True">
                  <Node name="Function.cs" selected="True" />
                </Node>
                <Node name="Function" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI0-Public" expanded="True" />
                <Node name="UI2" expanded="True">
                  <Node name="1-HomePage" expanded="True" />
                  <Node name="2-Classification" expanded="True" />
                  <Node name="3-Intelligence" expanded="True">
                    <Node name="Automation" expanded="True" />
                    <Node name="Scene" expanded="True" />
                  </Node>
                  <Node name="FuntionControlView" expanded="True" />
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="RoomListManage" expanded="True">
                      <Node name="AddRoom" expanded="True" />
                    </Node>
                  </Node>
                  <Node name="FuntionControlView" expanded="True">
                    <Node name="AC" expanded="True" />
                    <Node name="Electrical" expanded="True" />
                    <Node name="FoolHeating" expanded="True" />
                    <Node name="Light" expanded="True">
                      <Node name="RGBPageBLL.cs" selected="True" />
                    </Node>
                  </Node>
                </Node>
              </Node>
            </Node>
@@ -47,12 +57,11 @@
    <String>Shared.IOS/Shared.IOS.csproj</String>
  </DisabledProjects>
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore>
      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI0-Public/PublicAssmebly.cs" relfile="HDL_ON/UI/UI0-Public/PublicAssmebly.cs" line="730" column="1" />
      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" line="315" column="1" />
      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="288" column="1" />
      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" line="144" column="1" />
    </BreakpointStore>
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
  <MultiItemStartupConfigurations />
HDL_ON/Common/ApiUtlis.cs
@@ -19,7 +19,7 @@
        {
            get
            {
                if(apiUtlis == null)
                if (apiUtlis == null)
                {
                    apiUtlis = new ApiUtlis();
                }
@@ -33,7 +33,7 @@
        {
            get
            {
                if(httpRequest == null)
                if (httpRequest == null)
                {
                    httpRequest = new HttpServerRequest();
                }
@@ -47,7 +47,7 @@
        {
            bool result = DB_ResidenceData.Instance.HomeGateway.gatewayStatus;
            if(!result)
            if (!result)
            {
            }
@@ -131,9 +131,12 @@
                    {
                        MainPage.Log($"读取房间信息成功");
                        var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(roomResult.Data.ToString());
                        if (revData != null)
                        if (revData == null)
                        {
                            SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list, OptionType.Cover);
                            revData = new SpatialApiPack();
                        }
                        {
                            SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list);
                        }
                    }
                    else
@@ -146,7 +149,10 @@
                    {
                        MainPage.Log($"读取设备信息成功");
                        var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                        if (deviceList != null)
                        if (deviceList == null)
                        {
                            deviceList = new DevcieApiPack();
                        }
                        {
                            if (FunctionList.List.GetDeviceFunctionList().Count > 0)
                            {
@@ -169,12 +175,13 @@
                                        i++;
                                        if (localFunction.modifyTime != newFunction.modifyTime)
                                        {
                                            //可优化
                                            localFunction.name = newFunction.name;
                                            localFunction.collect = newFunction.collect;
                                            localFunction.modifyTime = newFunction.modifyTime;
                                            localFunction.roomIds = newFunction.roomIds;
                                            localFunction.bus = newFunction.bus;
                                            localFunction.SaveFunctionData(false);
                                            localFunction.SaveFunctionFile();
                                        }
                                        deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能
                                    }
@@ -183,7 +190,7 @@
                            //处理剩下的新增功能
                            foreach (var newFunction in deviceList.list)
                            {
                                newFunction.SaveFunctionData(false);
                                newFunction.SaveFunctionFile();
                                FunctionList.List.IniFunctionList(newFunction.savePath);
                            }
                        }
@@ -199,7 +206,10 @@
                    {
                        MainPage.Log($"读取场景数据成功");
                        var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                        if (sceneList != null)
                        if (sceneList == null)
                        {
                            sceneList = new List<Scene>();
                        }
                        {
                            for (int i = 0; i < FunctionList.List.scenes.Count;)
                            {
@@ -305,4 +315,4 @@
            { IsBackground = true }.Start();
        }
    }
}
}
HDL_ON/DAL/DriverLayer/Control.cs
@@ -291,6 +291,8 @@
                }
            }
            MainPage.Log($"发送数据:{Newtonsoft.Json.JsonConvert.SerializeObject(commandDictionary)}");
            //远程通讯
            if (Ins.IsRemote)
            {
@@ -300,7 +302,6 @@
                var actionObjs = new List<ApiAlinkControlActionObj>();
                actionObjs.Add(apiControlData);
                var pack = httpServer.ControlDevice(actionObjs);
                //MainPage.Log($"{pack.Code}:{pack.Data}");
            }
            //本地通讯
            else
@@ -405,8 +406,8 @@
        {
            if (Ins.IsRemote)
            {
                var pm = new HDL_ON.DAL.Server.HttpServerRequest();
                pm.ExecuteScene(scene.userSceneId);
                var pm = new DAL.Server.HttpServerRequest();
                var result = pm.ExecuteScene(scene.userSceneId);
            }
            else
            {
HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -249,7 +249,7 @@
                            }
                        }
                        ControlBytesSend(Command.SetSingleLight, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID,
                            new byte[] { f.localFunction.bus.LoopId, brightness });
                            new byte[] { f.localFunction.bus.LoopId, brightness, (byte)(f.localFunction.delay / 255), (byte)(f.localFunction.delay % 255) });
                        break;
                    case FunctionType.RGB:
                        break;
@@ -861,7 +861,7 @@
            {
                wait(); 
            }
            //MainPage.Log($"发送Hdl-Link数据,IP:{Control.Ins.reportIp}:8585");
            MainPage.Log($"发送Hdl-Link数据,IP:{Control.Ins.reportIp}:8585");
        }
    }
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1824,7 +1824,7 @@
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
            d.Add("deviceId", function.deviceId);//DriverLayer.Control.Ins.GatewayId);
            d.Add("deviceId", function.deviceId);
            d.Add("name", function.name);
            d.Add("collect", function.collect);
            d.Add("roomIds", function.roomIds);
@@ -1833,6 +1833,22 @@
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
        }
        /// <summary>
        /// 更新设备绑定房间信息
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew UpdataDevcieBindRoomInfo(Function function)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
            d.Add("deviceId", function.deviceId);
            d.Add("roomIds", function.roomIds);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
        }
        /// <summary>
        /// 设备绑定房间
        /// </summary>
        public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds)
HDL_ON/Entity/DB_ResidenceData.cs
@@ -107,7 +107,7 @@
                    }
                    instance.residenceImage = "Classification/Room/Roombg.png";
                    //初始化住宅功能数据
                    SpatialInfo.CurrentSpatial.InitRoomFunction();
                    SpatialInfo.CurrentSpatial.InitRoomListFunctions();
                }
                return instance;
HDL_ON/Entity/Function/Function.cs
@@ -322,37 +322,98 @@
        /// </summary>
        public void SaveFunctionFile()
        {
            var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
            FileUtlis.Files.WriteFileByBytes(savePath, ssd);
        }
        /// <summary>
        /// 保存房间绑定信息
        /// </summary>
        public void UpdataRoomIds()
        {
            new System.Threading.Thread(() =>
            {
                var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this);
                //直接保存本地,
                SaveFunctionFile();
                if (pack.Code == StateCode.SUCCESS)
                {
                }
                else
                {
                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 更新功能信息
        /// </summary>
        public void UpdataFuncitonInfo()
        {
            new System.Threading.Thread(() =>
            {
                var pm = new HttpServerRequest();
                var pack = pm.UpdataDevcieInfo(this);
                SaveFunctionFile();
                if (pack.Code == StateCode.SUCCESS)
                {
                }
                else
                {
                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 更新功能名称
        /// </summary>
        public void UpdataFunctionName()
        {
            new System.Threading.Thread(() =>
            {
                var pm = new HttpServerRequest();
                var pack = pm.UpdataDevcieInfo(this);
                SaveFunctionFile();
                if (pack.Code == StateCode.SUCCESS)
                {
                }
                else
                {
                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 保存功能数据
        /// </summary>
        public void SaveFunctionData(bool upSevser)
        {
            if (upSevser)
            {
                new System.Threading.Thread(() =>
                {
                    var pm = new HttpServerRequest();
                    var pack = pm.UpdataDevcieInfo(this);
                    if (pack.Code == StateCode.SUCCESS)
                    {
                        var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
                        FileUtlis.Files.WriteFileByBytes(savePath, ssd);
                    }
                    else
                    {
                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                    }
                });
            }
            else
            {
                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
                FileUtlis.Files.WriteFileByBytes(savePath, ssd);
            }
        }
        //public void SaveFunctionData(bool upSevser)
        //{
        //    if (upSevser)
        //    {
        //        new System.Threading.Thread(() =>
        //        {
        //            var pm = new HttpServerRequest();
        //            var pack = pm.UpdataDevcieInfo(this);
        //            if (pack.Code == StateCode.SUCCESS)
        //            {
        //                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
        //                FileUtlis.Files.WriteFileByBytes(savePath, ssd);
        //            }
        //            else
        //            {
        //                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
        //            }
        //        })
        //        { IsBackground = true }.Start();
        //    }
        //    else
        //    {
        //        var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
        //        FileUtlis.Files.WriteFileByBytes(savePath, ssd);
        //    }
        //}
        /// <summary>
HDL_ON/Entity/FunctionList.cs
@@ -254,41 +254,41 @@
                case FunctionType.AC:
                    var sidObj =  Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.aCs.Add(sidObj);
                    sidObj.SaveFunctionData(false);
                    sidObj.SaveFunctionFile();
                    break;
                case FunctionType.FloorHeating:
                    var sidObj1 =  Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.floorHeatings.Add(sidObj1);
                    sidObj1.SaveFunctionData(false);
                    sidObj1.SaveFunctionFile();
                    break;
                case FunctionType.Dimmer:
                case FunctionType.RGB:
                case FunctionType.Relay:
                    var sidObj2 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.lights.Add(sidObj2);
                    sidObj2.SaveFunctionData(false);
                    sidObj2.SaveFunctionFile();
                    break;
                case FunctionType.Curtain:
                case FunctionType.RollingShutter:
                case FunctionType.MotorCurtain:
                    var sidObj3 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.curtains.Add(sidObj3 );
                    sidObj3.SaveFunctionData(false);
                    sidObj3.SaveFunctionFile();
                    break;
                case FunctionType.TV:
                    var sidObj4 =  Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.tVs.Add(sidObj4);
                    sidObj4.SaveFunctionData(false);
                    sidObj4.SaveFunctionFile();
                    break;
                case FunctionType.Socket:
                    var sidObj5 =  Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.switchSockets.Add(sidObj5);
                    sidObj5.SaveFunctionData(false);
                    sidObj5.SaveFunctionFile();
                    break;
                case FunctionType.Fan:
                    var sidObj6 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.fans.Add(sidObj6);
                    sidObj6.SaveFunctionData(false);
                    sidObj6.SaveFunctionFile();
                    break;
                case FunctionType.CO2:
                case FunctionType.TVOC:
@@ -297,7 +297,7 @@
                case FunctionType.Humidity:
                    var sidObj7 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                    List.sensorsEnvironmentalScience.Add(sidObj7);
                    sidObj7.SaveFunctionData(false);
                    sidObj7.SaveFunctionFile();
                    break;
            }
        }
@@ -417,7 +417,7 @@
                                        localFunction.modifyTime = newFunction.modifyTime;
                                        localFunction.roomIds = newFunction.roomIds;
                                        localFunction.bus = newFunction.bus;
                                        localFunction.SaveFunctionData(false);
                                        localFunction.SaveFunctionFile();
                                    }
                                    deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能
                                }
@@ -426,7 +426,7 @@
                        //处理剩下的新增功能
                        foreach (var newFunction in deviceList.list)
                        {
                            newFunction.SaveFunctionData(false);
                            newFunction.SaveFunctionFile();
                            List.IniFunctionList(newFunction.savePath);
                        }
                    }
@@ -499,8 +499,10 @@
        }
        /// <summary>
        /// 删除场景
        /// todo
        /// </summary>
        public void DeleteScene(Scene scene,bool upSevser)
        {
@@ -510,22 +512,22 @@
                var packCode = pm.DeleteScene(scene.userSceneId);
                if (packCode == StateCode.SUCCESS)
                {
                    Common.FileUtlis.Files.DeleteFile(scene.savePath);
                    FileUtlis.Files.DeleteFile(scene.savePath);
                    List.scenes.Remove(scene);
                }
                else
                {
                    Utlis.ShowTip(Shared.Language.StringByID(StringId.DeleteSceneFail) + "Code:" + packCode);
                    IMessageCommon.Current.ShowErrorInfoAlter(packCode);
                }
            }
            else
            {
                Common.FileUtlis.Files.DeleteFile(scene.savePath);
                FileUtlis.Files.DeleteFile(scene.savePath);
                List.scenes.Remove(scene);
            }
        }
        /// <summary>
        /// 删除本地功能文件
        /// 删除本地功能及文件
        /// </summary>
        public void DeleteFunction(Function delTemp)
        {
HDL_ON/Entity/Room.cs
@@ -65,121 +65,33 @@
        ///// </summary>
        //public bool DeleteSign = false;
        protected ResponsePackNew SaveSpatialInfo()
        {
            var pm = new HttpServerRequest();
            var revPack = new ResponsePackNew();
            if (string.IsNullOrEmpty(createTime) && string.IsNullOrEmpty(modifyTime))
            {
                revPack = pm.AddRoom(new List<SpatialInfo>() { this });
            }
            else if (string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime))
            {
                revPack = pm.DeleteRoom(new List<string>() { roomId });
            }
            else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime))
            {
                revPack = pm.UpdateRoom(new List<SpatialInfo>() { this });
            }
            return revPack;
        }
        /// <summary>
        /// 下载云端房间数据
        /// </summary>
        public void DownloadRoomList()
        {
            new System.Threading.Thread(() =>
            {
                var pm = new HttpServerRequest();
                var pack = pm.GetRoomList();
                if (pack.Code == StateCode.SUCCESS)
                {
                    var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(pack.Data.ToString());
                    if (revData != null)
                    {
                        CurrentSpatial.UpdateSpatialList(revData.list, OptionType.Cover);
                    }
                }
                else
                {
                    MainPage.Log($"读取房间数据失败:\r\nCode:{pack.Code}; msg:{pack.message}");
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 更新空间信息
        /// </summary>
        /// <param name="spatials">空间信息</param>
        /// <param name="optionType">操作类型:ADD/UPDATE/DELETE</param>
        public void UpdateSpatialList(List<SpatialInfo> spatials,OptionType optionType)
        public void UpdateSpatialList(List<SpatialInfo> spatials)
        {
            var roomUpdateList = spatials.FindAll((obj) => obj.roomType == "ROOM");
            var floorUpdateList = spatials.FindAll((obj) => obj.roomType == "FLOOR");
            //处理房间列表
            if (roomUpdateList != null && roomUpdateList.Count > 0)
            {
                if (optionType == OptionType.Update)
                CurrentSpatial.DeleteAllRoom();
                foreach (var newRoom in roomUpdateList)
                {
                    foreach (var updateTemp in roomUpdateList)
                    {
                        var localRoom = CurrentSpatial.RoomList.Find((obj) => obj.roomId == updateTemp.roomId);
                        if (localRoom != null)
                        {
                            if (localRoom.modifyTime != updateTemp.modifyTime)
                            {
                                localRoom.roomName = updateTemp.roomName;
                                localRoom.roomImage = updateTemp.roomImage;
                                localRoom.parentId = updateTemp.parentId;
                                localRoom.createTime = updateTemp.createTime;
                                localRoom.modifyTime = updateTemp.modifyTime;
                                localRoom.SaveRoomData(false);
                            }
                        }else
                        {
                            updateTemp.SaveRoomData(false);
                        }
                    }
                }
                else if (optionType == OptionType.Cover)
                {
                    CurrentSpatial.DeleteAllRoom();
                    foreach(var newRoom in roomUpdateList)
                    {
                        newRoom.SaveRoomData(false);
                        RoomList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(
                            Newtonsoft.Json.JsonConvert.SerializeObject(newRoom)));
                    }
                    newRoom.SaveRoomFile();
                    RoomList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(
                        Newtonsoft.Json.JsonConvert.SerializeObject(newRoom)));
                }
            }
            //楼层房间列表
            if (floorUpdateList != null && floorUpdateList.Count > 0)
            {
                if (optionType == OptionType.Update)
                FloorList.Clear();
                foreach (var updateTemp in floorUpdateList)
                {
                    foreach(var updateTemp in floorUpdateList)
                    {
                        var localFloor = FloorList.Find((obj) => obj.roomId == updateTemp.roomId);
                        if (localFloor == null)
                        {
                            FloorList.Add(updateTemp);
                        }
                        else
                        {
                            localFloor = updateTemp;
                        }
                    }
                }
                if(optionType == OptionType.Cover)
                {
                    FloorList.Clear();
                    foreach (var updateTemp in floorUpdateList)
                    {
                        FloorList.Add(updateTemp);
                    }
                    FloorList.Add(updateTemp);
                }
                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList));
                Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
@@ -439,7 +351,7 @@
        /// <summary>
        /// 初始化每个房间的功能数据
        /// </summary>
        public void InitRoomFunction()
        public void InitRoomListFunctions()
        {
            new System.Threading.Thread(() =>
            {
@@ -448,8 +360,7 @@
                    //初始化住宅所有房间功能数据
                    foreach (var r in RoomList)
                    {
                        r.GetRoomFunctions(true);
                        r.GetRoomScenes(true);
                        InitRoomFuntion(r);
                    }
                }
                catch (Exception ex)
@@ -459,25 +370,42 @@
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 初始化房间功能
        /// </summary>
        /// <param name="tempRoom"></param>
        public void InitRoomFuntion(Room tempRoom)
        {
            tempRoom.GetRoomFunctions(true);
            tempRoom.GetRoomScenes(true);
        }
        /// <summary>
        /// 保存房间数据
        /// 保存房间数据文件
        /// </summary>
        public string SaveRoomData(bool upServer = true)
        public void SaveRoomFile()
        {
            var packCode = StateCode.SUCCESS;
            bool needSave = true;
            if (upServer)
            {
                packCode = SaveSpatialInfo().Code;
            }
            if (needSave)
            {
                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
                Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
            }
            return packCode;
            var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
            Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
        }
        /// <summary>
        /// 更新房间数据
        /// </summary>
        public void UpdataRoomInfo()
        {
            new System.Threading.Thread(() =>
            {
                var pm = new HttpServerRequest();
                var pack = pm.UpdateRoom(new List<SpatialInfo>() { this });
                this.SaveRoomFile();
                if (pack.Code != StateCode.SUCCESS)
                {
                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                }
            })
            { IsBackground = true }.Start();
        }
        #endregion
    }
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -860,7 +860,7 @@
                    }
                    string msg = function.name + Language.StringByID(StringId.CollectionCancelled);
                    LoadDeviceFunctionControlZone();
                    function.SaveFunctionData(true);
                    function.CollectFunction();
                };
                var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone);
HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs
@@ -30,7 +30,7 @@
        {
            Action editBackAction = () =>
            {
                room.SaveRoomData();
                room.UpdataRoomInfo();
                ReLoadPage();
                ReloadRoomName();
            };
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
@@ -92,22 +92,54 @@
        void RefreshFloorsListView(string floorName)
        {
            try
            var waitPage = new Loading();
            MainPage.BaseView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            new System.Threading.Thread(() =>
            {
                var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
                var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
                if (addResult == DAL.Server.StateCode.SUCCESS)
                try
                {
                    LoadFloorRow(f);
                    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
                    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f);
                    if (addResult == DAL.Server.StateCode.SUCCESS)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            LoadFloorRow(f);
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                MainPage.Log("add floor eroor : " + ex.Message);
            }
            int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
            floorsListView.Height = Application.GetRealHeight(50 * count);
            contentView.Height = Application.GetRealHeight(50 * (count + 1));
                catch { }
                finally
                {
                    Application.RunOnMainThread(() => {
                        waitPage.Hide();
                        waitPage.RemoveFromParent();
                        int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
                        floorsListView.Height = Application.GetRealHeight(50 * count);
                        contentView.Height = Application.GetRealHeight(50 * (count + 1));
                    });
                }
            })
            { IsBackground = true }.Start();
            //try
            //{
            //    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
            //    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
            //    if (addResult == DAL.Server.StateCode.SUCCESS)
            //    {
            //        LoadFloorRow(f);
            //    }
            //}
            //catch (Exception ex)
            //{
            //    MainPage.Log("add floor eroor : " + ex.Message);
            //}
            //int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
            //floorsListView.Height = Application.GetRealHeight(50 * count);
            //contentView.Height = Application.GetRealHeight(50 * (count + 1));
        }
        public void LoadPage()
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs
old mode 100755 new mode 100644
@@ -125,12 +125,33 @@
        {
            try
            {
                var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
                var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
                if (addResult == DAL.Server.StateCode.SUCCESS)
                var waitPage = new Loading();
                MainPage.BaseView.AddChidren(waitPage);
                waitPage.Start(Language.StringByID(StringId.PleaseWait));
                new System.Threading.Thread(() =>
                {
                    LoadFloorRow(f);
                }
                    try
                    {
                        var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
                        var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f);
                        if (addResult == DAL.Server.StateCode.SUCCESS)
                        {
                            Application.RunOnMainThread(() =>
                            {
                                LoadFloorRow(f);
                            });
                        }
                    }
                    catch { }
                    finally
                    {
                        Application.RunOnMainThread(() => {
                            waitPage.Hide();
                            waitPage.RemoveFromParent();
                        });
                    }
                })
                { IsBackground = true }.Start();
            }
            catch (Exception ex)
            {
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
old mode 100755 new mode 100644
@@ -33,12 +33,33 @@
                    }
                    else
                    {
                        var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
                        if (editResult == DAL.Server.StateCode.SUCCESS)
                        var waitPage = new Loading();
                        MainPage.BaseView.AddChidren(waitPage);
                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
                        new System.Threading.Thread(() =>
                        {
                            floor.roomName = newName;
                            btn.Text = newName;
                        }
                            try
                            {
                                var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
                                Application.RunOnMainThread(() =>
                                {
                                    if (editResult == DAL.Server.StateCode.SUCCESS)
                                    {
                                        floor.roomName = newName;
                                        btn.Text = newName;
                                    }
                                });
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() => {
                                    waitPage.Hide();
                                    waitPage.RemoveFromParent();
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                    }
                };
                var floors = new List<string>();
@@ -80,7 +101,11 @@
                                row.RemoveFromParent();
                            }
                        }
                        SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
                        new System.Threading.Thread(() =>
                        {
                            SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
                        })
                        { IsBackground = true }.Start();
                    }
                };
                new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DelFloorTip, action);
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
@@ -133,7 +133,7 @@
                        {
                            f.roomIds.Add(room.roomId);
                        }
                        f.SaveFunctionData(true);
                        f.UpdataRoomIds();
                    }
                    room.GetRoomFunctions(true);
                    bodyView.RemoveFromParent();
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
@@ -105,7 +105,7 @@
                }
                btnRoomName.Text = str;
                room.roomName = str;
                room.SaveRoomData();
                room.UpdataRoomInfo();
            };
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
@@ -131,7 +131,7 @@
                Action floorsCallBackAction = () =>
                {
                    btnFloorInfo.Text = room.floorName;
                    room.SaveRoomData();
                    room.UpdataRoomInfo();
                };
                var residentialManagePage = new RoomBinglingFloorPage(floorsCallBackAction, room);
                MainPage.BasePageView.AddChidren(residentialManagePage);
@@ -255,7 +255,7 @@
                    room.backgroundImage = obj;
                    btnRoomBg.ImageBytes = null;//解决有ImageBytes不加载ImagePath
                    btnRoomBg.ImagePath = room.backgroundImage;
                    room.SaveRoomData();
                    room.UpdataRoomInfo();
                    modifyImageAction?.Invoke();
                };
@@ -283,7 +283,7 @@
            {
                //2020-12-03 需要讲最新的图片路径同步到云端
                room.backgroundImage = imageUrl;
                room.SaveRoomData();
                room.UpdataRoomInfo();
                modifyImageAction?.Invoke();
            };
            //上传图片到云端
HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
@@ -150,8 +150,8 @@
                ProgressBarColor = CSS_Color.MainColor,
                OfflineProgressBarColor = CSS_Color.PromptingColor2,
                IsOffline = aC.trait_on_off.curValue.ToString() == "off",
                MinValue = 16,
                MaxValue = 32,
                MinValue = aC.trait_temp.min,
                MaxValue = aC.trait_temp.max,
                //IsClickable = aC.trait_on_off.curValue.ToString() == "on",
                ArcColor = CSS_Color.BackgroundColor,
                Progress = Convert.ToInt32(aC.trait_temp.curValue),
HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
@@ -36,7 +36,14 @@
                    }
                    bodyView.arcBar.ThumbImagePath = uAc.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png";
                    bodyView.arcBar.IsClickable = uAc.trait_on_off.curValue.ToString() == "on";
                    if(uAc.trait_mode.curValue.ToString() == "fan")
                    {
                        bodyView.arcBar.IsClickable = false;
                    }
                    else
                    {
                        bodyView.arcBar.IsClickable = true;
                    }
                });
            }
            catch (Exception ex)
@@ -77,12 +84,12 @@
        {
            btnMinus.MouseUpEventHandler = (sender, e) =>
            {
                if (aC.trait_on_off.curValue.ToString() == "off")
                if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan")
                {
                    return;
                }
                var temp = Convert.ToInt32(aC.trait_temp.curValue);
                if (temp < 17)
                if (temp <= aC.trait_temp.min)
                {
                    return;
                }
@@ -97,12 +104,12 @@
            };
            btnPlus.MouseUpEventHandler = (sender, e) =>
            {
                if (aC.trait_on_off.curValue.ToString() == "off")
                if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan")
                {
                    return;
                }
                var temp = Convert.ToInt32(aC.trait_temp.curValue);
                if (temp > 31)
                if (temp >= aC.trait_temp.max)
                {
                    return;
                }
@@ -193,6 +200,14 @@
                d.Add(FunctionAttributeKey.Mode, curMode);
                Control.Ins.SendWriteCommand(aC, d);
                dialog.Close();
                if (aC.trait_mode.curValue.ToString() == "fan")
                {
                    bodyView.arcBar.IsClickable = false;
                }
                else
                {
                    bodyView.arcBar.IsClickable = true;
                }
            };
            btn1.MouseUpEventHandler = eventHandler1;
            btn2.MouseUpEventHandler = eventHandler1;
HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Shared;
namespace HDL_ON.UI
@@ -47,19 +48,19 @@
                    }
                }
                function.roomIds.Clear();
                foreach (var room in Entity.SpatialInfo.CurrentSpatial.RoomList)
                if (btnChooseAll.IsSelected)
                {
                    if (btnChooseAll.IsSelected)
                    foreach (var room in Entity.SpatialInfo.CurrentSpatial.RoomList)
                    {
                        function.roomIds.Add(room.roomId);
                        if (btnChooseAll.IsSelected)
                        {
                            function.roomIds.Add(room.roomId);
                        }
                    }
                    else
                    {
                        function.roomIds.Remove(room.roomId);
                    }
                    function.SaveFunctionData(true);
                }
                Entity.SpatialInfo.CurrentSpatial.InitRoomFunction();
                function.UpdataRoomIds();
                Entity.SpatialInfo.CurrentSpatial.InitRoomListFunctions();
            };
        }
@@ -78,7 +79,7 @@
                function.roomIds.Remove(room.roomId);
                room.RemoveRoomFunction(function);
            }
            function.SaveFunctionData(true);
            function.UpdataRoomIds();
            if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count)
            {
                btnChooseAll.IsSelected = true;
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -38,7 +38,7 @@
            actionRefresh = () => {
                btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName();
                socketFunction.SaveFunctionData(true);
                socketFunction.UpdataFuncitonInfo();
            };
        }
HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -18,7 +18,7 @@
            actionRefresh = () => {
                btnFunctionName.Text = btnFunctionName_Out.Text = tv.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = tv.GetRoomListName();
                tv.SaveFunctionData(true);
                tv.UpdataFuncitonInfo();
            };
        }
HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
@@ -146,8 +146,8 @@
                ProgressBarColor = CSS_Color.MainColor ,//: CSS_Color.PromptingColor2, // 0xFFFC9C04 : CSS_Color.PromptingColor2,
                OfflineProgressBarColor = CSS_Color.PromptingColor2,
                IsOffline = fh.trait_on_off.curValue.ToString() == "off",
                MinValue = 5,
                MaxValue = 35,
                MinValue = fh.trait_temp.min,
                MaxValue = fh.trait_temp.max,
                //IsClickable = fh.trait_on_off.curValue.ToString() == "on",
                ArcColor = CSS_Color.BackgroundColor,
                Progress = Convert.ToInt32(fh.trait_temp.curValue),
HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs
@@ -37,7 +37,7 @@
                    {
                        function.name = name;
                        btnFunctionName.Text = name;
                        function.SaveFunctionData(true);
                        function.UpdataFuncitonInfo();
                    }
                };
                new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, function.name, callBackAction,StringId.DeviceNameCannotBeEmpty,0,new System.Collections.Generic.List<string>());
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
@@ -66,7 +66,7 @@
            barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
            {
                light.fadeTime = e;
                light.SaveFunctionData(true);
                light.UpdataFuncitonInfo();
            };
        }
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
@@ -19,13 +19,12 @@
                        return;
                    if (uFunction.functionType == bodyView.light.functionType && uFunction.sid == bodyView.light.sid)
                    {
                        if (uFunction.trait_on_off.curValue.ToString() == "on")
                        {
                            bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png";
                            bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
                            bodyView.btnSwitch.IsSelected = true;
                            bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor());
                            if (!bodyView.onDimmerBar)
                            {
                                bodyView.dimmerBar.Progress = uFunction.brightness;
@@ -40,6 +39,7 @@
                            //色盘的圆点隐藏
                            bodyView.btnWhiteRound.Visible = false;
                        }
                        bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor());
                    }
                }
                catch (Exception ex)
@@ -198,7 +198,7 @@
            barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
            {
                light.fadeTime = barFadeTime.Progress;
                light.SaveFunctionData(true);
                light.UpdataFuncitonInfo();
            };
        }
        /// <summary>
@@ -246,6 +246,7 @@
                {
                    return;
                }
                btnWhiteRound.Visible = true;
                btnWhiteRound.Gravity = Gravity.Center;
                light.SetRGBcolor(new byte[] { 255, 255, 255 });