From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs | 60 +++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 41 insertions(+), 19 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
index 3d66b86..cf821e1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
@@ -22,6 +22,10 @@
/// </summary>
private string wifiPsw = string.Empty;
/// <summary>
+ /// 鏂拌澶囩殑sid(鐢ㄦ潵鍖归厤鍝竴涓澶囨槸鏂扮殑)
+ /// </summary>
+ private string newDeviceSid = string.Empty;
+ /// <summary>
/// 瓒呮椂绾跨▼鏄惁杩愯
/// </summary>
private bool timeoutThreadActivity = false;
@@ -176,7 +180,7 @@
/// <summary>
/// 鏄剧ず鎴愬姛鐣岄潰
/// </summary>
- private void ShowSuccessView()
+ private void ShowSuccessView(Entity.Function newDevice)
{
//娓呯┖body
this.ClearBodyFrame();
@@ -209,19 +213,29 @@
bodyFrameLayout.AddChidren(btnUse);
btnUse.ButtonClickEvent += (sender, e) =>
{
- //鍏虫帀鐣岄潰
- this.CloseForm();
- HdlFormLogic.Current.CloseFormByFormName("AddThirdPartyDeviceMenuListPage");
- HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () =>
+ if (newDevice == null)
{
- Application.RunOnMainThread(() =>
- {
- var page = new UI2.PersonalCenter.PirDevice.PirMain();
- MainPage.BasePageView.AddChidren(page);
- page.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- });
- });
+ //鍏抽棴鎺夊叏閮ㄧ殑鐣岄潰,搴旇涓嶄細鍙戠敓
+ HdlFormLogic.Current.CloseAllOpenForm();
+ return;
+ }
+ var form = HdlFormLogic.Current.GetFormByName("AddMiniRemoteControlDirection1Page") as AddMiniRemoteControlDirection1Page;
+ if (form.AddDeviceEvent != null)
+ {
+ //浠h〃杩欎釜鏄敱娓╂�婚偅杈硅皟鐢ㄧ殑,鐩存帴鍥炶皟鍑芥暟
+ form.AddDeviceEvent.Invoke(newDevice);
+ //鍏抽棴鎺夎繖涓晫闈�
+ this.CloseForm();
+ //鍐嶆妸AddMiniRemoteControlDirection1Page鐣岄潰鍏充簡
+ HdlFormLogic.Current.CloseFormByFormName("AddMiniRemoteControlDirection1Page");
+ }
+ else
+ {
+ //浠h〃杩欏苟涓嶆槸鐢辨俯鎬荤殑鐣岄潰璋冪敤鐨�,鍒欏叧闂帀鍏ㄩ儴鐨勭晫闈�
+ HdlFormLogic.Current.CloseAllOpenForm();
+ //鐒跺悗鍐嶆妸娓╂�荤殑鐣岄潰new璧锋潵
+ new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { });
+ }
};
}
@@ -311,11 +325,13 @@
//鏁扮粍绫诲瀷
if (linqArry.Count == 0) { return false; }
strSpk = linqArry[0]["spk"].ToString();
+ this.newDeviceSid = linqArry[0]["sid"].ToString();
}
else
{
//闈炴暟缁勭被鍨�
strSpk = json["objects"]["spk"].ToString();
+ this.newDeviceSid = json["objects"]["sid"].ToString();
}
if (strSpk != Entity.SPK.IrModule)
{
@@ -331,7 +347,7 @@
/// 鍒锋柊绾㈠瀹濅俊鎭�
/// </summary>
/// <param name="successEvent">鎴愬姛鐨勫洖璋冧簨浠�</param>
- private void RefreshMiniRemoteControlInfo(Action successEvent)
+ private void RefreshMiniRemoteControlInfo(Action<Entity.Function> successEvent)
{
var pra = new Dictionary<string, object>();
pra.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID);
@@ -357,14 +373,20 @@
continue;
}
var listDevice = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.DevcieApiPack>(result.Data.ToString());
+ Entity.Function newDevice = null;
foreach (var newFunction in listDevice.list)
{
//娣诲姞鍒扮紦瀛樺綋涓�
newFunction.SaveFunctionFile();
Entity.FunctionList.List.IniFunctionList(newFunction.savePath, true);
+ if (newFunction.sid == this.newDeviceSid)
+ {
+ //杩欎釜璁惧鏄柊杩藉姞鐨�
+ newDevice = newFunction;
+ }
}
//璋冪敤鍥炶皟鍑芥暟
- successEvent?.Invoke();
+ successEvent?.Invoke(newDevice);
return;
}
catch
@@ -392,7 +414,7 @@
return;
}
//鍒锋柊绾㈠瀹濅俊鎭�
- this.RefreshMiniRemoteControlInfo(() =>
+ this.RefreshMiniRemoteControlInfo((Entity.Function newDevice) =>
{
//绉婚櫎杩欎釜浜嬩欢
HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page");
@@ -400,14 +422,14 @@
this.timeoutThreadActivity = false;
//娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗�
- this.DoSomethingAfterAddDeviceSuccess();
+ this.DoSomethingAfterAddDeviceSuccess(newDevice);
});
}
/// <summary>
/// 娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗�
/// </summary>
- private void DoSomethingAfterAddDeviceSuccess()
+ private void DoSomethingAfterAddDeviceSuccess(Entity.Function newDevice)
{
HdlThreadLogic.Current.RunThread(() =>
{
@@ -438,7 +460,7 @@
HdlThreadLogic.Current.RunMain(() =>
{
//鏄剧ず鎴愬姛鐣岄潰
- this.ShowSuccessView();
+ this.ShowSuccessView(newDevice);
});
}
}
--
Gitblit v1.8.0