From c400abb7465732b7ca46280cbd126651985c55e0 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 01 十一月 2022 09:08:38 +0800 Subject: [PATCH] 备份 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs | 68 +++++++++++++++++++++++++++++----- 1 files changed, 58 insertions(+), 10 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs index fb2a5fb..0d18f9d 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs @@ -18,8 +18,11 @@ /// </summary> private bool finish = false; +#if DEBUG + private string SeverAddr = "https://test-gz.hdlcontrol.com"; +#else private string SeverAddr = "https://bahrain-gateway.hdlcontrol.com"; - //private string SeverAddr = "https://test-gz.hdlcontrol.com"; +#endif FrameLayout contentView; @@ -35,11 +38,27 @@ Button btnSave; Button btnClose; + Alert sssAlert = new Alert ("", "Please press the PROG button on Gateway for 3 sec.", "Confirm"); + Action tipLockedAction; + + bool showedLockedTip = false; public MigrationServer () { - loading = new Loading (); + loading = new Loading (); + tipLockedAction = () => { + Application.RunOnMainThread (() => { + if (!showedLockedTip) { + sssAlert.Show (); + showedLockedTip = true; + sssAlert.ResultEventHandler += (sd, dd) => { + showedLockedTip = false; + }; + } + }); + }; + Packet.lockedAction = tipLockedAction; } @@ -47,7 +66,7 @@ public void ShowDialog() { - #region 寮圭獥 +#region 寮圭獥 Dialog dialog = new Dialog (); FrameLayout dialogBodyView = new FrameLayout () { @@ -135,6 +154,8 @@ bottomView.AddChidren (btnClose); btnClose.MouseUpEventHandler += (send2er, e2) => { dialog.Close (); + Packet.lockedAction = null; + }; Button btnBottomLine = new Button () { @@ -158,6 +179,7 @@ btnSave.MouseUpEventHandler += (sender2, e2) => { if (finish) { dialog.Close (); + Packet.lockedAction = null; return; } @@ -165,10 +187,10 @@ - var moveAccontResult = Account2New ("12345678"); - var newHomeId = Home2New (); - //杩佺Щ缃戝叧 - var moveGatewayResult = Gateway2New ("4D59383553502243", newHomeId, 0); + //var moveAccontResult = Account2New ("12345678"); + //var newHomeId = Home2New (); + ////杩佺Щ缃戝叧 + //var moveGatewayResult = Gateway2New ("4D59383553502243", newHomeId, 0); #endif if (etPwd.Text.Trim() == "") { @@ -216,6 +238,7 @@ etPwd.Visible = false; btnSave.MouseUpEventHandler = (sender2, e2) => { dialog.Close (); + Packet.lockedAction = null; }; } else { @@ -229,13 +252,13 @@ //3.鎺ユ敹鍗囩骇鏂囦欢鑾峰彇璇锋眰 //杩佺Щ璐﹀彿 - #endregion +#endregion } - #region 浜戠 +#region 浜戠 /// <summary> /// 璐﹀彿鐧诲綍楠岃瘉 /// </summary> @@ -423,6 +446,26 @@ } return ""; } + + /// <summary> + /// 杩佺Щ鏈嶅姟鍣ㄥ叏閮ㄥ浠� + /// </summary> + private void MoveCloudBackup () + { + var dic = new Dictionary<string, object> (); + dic.Add ("oldPlatformToken", MainPage.LoginUser.LoginTokenString);//鏃у钩鍙皌oken + dic.Add ("oldPlatformHomeId", UserConfig.Instance.CurrentRegion.RegionID);//鏃у钩鍙颁綇瀹卛d + dic.Add ("homeId", newUserId);//鏂板钩鍙颁綇瀹卛d + dic.Add ("userId", newUserId);//鏂板钩鍙扮敤鎴穒d + dic.Add ("tenantId", "202106");//绉熸埛id + var requestJson = HttpUtil.GetSignRequestJson (dic); + var revertObj = MainPage.RequestHttps ("/home-wisdom/data/move/backup/all", requestJson, false, false, SeverAddr); + if (revertObj != null) { + if (revertObj.code == "0") { + } + } + } + /// <summary> /// 鑾峰彇瀹氭椂鍣ㄥ垪琛� /// </summary> @@ -506,7 +549,7 @@ - #endregion +#endregion /// <summary> /// 妫�娴嬩竴绔彛淇℃伅 @@ -540,6 +583,9 @@ gateWayString = CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (gatewayFileName)); common = Newtonsoft.Json.JsonConvert.DeserializeObject<GatewayBase> (gateWayString); + //bool + CommonPage.IsRemote = false; + Control.ControlBytesSendHasReturn (Command.ReadGateway, common.SubnetID, common.DeviceID, new byte [] { CommonPage.RandomHigh, CommonPage.RandomLow }); var bytes = Control.ControlBytesSendHasReturn (Command.readGatewayVision, common.SubnetID, common.DeviceID, new byte [] { }); if(bytes == null) { @@ -803,6 +849,8 @@ btnTipMsg.Text = "Migration backup succeeded, migrating Schedule data."; btnTipMsg.TextColor = SkinStyle.Current.TextColor; }); + //杩佺Щ浜戠鍏朵粬澶囦唤 + MoveCloudBackup (); //杩佺Щ瀹氭椂鍣� var timerList = GetTimer (newHomeId); if (timerList == null) { -- Gitblit v1.8.0