| | |
| | | public string group = "1"; |
| | | /// <summary> |
| | | /// 场景类型 |
| | | /// 0:普通 |
| | | /// 1:电影 |
| | | /// 2:调光 |
| | | /// </summary> |
| | | public SceneType sceneType = SceneType.OrdinaryScenes; |
| | | /// <summary> |
| | | /// 收藏标记 |
| | | /// </summary> |
| | | public bool collect = false; |
| | | /// <summary> |
| | | /// 是否允许删除 |
| | | /// </summary> |
| | | public bool can_delete = true; |
| | | |
| | | /// <summary> |
| | | /// 创建该场景的用户ID |
| | | /// </summary> |
| | | public string userId = ""; |
| | | public string userId = UserInfo.Current.ID; |
| | | |
| | | ///// <summary> |
| | | ///// 场景背景 |
| | |
| | | return "SceneData_" + sid; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行倒计时 |
| | | /// </summary> |
| | | int countdownTime = 0; |
| | | /// <summary> |
| | | /// 重置执行倒计时 |
| | | /// </summary> |
| | | public void ResetCountdownTime() |
| | | { |
| | | countdownTime = 0; |
| | | } |
| | | /// <summary> |
| | | /// 场景执行\倒计时 |
| | | /// </summary> |
| | |
| | | //场景正在倒计时执行中 |
| | | if (LastExecutionTime != "" && Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) > Convert.ToDouble(Utlis.GetTimestamp(false))) |
| | | { |
| | | int time = 0; |
| | | int.TryParse(Convert.ToInt32( |
| | | Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) - Convert.ToDouble(Utlis.GetTimestamp(false)) |
| | | ).ToString(), out time); |
| | | if (time > 0) |
| | | ).ToString(), out countdownTime); |
| | | if (countdownTime > 0) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | if (time > 0) |
| | | if (countdownTime > 0) |
| | | { |
| | | while (time > 0) |
| | | while (countdownTime > 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (time > 60) |
| | | if (countdownTime > 60) |
| | | { |
| | | btnShowDelay.Text = (time / 60).ToString() + "min" + time % 60 + "s"; |
| | | btnShowDelay.Text = (countdownTime / 60).ToString() + "min" + countdownTime % 60 + "s"; |
| | | } |
| | | else |
| | | { |
| | | btnShowDelay.Text = time.ToString() + "s"; |
| | | btnShowDelay.Text = countdownTime.ToString() + "s"; |
| | | } |
| | | }); |
| | | System.Threading.Thread.Sleep(1000); |
| | | time--; |
| | | countdownTime--; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | var revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | //重置执行倒计时 |
| | | this.countdownTime = 0; |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | var tempScene = scenes.Find((obj) => obj.sid == sid); |
| | | if (tempScene != null) |
| | |
| | | /// </summary> |
| | | public string UpdateScene() |
| | | { |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | |
| | | return "0"; |
| | | } |
| | | var pm = new HttpServerRequest(); |
| | | var revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | this.countdownTime = 0; |
| | | var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | var tempScene = scenes.Find((obj) => obj.sid == sid); |
| | | if (tempScene != null) |
| | |
| | | /// </summary> |
| | | public string delay = "0"; |
| | | |
| | | |
| | | Function _localFunction; |
| | | /// <summary> |
| | | /// 本地对应的功能 |
| | |
| | | /// 转换成功能对象 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Function ConvertFunctionObject() |
| | | private Function ConvertFunctionObject() |
| | | { |
| | | var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); |
| | | return localFunction; |
| | |
| | | if (sfs.key == FunctionAttributeKey.OnOff) |
| | | { |
| | | if (sfs.value == "off") |
| | | { |
| | | return Language.StringByID(StringId.Close); |
| | | } |
| | | } |
| | | } |
| | | sceneFunctionInfo += Language.StringByID(StringId.Open) + " "; |
| | |
| | | var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | | { |
| | | sceneFunctionInfo += briState.value + "%"; |
| | | sceneFunctionInfo += briState.value + "%" + " "; |
| | | } |
| | | var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent); |
| | | if (perState != null) |
| | | { |
| | | sceneFunctionInfo += perState.value + "%"; |
| | | sceneFunctionInfo += perState.value + "%" + " "; |
| | | } |
| | | var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT); |
| | | if(cctState != null) |
| | | { |
| | | sceneFunctionInfo += cctState.value + "%" + " "; |
| | | } |
| | | var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB); |
| | | if(rgbState!=null) |
| | | { |
| | | //sceneFunctionInfo += new cctState.value + "%" + " "; |
| | | } |
| | | return sceneFunctionInfo; |
| | | } |
| | |
| | | { |
| | | public string key = ""; |
| | | public string value = ""; |
| | | |
| | | public int max = 0; |
| | | public int min = 0; |
| | | |
| | | /// <summary> |
| | | /// 属性名称显示文本 |
| | |
| | | /// <summary> |
| | | /// 属性值单位 |
| | | /// </summary> |
| | | public string GetUintString() |
| | | public string GetUintString(string inputKey = "") |
| | | { |
| | | var us = ""; |
| | | switch (key) |
| | | var swithchString = key; |
| | | if(!string.IsNullOrEmpty(inputKey)) |
| | | { |
| | | swithchString = inputKey; |
| | | } |
| | | switch (swithchString) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.Brightness: |
| | | us = "%"; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | us = "K"; |
| | | break; |
| | | } |
| | | return us; |
| | |
| | | /// 获取指定属性的显示文本 |
| | | /// 中英文显示 |
| | | /// </summary> |
| | | public string GetValueText() |
| | | public string GetValueText(string temp = "") |
| | | { |
| | | string catchString = value; |
| | | if(temp!= "") |
| | | { |
| | | catchString = temp; |
| | | } |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | text = catchString == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | if (value == "") |
| | | int outT = 0; |
| | | int.TryParse(catchString,out outT); |
| | | if (outT < 0) |
| | | catchString = "0"; |
| | | if (catchString == "") |
| | | { |
| | | value = "0"; |
| | | catchString = "0"; |
| | | } |
| | | text = value; |
| | | text = catchString; |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | | switch (value) |
| | | switch (catchString) |
| | | { |
| | | //----空调 |
| | | case "auto": |
| | |
| | | text = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | //-----地热 |
| | | // 1:普通,2:白天,3:夜晚,4:离开,5:时间 |
| | | case "day": |
| | | text = Language.StringByID(StringId.Day); |
| | | break; |
| | |
| | | } |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | switch (value) |
| | | switch (catchString) |
| | | { |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |