| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading; |
| | | using HDL_ON.Common; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.DAL.Server; |
| | | using Shared; |
| | |
| | | } |
| | | else |
| | | { |
| | | Utlis.ShowTip(Shared.Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | return pack.Code; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 添加场景 |
| | | /// </summary> |
| | | public string AddScene(Scene scene,out Scene result) |
| | | public string AddScene(Scene scene, out Scene result) |
| | | { |
| | | Scene tempScene = null; |
| | | var pm = new HttpServerRequest(); |
| | |
| | | var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | tempScene = sceneList.Find((obj) => obj.sid == scene.sid); |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd); |
| | | FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd); |
| | | result = tempScene; |
| | | } |
| | | result = tempScene; |
| | | else |
| | | { |
| | | result = tempScene; |
| | | } |
| | | return revPack.Code; |
| | | } |
| | | #endregion |
| | | |
| | | #region 收藏功能 |
| | | |
| | | /// <summary> |
| | | /// 收藏场景 |
| | | /// </summary> |
| | | public string CollectScene(Scene scene) |
| | | { |
| | | var result = ""; |
| | | if (scene.collect) |
| | | { |
| | | result = ApiUtlis.Ins.HttpRequest.CollectDevice(scene.userSceneId).Code; |
| | | } |
| | | else |
| | | { |
| | | result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(scene.userSceneId).Code; |
| | | } |
| | | |
| | | //提示错误 |
| | | if (result != StateCode.SUCCESS) |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 功能文本相关 |
| | | /// <summary> |
| | | /// 属性名称显示文本 |