From 38ca58ae790dc71e50070b54345455988a4a64a3 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 27 八月 2021 11:24:52 +0800
Subject: [PATCH] 2021-8-27-01
---
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 159 ++++++++++++++++++++++++-----------------------------
1 files changed, 72 insertions(+), 87 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 3958f65..c770e5a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -12,26 +12,12 @@
}
public void Show(Control control, bool bool_library)
{
- //鏁版嵁杞崲
- Entity.Function function = new Entity.Function();
- {
- function.sid = control.sid;
- function.deviceId = control.deviceId;
- function.name = control.name;
- function.spk = control.spk;
- //function.attributes.AddRange(control.status);
- //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛�
- if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
- {
- Pir.currPir.FunctioList.Add(function);
- }
- }
#region 鐣岄潰甯冨眬
this.BackgroundColor = CSS.CSS_Color.viewMiddle;
PirDevice.View.TopView topView = new View.TopView();
topView.topNameBtn.TextID = StringId.tianjiayaokongqi;
this.AddChidren(topView.FLayoutView());
- topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
+ topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); };
FrameLayout fLayout = new FrameLayout
{
@@ -41,7 +27,7 @@
Width = Application.GetRealWidth(375),
};
this.AddChidren(fLayout);
- //
+ //鎴愬姛鍥炬爣
Button iconBtn = new Button
{
Y = Application.GetRealHeight(28),
@@ -65,7 +51,7 @@
TextAlignment = TextAlignment.Center,
};
fLayout.AddChidren(text1Btn);
- //鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤
+ //鍙埌鍒嗙被-鍔熻兘-鎿嶄綔浣跨敤
Button text2Btn = new Button
{
Width = Application.GetRealWidth(375 - 32),
@@ -90,71 +76,13 @@
this.AddChidren(namePatchView.FLayoutView());
namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
namePatchView.btnText2.Text = control.name;
- namePatchView.btnClick.MouseUpEventHandler += (sender,e) => {
- List<string> list = new List<string>();
-
- for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
- {
- list.Add(Pir.currPir.FunctioList[i].name);
- }
- Method method = new Method();
- method.EditControlName(StringId.editName, list, control.name, (name, view) =>
- {
- //鍔犺浇log
- Loading loading = new Loading();
- view.AddChidren(loading);
- HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
- loading.Start();
- new System.Threading.Thread(() =>
- {
- try
- {
- responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
- }
- catch { }
- finally
- {
- Application.RunOnMainThread(() =>
- {
- loading.Hide();
- if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
- {
- view.Close();
- namePatchView.btnText2.Text = name;
- function.name = name;
- }
- else
- {
- Method methodError = new Method();
- methodError.ErrorShow(responsePackNew);
- }
-
- });
- }
-
- })
- { IsBackground = true }.Start();
-
-
- }, () => { });
- };
//鎵�灞炲尯鍩�
View.PatchView quyuPatchView = new View.PatchView();
quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
this.AddChidren(quyuPatchView.FLayoutView());
quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
- quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
- quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
- {
- Method method = new Method();
- method.ManagementPosition(function, () =>
- {
- //鏇存柊鍖哄煙
- quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
- });
- };
-
+ quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId));
//缁х画娣诲姞
Button addBtn = new Button
@@ -176,20 +104,55 @@
#endregion
#region 鐣岄潰鐐瑰嚮浜嬩欢
//閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
- namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
+ namePatchView.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+
+ List<string> list = new List<string>();
+ for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
+ {
+ //娣诲姞鎵�鏈夐仴鎺у悕绉板垪琛�
+ list.Add(Pir.currPir.FunctioList[i].name);
+ }
+ PirMethod method = new PirMethod();
+ method.EditControlName(StringId.editName, list, control.name, (name, dialog) =>
+ {
+ //鍙戦�佹洿鏂板悕绉板懡浠�
+ PirMethod.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
+ {
+ //鍏抽棴绐楀彛
+ dialog.Close();
+ //鏇存柊澶囨敞
+ namePatchView.btnText2.Text = name;
+ //鏇存柊涓存椂璁惧鍚嶇О
+ control.name = name;
+ //鏇存崲鍐呭瓨璁惧鍚嶇О
+ GetFunction(control.deviceId).name = name;
+ }, "淇敼鍚嶇О", "dialog", null, dialog);
+ }, () => { });
+ };
//鎵�灞炲尯鍩熺偣鍑讳簨浠�
- quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
+ quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ PirMethod method = new PirMethod();
+ method.ManagementPosition(GetFunction(control.deviceId), () =>
+ {
+ //鏇存柊鍖哄煙
+ quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.CurrLogicMethod.GetGetRoomName(GetFunction(control.deviceId));
+ });
+ };
//缁х画娣诲姞鐐瑰嚮浜嬩欢
addBtn.MouseUpEventHandler += (sender, e) =>
{
if (bool_library)
- {
+ {//缁х画娣诲姞搴撶殑閬ユ帶鍣�
+ PirMethod.RefreshView("PirMain");//鍒锋柊鎸囩偣鐣岄潰
this.RemoveFromParent();
}
else
- {
- Method method = new Method();
- method.AddControl(this, (controlDevice) => {
+ {//缁х画娣诲姞鑷畾涔夌殑閬ユ帶鍣�
+ PirMethod method = new PirMethod();
+ method.AddControl(this, (controlDevice) =>
+ {
AddButton addButton = new AddButton();
MainPage.BasePageView.AddChidren(addButton);
addButton.Show(controlDevice);
@@ -200,14 +163,36 @@
//瀹屾垚鐐瑰嚮浜嬩欢
saveView.btnClick.MouseUpEventHandler += (sender, e) =>
{
- //鍓嶉潰鐣岄潰
- // this.RemoveFromParent();
+ //鍒锋柊鎸囩偣鐣岄潰
+ PirMethod.RefreshView("PirMain");
+ //绉婚櫎鎵�鏈夌晫闈�
MainPage.BasePageView.RemoveViewByTag("PirView");
- //涓荤晫闈�
- MainPage.BasePageView.RemoveViewByTag("PirMain");
-
};
#endregion
}
+ /// <summary>
+ /// 鏌ユ壘璁惧瀵硅薄
+ /// </summary>
+ /// <param name="deviceId">璁惧ID</param>
+ /// <returns></returns>
+ public Entity.Function GetFunction(string deviceId)
+ {
+ var fun = Pir.currPir.FunctioList.Find((c) => c.deviceId == deviceId);
+ if (fun != null)
+ {
+ return fun;
+ }
+ return new Entity.Function();
+ }
+
+ /// <summary>
+ /// 绉婚櫎鐣岄潰
+ /// </summary>
+ public override void RemoveFromParent()
+ {
+ //鍒锋柊鎸囧畾鐣岄潰
+ PirMethod.RefreshView("PirMain");
+ base.RemoveFromParent();
+ }
}
}
--
Gitblit v1.8.0