From 691dbe24f5724f153e07947c7b75bdfea5f0b6d5 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 24 九月 2024 16:15:15 +0800 Subject: [PATCH] 离线控制模式 --- HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 103 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 69 insertions(+), 34 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index f1d18b8..75f6c69 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -410,9 +410,9 @@ Y = Application.GetRealHeight(667 - 50), Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.WarningColor, + TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.SubheadingFontSize, - TextID = StringId.Del, + TextID = StringId.Del, BackgroundColor = CSS_Color.MainBackgroundColor, //IsBold = true }; @@ -481,7 +481,6 @@ void LoadFunctionRow() { functionListView.RemoveAll(); - functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); for(int i =0;i<scene.functions.Count;) { var scenefunction = scene.functions[i]; @@ -490,6 +489,7 @@ scene.functions.Remove(scenefunction); continue; } + functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); try { //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45 @@ -595,13 +595,23 @@ }; row.AddChidren(btnFunctionDelayInfo); - if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32(scenefunction.delay) > 0) + try { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); + int delayTime = 0; + int.TryParse(scenefunction.delay, out delayTime); + + if (!string.IsNullOrEmpty(scenefunction.delay) && delayTime > 0) + { + btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); + } + else + { + btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); + } } - else + catch (Exception ex) { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); + MainPage.Log("Error", $"鍦烘櫙缂栬緫锛岃浆璇戞暟鎹紓甯革細{ex.StackTrace}"); } @@ -821,13 +831,21 @@ btnOn.MouseUpEventHandler = (sender, e) => { dialog.Close(); - temp = new SceneFunction(); temp.type = "7"; - temp.status.Add(new SceneFunctionStatus() + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) { - key = "enable", - value = "true" - }); + kv.value = "true"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "true", + }); + } + var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(""); @@ -840,6 +858,10 @@ if (code == "0") { btnTipText.TextID = StringId.OpenArm; + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); } }); } @@ -860,13 +882,21 @@ btnOff.MouseUpEventHandler = (sender, e) => { dialog.Close(); - temp = new SceneFunction(); temp.type = "7"; - temp.status.Add(new SceneFunctionStatus() + + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) { - key = "enable", - value = "false" - }); + kv.value = "false"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "false", + }); + } var waitPage = new Loading(); bodyView.AddChidren(waitPage); @@ -880,6 +910,10 @@ if (code == "0") { btnTipText.TextID = StringId.Close; + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); } }); } @@ -948,11 +982,22 @@ void LoadEvent_ChangeFunctionList() { btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => { - //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); - var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); - MainPage.BasePageView.AddChidren(sefp); - sefp.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation) + { + //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); + var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var sefp = new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); + //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } }; } @@ -995,7 +1040,7 @@ CropImage.TakePicture((imagePath) => { CropImageCallBack(imagePath); - }, imageName, 4, 3); + }, imageName, 4, 3,0); pictureOptionView.Parent.RemoveFromParent(); }; @@ -1006,16 +1051,6 @@ btnAlbum.MouseUpEventHandler = (sender, e) => { btnAlbum.IsSelected = false; - //var pid = Guid.NewGuid(); - //CropImage.SelectPicture((imagePath) => - //{ - // if (imagePath != null) - // { - // addSceneImageView.ImagePath = imagePath.ToString(); - // scene.ImagePath = addSceneImageView.ImagePath; - // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); - // } - //}, pid.ToString(), 4, 3); //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 var imageName = Guid.NewGuid().ToString(); @@ -1023,7 +1058,7 @@ CropImage.SelectPicture((imagePath) => { CropImageCallBack(imagePath); - }, imageName, 4, 3); + }, imageName, 4, 3,0); pictureOptionView.Parent.RemoveFromParent(); -- Gitblit v1.8.0