From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs | 103 ++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 81 insertions(+), 22 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs b/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs index a51a0e1..a994e30 100755 --- a/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs +++ b/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs @@ -120,18 +120,31 @@ //鍒濆鍖栨坊鍔犵洰鏍� this.InitAddTargetControl(); - //鍒嗕韩鐨勫満鏅笉鑳戒繚瀛� - if (this.editorScene == null || this.editorScene.IsSharedScene == false) + //瀹屾垚 + var btnSave = new BottomClickButton(); + btnSave.TextID = R.MyInternationalizationString.uFinish; + bodyFrameLayout.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => { - //瀹屾垚 - var btnSave = new BottomClickButton(); - btnSave.TextID = R.MyInternationalizationString.uFinish; - bodyFrameLayout.AddChidren(btnSave); - btnSave.ButtonClickEvent += (sender, e) => - { - //淇濆瓨鍦烘櫙鏁版嵁 - this.SaveSceneData(); - }; + //淇濆瓨鍦烘櫙鏁版嵁 + this.SaveSceneData(); + }; + + //鍒嗕韩鐨勫満鏅笉鑳戒繚瀛� + if (this.editorScene != null && this.editorScene.IsSharedScene == true) + { + btnSave.CanClick = false; + } + else if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶈兘淇濆瓨 + btnSave.CanClick = false; + } + //濡傛灉鏄湁妯℃澘,鏈夎澶囩殑鏃跺��,鍦ㄦ病鏈夊彂閫佹垚鍔熶箣鍓� + else if (Common.Config.Instance.Home.TemplateMode == 2 + && Common.Config.Instance.Home.SendTemplateSuccess == false) + { + btnSave.CanClick = false; } } @@ -189,6 +202,11 @@ //鍒嗕韩鐨勫満鏅笉鑳界紪杈� if (this.editorScene == null || this.editorScene.IsSharedScene == false) { + if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + return; + } btnZhezhao.MouseUpEventHandler += (sender, e) => { //鎴块棿鍥剧墖閫夋嫨 @@ -225,6 +243,7 @@ //鍦烘櫙鍚嶇О var rowScene = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.SceneName), this.cloneScene.Name); rowScene.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputSceneName); + rowScene.txtInput.MaxByte = 32;//闄愬埗鍙兘杈撳叆32涓瓧鑺� rowScene.Y = btnTitle.Bottom + Application.GetRealHeight(23); frameBack.AddChidren(rowScene); rowScene.InitControl(); @@ -247,6 +266,11 @@ { this.nowRoomId = selectId; }; + } + if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + rowBelong.CanClick = false; } } @@ -290,11 +314,22 @@ //鏄剧ず娣诲姞鐩爣鑿滃崟 this.ShowAddTargetMenu(); }; + if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + rowAddTarget.CanClick = false; + } + //濡傛灉鏄湁妯℃澘,鏈夎澶囩殑鏃跺��,鍦ㄦ病鏈夊彂閫佹垚鍔熶箣鍓� + if (Common.Config.Instance.Home.TemplateMode == 2 + && Common.Config.Instance.Home.SendTemplateSuccess == false) + { + rowAddTarget.CanClick = false; + } - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //浠庣綉鍏宠幏鍙栧満鏅殑鎵ц鐩爣 - var result = await this.GetSceneTargetList(); + var result = this.GetSceneTargetList(); if (result == true) { //娣诲姞銆愭墽琛岀洰鏍囪銆� @@ -399,6 +434,11 @@ //鍒嗕韩鐨勫満鏅笉鑳界紪杈� if (this.editorScene == null || this.editorScene.IsSharedScene == false) { + if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + return; + } //缂栬緫 var btnEditor = rowDevice.AddEditorControl(); btnEditor.ButtonClickEvent += (sender, e) => @@ -522,6 +562,11 @@ //鍒嗕韩鐨勫満鏅笉鑳界紪杈� if (this.editorScene == null || this.editorScene.IsSharedScene == false) { + if (Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + return; + } //鍒犻櫎 var btnDelete = rowScene.AddDeleteControl(); btnDelete.ButtonClickEvent += (sender, e) => @@ -588,6 +633,11 @@ //鍒嗕韩鐨勫満鏅笉鑳界紪杈� if (this.editorScene == null || this.editorScene.IsSharedScene == false) { + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + //妯℃澘鍦烘櫙涓嶅厑璁哥紪杈� + return; + } //缂栬緫 var btnEditor = rowDelay.AddEditorControl(); btnEditor.ButtonClickEvent += (sender, e) => @@ -629,11 +679,15 @@ } } + #endregion + + #region 鈻� 鑾峰彇鎵ц鐩爣_______________________ + /// <summary> /// 浠庣綉鍏宠幏鍙栧満鏅殑鎵ц鐩爣 /// </summary> /// <returns></returns> - private async System.Threading.Tasks.Task<bool> GetSceneTargetList() + private bool GetSceneTargetList() { if (this.editorScene == null || this.listAdjustTarget != null) { @@ -643,7 +697,7 @@ //鎵撳紑杩涘害鏉� this.ShowProgressBar(); //鑾峰彇鎵ц鐩爣鍒楄〃 - var listData = await HdlSceneLogic.Current.GetAdjustTargetList(this.editorScene); + var listData = HdlSceneLogic.Current.GetAdjustTargetList(this.editorScene); if (listData == null) { this.CloseProgressBar(ShowReLoadMode.YES); @@ -789,10 +843,10 @@ /// <summary> /// 淇濆瓨鏂板缓鐨勫満鏅� /// </summary> - private async void SaveSceneDataByNewMode() + private void SaveSceneDataByNewMode() { //娣诲姞鍦烘櫙 - this.editorScene = await HdlSceneLogic.Current.AddNewSceneToGateway(this.cloneScene.Name, this.listAdjustTarget); + this.editorScene = HdlSceneLogic.Current.AddNewSceneToGateway(this.cloneScene.Name, this.listAdjustTarget); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); @@ -823,7 +877,7 @@ this.editorScene.Save(); //鏂板缓鍦烘櫙,涓婚〉闇�瑕侀噸鏂板埛鏂� - UserView.UserPage.Instance.RefreshForm = true; + UserView.UserPage.Instance.RefreshAllForm = true; HdlThreadLogic.Current.RunMain(() => { @@ -844,6 +898,8 @@ var result = await HdlSceneLogic.Current.EditorSceneNameFromGateway(this.editorScene, this.cloneScene.Name); if (result == false) { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); return; } } @@ -851,10 +907,10 @@ { //淇敼鍦烘櫙 var result = await HdlSceneLogic.Current.EditorSceneFromGateway(this.editorScene, this.listAdjustTarget); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); if (result == false) { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); return; } } @@ -880,7 +936,7 @@ if (this.editorScene.IconPathType != 0) { //鍒犻櫎鑷畾涔夊浘鐗� - Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, this.editorScene.IconPath)); + HdlFileLogic.Current.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, this.editorScene.IconPath)); HdlAutoBackupLogic.DeleteFile(this.editorScene.IconPath); } if (this.cloneScene.IconPathType != 0) @@ -902,7 +958,10 @@ this.editorScene.Save(); //缂栬緫鍦烘櫙,涓婚〉闇�瑕侀噸鏂板埛鏂� - UserView.UserPage.Instance.RefreshForm = true; + UserView.UserPage.Instance.RefreshAllForm = true; + + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); HdlThreadLogic.Current.RunMain(() => { -- Gitblit v1.8.0