From bd2c6c39668f2495d14440ae2d6bb7a7856e9d2f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 12 三月 2021 17:47:57 +0800
Subject: [PATCH] 2021-3-12-3
---
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 130 +++++++++++++++++++++++++++++++++++--------
1 files changed, 106 insertions(+), 24 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 9a682fe..3958f65 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -4,13 +4,28 @@
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
- public class AddControlComplete:FrameLayout
+ public class AddControlComplete : FrameLayout
{
public AddControlComplete()
{
- Tag = "Pir";
+ Tag = "PirView";
}
- public void Show() {
+ 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();
@@ -18,16 +33,16 @@
this.AddChidren(topView.FLayoutView());
topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
- FrameLayout fLayout = new FrameLayout
+ FrameLayout fLayout = new FrameLayout
{
- Y =Application.GetRealHeight(64),
+ Y = Application.GetRealHeight(64),
BackgroundColor = CSS.CSS_Color.textWhiteColor,
Height = Application.GetRealHeight(224),
Width = Application.GetRealWidth(375),
};
this.AddChidren(fLayout);
//
- Button iconBtn = new Button
+ Button iconBtn = new Button
{
Y = Application.GetRealHeight(28),
X = Application.GetRealWidth(137),
@@ -40,7 +55,7 @@
//娣诲姞鎴愬姛
Button text1Btn = new Button
{
- Width = Application.GetRealWidth(375-32),
+ Width = Application.GetRealWidth(375 - 32),
Height = Application.GetRealHeight(22),
Y = Application.GetRealHeight(158),
X = Application.GetRealWidth(16),
@@ -65,7 +80,7 @@
fLayout.AddChidren(text2Btn);
//鎵�灞炲垎绫�
View.PatchView fenlei = new View.PatchView();
- fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8);
+ fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8);
this.AddChidren(fenlei.FLayoutView(false));
fenlei.btnText1.TextID = StringId.suoshufenlei;
fenlei.btnText2.TextID = StringId.dianqi;
@@ -74,20 +89,79 @@
namePatchView.frameLayout.Y = fenlei.frameLayout.Bottom;
this.AddChidren(namePatchView.FLayoutView());
namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
- namePatchView.btnText2.TextID = StringId.dianqi;
+ 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.TextID = StringId.dianqi;
+ 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);
+ });
+ };
+
//缁х画娣诲姞
Button addBtn = new Button
{
Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125),
X = Application.GetRealWidth(16),
- Width = Application.GetRealWidth(375-32),
+ Width = Application.GetRealWidth(375 - 32),
Height = Application.GetRealHeight(20),
TextID = StringId.jixutianjia,
TextSize = TextSize.text14,
@@ -102,28 +176,36 @@
#endregion
#region 鐣岄潰鐐瑰嚮浜嬩欢
//閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
- namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { };
+ namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
//鎵�灞炲尯鍩熺偣鍑讳簨浠�
quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
//缁х画娣诲姞鐐瑰嚮浜嬩欢
- addBtn.MouseUpEventHandler += (sender, e) => {
- View.TipView tipView = new View.TipView();
- tipView.InputBox("", (s) =>
+ addBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ if (bool_library)
{
- if (!string.IsNullOrEmpty(s))
- {
-
+ this.RemoveFromParent();
+ }
+ else
+ {
+ Method method = new Method();
+ method.AddControl(this, (controlDevice) => {
AddButton addButton = new AddButton();
MainPage.BasePageView.AddChidren(addButton);
- addButton.Show();
+ addButton.Show(controlDevice);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- });
+ });
+ }
};
//瀹屾垚鐐瑰嚮浜嬩欢
- saveView.btnClick.MouseUpEventHandler += (sender, e) => {
- MainPage.BasePageView.RemoveViewByTag("AddControl");
- MainPage.BasePageView.RemoveViewByTag("Pir");
+ saveView.btnClick.MouseUpEventHandler += (sender, e) =>
+ {
+ //鍓嶉潰鐣岄潰
+ // this.RemoveFromParent();
+ MainPage.BasePageView.RemoveViewByTag("PirView");
+ //涓荤晫闈�
+ MainPage.BasePageView.RemoveViewByTag("PirMain");
+
};
#endregion
}
--
Gitblit v1.8.0