From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs | 92 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 71 insertions(+), 21 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs b/ZigbeeApp/Shared/Phone/Category/AddOrEditorSceneForm.cs index 3c1a90e..cc76472 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) => { //鎴块棿鍥剧墖閫夋嫨 @@ -215,7 +233,7 @@ //淇℃伅缂栬緫 var btnTitle = new NormalViewControl(300, 60, true); - btnTitle.X = ControlCommonResourse.XXLeft; + btnTitle.X = HdlControlResourse.XXLeft; btnTitle.Y = Application.GetRealHeight(46); btnTitle.TextSize = 15; btnTitle.TextID = R.MyInternationalizationString.uInfoEditor; @@ -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,6 +314,17 @@ //鏄剧ず娣诲姞鐩爣鑿滃崟 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(() => { @@ -318,7 +353,7 @@ if (listAdjustTarget[i].Type == 0) { //璁惧 - var device = Common.LocalDevice.Current.GetDevice(listAdjustTarget[i].DeviceAddr, listAdjustTarget[i].Epoint); + var device = HdlDeviceCommonLogic.Current.GetDevice(listAdjustTarget[i].DeviceAddr, listAdjustTarget[i].Epoint); if (device == null) { //涓嶆樉绀鸿繖涓笉瀛樺湪鏈湴鐨勮澶� @@ -379,12 +414,12 @@ private void AddDeviceTargetRow(Scene.DeviceListData data, int index, bool addLine) { //璁惧 - var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint); + var device = HdlDeviceCommonLogic.Current.GetDevice(data.DeviceAddr, data.Epoint); var rowDevice = new DeviceRoomControl(device, frameTargetTableControl.rowSpace / 2); rowDevice.MainKeys = index.ToString(); this.frameTargetTableControl.AddChidren(rowDevice); //鎺т欢鍚戝彸鍋忕Щ - rowDevice.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft; + rowDevice.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft; rowDevice.InitControl(); rowDevice.frameTable.UseClickStatu = false; @@ -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) => @@ -510,7 +550,7 @@ rowScene.MainKeys = index.ToString(); frameTargetTableControl.AddChidren(rowScene); //鎺т欢鍚戝彸鍋忕Щ - rowScene.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft; + rowScene.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft; rowScene.InitControl(); if (addLine == true) { @@ -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) => @@ -565,7 +610,7 @@ rowDelay.MainKeys = index.ToString(); frameTargetTableControl.AddChidren(rowDelay); //鎺т欢鍚戝彸鍋忕Щ - rowDelay.frameTable.LeftOffset = Application.GetRealWidth(104) - ControlCommonResourse.XXLeft; + rowDelay.frameTable.LeftOffset = Application.GetRealWidth(104) - HdlControlResourse.XXLeft; rowDelay.frameTable.UseClickStatu = false; //鍥炬爣 var btnIcon = rowDelay.frameTable.AddLeftIcon(); @@ -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) => @@ -701,7 +751,7 @@ this.isAdjustTargetChanged = true; foreach (var mainKey in dicData.Keys) { - var device = LocalDevice.Current.GetDevice(mainKey); + var device = HdlDeviceCommonLogic.Current.GetDevice(mainKey); var data = new Scene.DeviceListData(); data.Type = 0; data.DeviceAddr = device.DeviceAddr; @@ -813,7 +863,7 @@ var fileName = $"SceneIcon_{tradeTime}.png"; //鐢熸垚鏂囦欢鍥剧墖 IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), this.btnScenePic.ImageBytes); - HdlAutoBackupLogic.AddOrEditorFile(fileName); + HdlBackupLogic.Current.AddOrEditorAutoBackFileStatu(fileName); this.cloneScene.IconPath = fileName; } //杞Щ灞炴�� @@ -883,7 +933,7 @@ { //鍒犻櫎鑷畾涔夊浘鐗� HdlFileLogic.Current.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, this.editorScene.IconPath)); - HdlAutoBackupLogic.DeleteFile(this.editorScene.IconPath); + HdlBackupLogic.Current.DeleteAutoBackFileStatu(this.editorScene.IconPath); } if (this.cloneScene.IconPathType != 0) { @@ -892,7 +942,7 @@ var fileName = $"SceneIcon_{tradeTime}.png"; //鐢熸垚鏂囦欢鍥剧墖 IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), this.btnScenePic.ImageBytes); - HdlAutoBackupLogic.AddOrEditorFile(fileName); + HdlBackupLogic.Current.AddOrEditorAutoBackFileStatu(fileName); this.cloneScene.IconPath = fileName; } } -- Gitblit v1.8.0