From 528c105b3aea0e6e00477365f16f57c1e3d7eb1c Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 24 十月 2019 15:31:28 +0800 Subject: [PATCH] 2019-10-24-3 --- ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlManualBackUpForm.cs | 219 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 115 insertions(+), 104 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlManualBackUpForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlManualBackUpForm.cs index 8943818..fa6d90c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlManualBackUpForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlManualBackUpForm.cs @@ -7,57 +7,60 @@ /// <summary> /// 澶囦唤鐢婚潰 /// </summary> - public class HdlManualBackUpForm : UserCenterCommonForm + public class HdlManualBackUpForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> /// 鍒楄〃鎺т欢 /// </summary> - private VerticalScrolViewLayout listView = null; + private VerticalListControl listView = null; #endregion #region 鈻� 鍒濆鍖朹____________________________ - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - public void ShowForm() - { - //璁剧疆鏍囬淇℃伅 + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆鏍囬淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackupAndRecover)); //鍙充笂娣诲姞鎸夐挳 - var btnTopIcon = new TopLayoutMostRightView(); + var btnTopIcon = new MostRightIconControl(69, 69); btnTopIcon.UnSelectedImagePath = "Item/Add.png"; - btnTopIcon.SelectedImagePath = "Item/AddSelected.png"; - topFrameLayout.AddChidren(btnTopIcon); - btnTopIcon.MouseUpEventHandler += (sender, e) => + topFrameLayout.AddChidren(btnTopIcon); + btnTopIcon.InitControl(); + btnTopIcon.ButtonClickEvent += (sender, e) => { //鏄剧ず娣诲姞澶囪�冨悕鐢婚潰 - this.ShowAddBackupForm(); - }; - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - private void InitMiddleFrame() + this.ShowAddBackupForm(); + }; + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄦ帶浠� + /// </summary> + private void InitMiddleFrame() { - listView = new VerticalScrolViewLayout(); + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + listView = new VerticalListControl(29); + listView.BackgroundColor = UserCenterColor.Current.White; listView.Height = bodyFrameLayout.Height; bodyFrameLayout.AddChidren(listView); - new System.Threading.Thread(() => + HdlThreadLogic.Current.RunThread(() => { //浠庝簯绔幏鍙栨暟鎹� this.SetBackupInfoToForm(); - }) - { IsBackground = true }.Start(); + }); } #endregion @@ -84,17 +87,19 @@ Application.RunOnMainThread(() => { - listView.RemoveAll(); - }); + if (this.Parent == null || listView == null) + { + return; - foreach (BackupListNameInfo fileInfo in pageData) - { - Application.RunOnMainThread(() => + } + listView.RemoveAll(); + int count = pageData.Count - 1; + for (int i = 0; i < pageData.Count; i++) { //娣诲姞澶囦唤琛� - this.AddRowlayout(fileInfo); - }); - } + this.AddRowlayout(pageData[i], i != count); + } + }); } #endregion @@ -105,53 +110,65 @@ /// 娣诲姞澶囦唤琛� /// </summary> /// <param name="fileInfo"></param> - private void AddRowlayout(BackupListNameInfo fileInfo) + private void AddRowlayout(BackupListNameInfo fileInfo, bool addLine) { //琛� - var rowLayout = new StatuRowLayout(listView); + var rowLayout = new RowLayoutControl(listView.rowSpace / 2); + listView.AddChidren(rowLayout); + //鍥炬爣 - var btnPoint = new RowLeftIconView(); - btnPoint.SelectedImagePath = "Center/BackupSelected.png"; + var btnPoint = rowLayout.frameTable.AddLeftIcon(); btnPoint.UnSelectedImagePath = "Center/Backup.png"; - rowLayout.AddChidren(btnPoint); //澶囦唤鍚嶅瓧 - var txtText = new RowCenterView(); - txtText.Text = fileInfo.BackupName; - rowLayout.AddChidren(txtText); - txtText.X -= ControlCommonResourse.PointXXLeft; + var txtText = rowLayout.frameTable.AddLeftCaption(fileInfo.BackupName, 700); + if (addLine == true) + { + //搴曠嚎 + rowLayout.frameTable.AddBottomLine(); + } //缂栬緫澶囨敞鍚� - rowLayout.MouseUpEvent += (sender, e) => + rowLayout.frameTable.ButtonClickEvent += (sender, e) => { //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰 this.ShowEditorBackupForm(fileInfo); }; //涓嬭浇鍥炬爣 - var btnLoad = new MostRightEmptyView(); + var btnLoad = rowLayout.frameTable.AddMostRightEmptyIcon(81, 81); + rowLayout.frameTable.ChangedChidrenBindMode(btnLoad, ChidrenBindMode.NotBind); //鍚敤鐐逛寒鍔熻兘 btnLoad.UseClickStatu = true; btnLoad.UnSelectedImagePath = "Item/DownLoad.png"; btnLoad.SelectedImagePath = "Item/DownLoadSelected.png"; - rowLayout.AddChidren(btnLoad, ChidrenBindMode.NotBind); - //涓嬭浇鍥炬爣澶彸杈逛笉濂界湅 - btnLoad.X -= Application.GetRealWidth(50); - btnLoad.MouseUpEventHandler += (sender, e) => + btnLoad.ButtonClickEvent += (sender, e) => { //鏄惁瑕佷笅杞藉苟鎭㈠鏁版嵁锛� string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg); - this.ShowConfirmMsg(msg, "LoadBackupInfo", fileInfo.Id); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //璇诲彇澶囦唤鏂囨。 + this.LoadBackupInfo(fileInfo.Id); + }); }; //鍒犻櫎 - var btnDelete = new RowDeleteButton(); + var btnDelete = new NormalViewControl(Application.GetRealWidth(177), rowLayout.Height, false); + btnDelete.BackgroundColor = UserCenterColor.Current.RowDeleteButtonColor; + btnDelete.TextAlignment = TextAlignment.Center; + btnDelete.TextColor = UserCenterColor.Current.White; + btnDelete.TextID = R.MyInternationalizationString.uDelete; rowLayout.AddRightView(btnDelete); - btnDelete.MouseUpEventHandler += (sender, e) => + btnDelete.ButtonClickEvent += (sender, e) => { //纭畾瑕佸垹闄ゆ枃浠跺悧锛� string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteFileMsg); - this.ShowConfirmMsg(msg, "DeleteBackInfo", fileInfo.Id, ShowErrorMode.YES); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //鍒犻櫎澶囦唤鏂囨。 + this.DeleteBackInfo(fileInfo.Id, ShowErrorMode.YES); + }); }; } @@ -163,9 +180,9 @@ /// 璇诲彇澶囦唤鏂囨。 /// </summary> /// <param name="BackupClassId"></param> - public void LoadBackupInfo(string BackupClassId) + private void LoadBackupInfo(string BackupClassId) { - new System.Threading.Thread(async () => + HdlThreadLogic.Current.RunThread(async () => { //浠庝簯绔幏鍙栧浠界殑鏂囦欢 bool result = await HdlBackupLogic.Current.LoadAppBackupInfo(BackupClassId); @@ -173,13 +190,13 @@ { //鏂囦欢鎭㈠澶辫触 string msg2 = Language.StringByID(R.MyInternationalizationString.uFileRecoverFail); - this.ShowNormalMsg(msg2); + this.ShowMassage(ShowMsgType.Error, msg2); return; } - + Application.RunOnMainThread(() => - { - //鍏抽棴鎵�鏈夌晫闈� + { + //鍏抽棴鎵�鏈夌晫闈� UserCenterLogic.CloseAllOpenForm(); //鍒囨崲鍒颁富椤� UserView.UserPage.Instance.Fresh(); @@ -187,22 +204,8 @@ //鏂囦欢鎭㈠鎴愬姛 string msg = Language.StringByID(R.MyInternationalizationString.uFileRecoverSuccess); - this.ShowNormalMsg(msg); - }) - { IsBackground = true }.Start(); - } - - /// <summary> - /// 璇诲彇澶囦唤鐨勬枃妗g殑杩涘害 - /// </summary> - /// <param name="nowValue"></param> - /// <param name="count"></param> - private void LoadBackupInfoProgress(decimal nowValue, decimal count) - { - //璁剧疆鏈�澶у�� - this.SetProgressMax(count); - //鏄剧ず鐧惧垎姣� - this.SetProgressValue(nowValue); + this.ShowMassage(ShowMsgType.Normal, msg); + }); } #endregion @@ -215,7 +218,7 @@ /// <param name="backName"></param> private void UpLoadBackInfo(string backName) { - new System.Threading.Thread(async () => + HdlThreadLogic.Current.RunThread(async () => { //鍒涘缓涓�涓浠藉悕瀛� string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backName); @@ -223,7 +226,7 @@ { //鍒涘缓澶囦唤鍚嶅瓧澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uCreatBackupNameFail); - this.ShowErrorMsg(msg); + this.ShowMassage(ShowMsgType.Error, msg); return; } @@ -234,7 +237,7 @@ { //鏂囦欢涓婁紶澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail); - this.ShowErrorMsg(msg); + this.ShowMassage(ShowMsgType.Error, msg); //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎 this.DeleteBackInfo(backupClassId, ShowErrorMode.NO); @@ -242,14 +245,12 @@ return; } - new System.Threading.Thread(() => + HdlThreadLogic.Current.RunThread(() => { //浠庝簯绔幏鍙栨暟鎹� this.SetBackupInfoToForm(); - }) - { IsBackground = true }.Start(); - }) - { IsBackground = true }.Start(); + }); + }); } #endregion @@ -269,24 +270,25 @@ var Pra = new EditorBackUpNamePra(); Pra.BackupClassId = BackupClassId; Pra.BackupName = backName; + //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken + Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", Pra); + bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra); if (result == false) { //缂栬緫澶囦唤鍚嶇О澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uEditorBackupNameFail); - this.ShowErrorMsg(msg); + this.ShowMassage(ShowMsgType.Error, msg); //鍏抽棴 this.CloseProgressBar(); return; } - new System.Threading.Thread(() => + HdlThreadLogic.Current.RunThread(() => { //浠庝簯绔幏鍙栨暟鎹� this.SetBackupInfoToForm(); - }) - { IsBackground = true }.Start(); + }); } #endregion @@ -314,17 +316,16 @@ { //鍒犻櫎澶囦唤澶辫触 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBackupFail); - this.ShowErrorMsg(msg); + this.ShowMassage(ShowMsgType.Error, msg); } return; } - new System.Threading.Thread(() => + HdlThreadLogic.Current.RunThread(() => { //浠庝簯绔幏鍙栨暟鎹� this.SetBackupInfoToForm(); - }) - { IsBackground = true }.Start(); + }); } #endregion @@ -345,14 +346,13 @@ dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup)); //璇疯緭鍏ュ娉ㄥ悕绉� dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup)); - dialogForm.InputText = fileInfo.BackupName; + dialogForm.Text = fileInfo.BackupName; //鎸変笅纭鎸夐挳 - dialogForm.ComfirmClickEvent += (() => + dialogForm.ComfirmClickEvent += ((textValue) => { - string txtvalue = dialogForm.InputText; //妫�娴嬪鑰冨悕绉� - if (this.CheckBackupName(txtvalue) == false) + if (this.CheckBackupName(textValue) == false) { return; } @@ -361,10 +361,10 @@ dialogForm.CloseDialog(); //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊 - if (txtvalue != fileInfo.BackupName) + if (textValue != fileInfo.BackupName) { //缂栬緫澶囦唤鍚嶇О - this.EditorBackInfo(fileInfo.Id, txtvalue); + this.EditorBackInfo(fileInfo.Id, textValue); } }); } @@ -384,11 +384,10 @@ dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup)); //鎸変笅纭鎸夐挳 - dialogForm.ComfirmClickEvent += (() => + dialogForm.ComfirmClickEvent += ((textValue) => { - string txtvalue = dialogForm.InputText; //妫�娴嬪鑰冨悕绉� - if (this.CheckBackupName(txtvalue) == false) + if (this.CheckBackupName(textValue) == false) { return; } @@ -397,7 +396,7 @@ dialogForm.CloseDialog(); //涓婁紶澶囦唤 - this.UpLoadBackInfo(txtvalue); + this.UpLoadBackInfo(textValue); }); } @@ -438,9 +437,21 @@ { //璇疯緭鍏ュ娉ㄥ悕绉� string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup); - this.ShowErrorMsg(msg); + this.ShowMassage(ShowMsgType.Error, msg); return false; } + if (backName.Contains("##") == true) + { + //瀛樺湪闈炴硶瀛楃銆�##銆� + string msg = Language.StringByID(R.MyInternationalizationString.uErrorFieldIsEsixt); + if (msg.Contains("{0}") == true) + { + msg = string.Format(msg, "##"); + } + this.ShowMassage(ShowMsgType.Error, msg); + return false; + } + return true; } #endregion -- Gitblit v1.8.0