| | |
| | | { |
| | | get |
| | | { |
| | | if(_ScenePack == null) |
| | | if (_ScenePack == null) |
| | | { |
| | | _ScenePack = new SceneApiPack(); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public class Scene |
| | | public class Scene |
| | | { |
| | | public Scene() |
| | | { |
| | |
| | | /// 网关ID |
| | | /// </summary> |
| | | public string gatewayId = ""; |
| | | /// <summary> |
| | | /// 云端oss存储图片的路径 |
| | | /// </summary> |
| | | public string image = ""; |
| | | /// <summary> |
| | | /// 所属房间列表 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public string userId = UserInfo.Current.ID; |
| | | |
| | | /// <summary> |
| | | /// 云端oss存储图片的路径 |
| | | /// </summary> |
| | | public string image = "Intelligence/Gallery/scenebg1.png"; |
| | | |
| | | ///// <summary> |
| | | ///// 场景背景 |
| | | ///// </summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(image)) |
| | | //if (string.IsNullOrEmpty(image)) |
| | | //{ |
| | | // return "Intelligence/Gallery/scenebg1.png"; |
| | | //} |
| | | //else |
| | | //{ |
| | | // return image; |
| | | //} |
| | | if(image == "") |
| | | { |
| | | return "Intelligence/Gallery/scenebg1.png"; |
| | | image = "Intelligence/Gallery/scenebg1.png"; |
| | | } |
| | | |
| | | if (image.Contains("Intelligence/Gallery/scenebg")) |
| | | { |
| | | return image; |
| | | } |
| | | else |
| | | { |
| | | var sceneImageInfo = OssSceneImages.Find((obj) => obj.defaultIconUrl == image); |
| | | if (sceneImageInfo != null) |
| | | { |
| | | return sceneImageInfo.localUrl; |
| | | } |
| | | return image; |
| | | } |
| | | } |
| | | set |
| | | { |
| | | image = value; |
| | | var sceneImageInfo = OssSceneImages.Find((obj) => "Intelligence/Gallery/" + obj.defaultIconName + ".png" == value); |
| | | if (sceneImageInfo != null) |
| | | { |
| | | image = sceneImageInfo.defaultIconUrl; |
| | | } |
| | | else |
| | | { |
| | | image = value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 云端场景默认图库数据 |
| | | /// 2022-08-03 10:57:31 wxr |
| | | /// 配合豆豆修改云端数据 |
| | | /// 调试宝、on pro和平台对应 |
| | | /// </summary> |
| | | public List<SceneImageInfo> OssSceneImages = new List<SceneImageInfo>() |
| | | { |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg1", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/781c397f-611a-48a2-a3ed-2520ffb971bb.png", |
| | | localUrl = "Intelligence/Gallery/scenebg1.png", |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg2", |
| | | localUrl = "Intelligence/Gallery/scenebg2.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/be2a7c63-a6c0-427a-bb6d-f5c06f5b2f05.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg3", |
| | | localUrl = "Intelligence/Gallery/scenebg3.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/5d801aca-03fb-4ef3-88ec-75ade3aa1c94.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg4", |
| | | localUrl = "Intelligence/Gallery/scenebg4.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/a205306c-4fcd-4ea1-8e88-e84282dc0d54.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg5", |
| | | localUrl = "Intelligence/Gallery/scenebg5.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/93a0acdc-14be-4776-a9fd-e0fc6f13c909.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg6", |
| | | localUrl = "Intelligence/Gallery/scenebg6.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/45074923-2227-422a-be33-e37e6c3f9d23.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg7", |
| | | localUrl = "Intelligence/Gallery/scenebg7.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/28b3e459-041e-4ea1-9ff9-57053c5357f4.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg8", |
| | | localUrl = "Intelligence/Gallery/scenebg8.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/d470b979-cc06-4701-a2bd-7301856c9195.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg9", |
| | | localUrl = "Intelligence/Gallery/scenebg9.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/1a130d03-86b2-4174-b986-6f6c312a959f.png" |
| | | }, |
| | | new SceneImageInfo |
| | | { |
| | | defaultIconName = "scenebg10", |
| | | localUrl = "Intelligence/Gallery/scenebg10.png", |
| | | defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/54c1c7ab-9b63-4487-a77d-d5d3dadd9801.png" |
| | | } |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 场景功能列表 |
| | |
| | | } |
| | | roomNameList += findRoom.floorName + findRoom.roomName; |
| | | } |
| | | if (roomNameList == "" ) |
| | | if (roomNameList == "") |
| | | { |
| | | roomNameList = Shared.Language.StringByID(StringId.WholeZone); |
| | | } |
| | |
| | | { |
| | | //重置执行倒计时 |
| | | this.countdownTime = 0; |
| | | if(MainPage.NoLoginMode) |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | |
| | | /// </summary> |
| | | public string UpdateScene() |
| | | { |
| | | if(MainPage.NoLoginMode) |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | |
| | | public string GetDelayText() |
| | | { |
| | | var delayInt = 0; |
| | | int.TryParse(delay,out delayInt); |
| | | if(delayInt == 0) |
| | | int.TryParse(delay, out delayInt); |
| | | if (delayInt == 0) |
| | | { |
| | | return Language.StringByID(StringId.NoDelay); |
| | | } |
| | |
| | | if (delayInt > 60) |
| | | { |
| | | text = (delayInt / 60) + Language.StringByID(StringId.m) + (delayInt % 60) + Language.StringByID(StringId.s); |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | text = delayInt + Language.StringByID(StringId.s); |
| | | } |
| | |
| | | sceneFunctionInfo += perState.value + "%" + " "; |
| | | } |
| | | var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT); |
| | | if(cctState != null) |
| | | if (cctState != null) |
| | | { |
| | | sceneFunctionInfo += cctState.value + "K" + " "; |
| | | } |
| | | var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB); |
| | | if(rgbState!=null) |
| | | if (rgbState != null) |
| | | { |
| | | //sceneFunctionInfo += new cctState.value + "%" + " "; |
| | | } |
| | | |
| | | |
| | | |
| | | var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle); |
| | | if (perAngle != null) |
| | | { |
| | | sceneFunctionInfo += " " + perState.value + "°"; |
| | | sceneFunctionInfo += " " + perAngle.value + "°"; |
| | | } |
| | | return sceneFunctionInfo; |
| | | } |
| | |
| | | case "angle": |
| | | text = Language.StringByID(StringId.Angle); |
| | | break; |
| | | case "security": |
| | | text = Language.StringByID(StringId.DeploymentStatus); |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | |
| | | { |
| | | var us = ""; |
| | | var swithchString = key; |
| | | if(!string.IsNullOrEmpty(inputKey)) |
| | | if (!string.IsNullOrEmpty(inputKey)) |
| | | { |
| | | swithchString = inputKey; |
| | | } |
| | |
| | | public string GetValueText(string temp = "") |
| | | { |
| | | string catchString = value; |
| | | if(temp!= "") |
| | | if (temp != "") |
| | | { |
| | | catchString = temp; |
| | | } |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.Security: |
| | | text = catchString == "true" ? Language.StringByID(StringId.Defense) : Language.StringByID(StringId.Undefense); |
| | | break; |
| | | case FunctionAttributeKey.OnOff: |
| | | text = catchString == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | |
| | | case FunctionAttributeKey.RoomTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.CCT: |
| | | case FunctionAttributeKey.Angle: |
| | | int outT = 0; |
| | | int.TryParse(catchString,out outT); |
| | | int.TryParse(catchString, out outT); |
| | | if (outT < 0) |
| | | catchString = "0"; |
| | | if (catchString == "") |
| | |
| | | public List<string> pushTarget = new List<string>(); |
| | | } |
| | | |
| | | } |
| | | public class SceneImageInfoList |
| | | { |
| | | //public Dictionary<string, string> Dic_SceneImages; |
| | | |
| | | //public SceneImageInfoList() |
| | | //{ |
| | | // Dic_SceneImages = new Dictionary<string, string>(); |
| | | // foreach(var sceneImage in sceneImages) |
| | | // { |
| | | // Dic_SceneImages.Add(sceneImage.defaultIconName, sceneImage.defaultIconUrl); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | } |
| | | |
| | | public class SceneImageInfo |
| | | { |
| | | public string defaultIconName; |
| | | public string defaultIconUrl; |
| | | public string localUrl; |
| | | |
| | | } |
| | | |
| | | |
| | | } |