From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs | 164 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 128 insertions(+), 36 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs
index 39efc60..9ab29f4 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs
@@ -20,6 +20,9 @@
#region 鈼� 鍙橀噺鐢虫槑__________________________
ZigBee.Device.DoorLock doorLock;
+ public Action<string> devicNameAction;
+ bool IsModifyName = true;
+ string modifyDeviceName = "";
#endregion
/// <summary>
@@ -52,35 +55,33 @@
BackgroundImagePath = "DoorLock/DoorlockPicture.png",
};
this.midFrameLayout.AddChidren(MidTopFrameLayout);
+
+ var btnDeviceText = new Button()
+ {
+ Y = Application.GetRealHeight(288),
+ Height = Application.GetRealHeight(60),
+ Gravity = Gravity.CenterHorizontal,
+ TextColor = ZigbeeColor.Current.XMBlack,
+ TextSize = 15,
+ Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock),
+ };
+ this.midFrameLayout.AddChidren(btnDeviceText);
+
BottomFrameLayout();
}
public void BottomFrameLayout()
{
- #region UI
+ #region UI
var bottomFrameLayout = new FrameLayout()
- {
- Height = Application.GetRealHeight(100),
- Y = Application.GetRealHeight(418),
- Radius = 17,
- BackgroundColor = ZigbeeColor.Current.XMWhite,
- };
- this.midFrameLayout.AddChidren(bottomFrameLayout);
-
- var bottomFrameLayout1 = new FrameLayout()
- {
- Height = Application.GetRealHeight(1319 - 50),
- Y = Application.GetRealHeight(418 + 48),
- BackgroundColor = ZigbeeColor.Current.XMWhite,
- };
- this.midFrameLayout.AddChidren(bottomFrameLayout1);
-
- var bottomFrameLayout2 = new FrameLayout()
{
Height = Application.GetRealHeight(1319),
Y = Application.GetRealHeight(418),
+ BackgroundColor = ZigbeeColor.Current.XMWhite,
};
- this.midFrameLayout.AddChidren(bottomFrameLayout2);
+ this.midFrameLayout.AddChidren(bottomFrameLayout);
+ bottomFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+
var informationEdit = new Button()
{
@@ -92,7 +93,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextSize = 15,
};
- bottomFrameLayout2.AddChidren(informationEdit);
+ bottomFrameLayout.AddChidren(informationEdit);
for (int i = 0; i < 4; i++)
{
@@ -100,7 +101,7 @@
{
Height = Application.GetRealHeight(58),
};
- bottomFrameLayout2.AddChidren(bottomRowLayout);
+ bottomFrameLayout.AddChidren(bottomRowLayout);
var btnName = new Button()
{
@@ -137,17 +138,59 @@
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
Visible = false,
};
- bottomFrameLayout2.AddChidren(btnLine);
+ bottomFrameLayout.AddChidren(btnLine);
if (i == 0)
{
bottomRowLayout.Y = Application.GetRealHeight(220);
btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm) + ":";
- btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
- btnNextFrameLayout.X = Application.GetRealWidth(233);
- btnNext.TextAlignment = TextAlignment.CenterLeft;
- btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
- btnNext.Text = doorLock.DeviceName;
+ btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58 - 20);
+ btnNextFrameLayout.X = Application.GetRealWidth(233 + 20);
+ var btnDeviceNameEditText = new EditText()
+ {
+ X = Application.GetRealWidth(46),
+ Width = Application.GetRealWidth(731),
+ Height = Application.GetRealHeight(58),
+ TextColor = ZigbeeColor.Current.XMGray3,
+ TextSize = 14,
+ PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = string.IsNullOrEmpty(doorLock.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : doorLock.DeviceName,
+ };
+ btnNextFrameLayout.AddChidren(btnDeviceNameEditText);
+
+ btnDeviceNameEditText.TextChangeEventHandler += (sender, e) =>
+ {
+ modifyDeviceName = btnDeviceNameEditText.Text;
+ };
+ Action<Shared.View> actionEdit = async (obj) =>
+ {
+ try
+ {
+ Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+ var doorLockDeviceList = new List<CommonDevice> { };
+ doorLockDeviceList.Add(doorLock);
+ var result = await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, btnDeviceNameEditText.Text);
+ if (result)
+ {
+ IsModifyName = false;
+ }
+ else
+ {
+ IsModifyName = true;
+ }
+ }
+ catch { }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ });
+ }
+ };
+ btnDeviceNameEditText.EditorEnterAction += actionEdit;
+
btnLine.Visible = true;
btnLine.Y = Application.GetRealHeight(303);
}
@@ -175,14 +218,13 @@
{
bottomRowLayout.Y = Application.GetRealHeight(481);
btnName.Text = Language.StringByID(R.MyInternationalizationString.BelongModel) + ":";
- btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
- btnNextFrameLayout.X = Application.GetRealWidth(233);
-
+ btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58 - 20);
+ btnNextFrameLayout.X = Application.GetRealWidth(253);
btnNext.TextAlignment = TextAlignment.CenterLeft;
btnNext.Height = Application.GetRealHeight(58);
btnNext.Text = doorLock.DeviceName;
btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
-
+ btnNext.TextSize = 14;
btnLine.Visible = true;
btnLine.Y = Application.GetRealHeight(575);
}
@@ -197,7 +239,7 @@
btnNext.SelectedImagePath = "DoorLock/SwitchOn.png";
btnLine.Visible = true;
btnLine.Y = Application.GetRealHeight(714);
- if (doorLock.RemoteUnlockPassword == "")
+ if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword))
{
btnNext.IsSelected = false;
}
@@ -221,7 +263,7 @@
btnNext.IsSelected = !btnNext.IsSelected;
if (btnNext.IsSelected)
{
- if (doorLock.RemoteUnlockPassword == "")
+ if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword))
{
RemotePasswordDialog(doorLock, btnNext);
}
@@ -242,12 +284,62 @@
}
}
};
- bottomRowLayout.MouseDownEventHandler += eHandler;
btnNext.MouseDownEventHandler += eHandler;
- btnName.MouseDownEventHandler += eHandler;
- btnNextFrameLayout.MouseDownEventHandler += eHandler;
+ if (i != 3)
+ {
+ bottomRowLayout.MouseDownEventHandler += eHandler;
+ btnName.MouseDownEventHandler += eHandler;
+ btnNextFrameLayout.MouseDownEventHandler += eHandler;
+ }
#endregion
}
+
+ //淇濆瓨
+ var btnFinifh = new Button()
+ {
+ Width = Application.GetRealWidth(907),
+ Height = Application.GetRealHeight(127),
+ Y = Application.GetRealHeight(1472),
+ Gravity = Gravity.CenterHorizontal,
+ Radius = (uint)Application.GetRealHeight(127) / 2,
+ TextID = R.MyInternationalizationString.Save,
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+ TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
+ TextSize = 16,
+ IsBold = true,
+ };
+ this.midFrameLayout.AddChidren(btnFinifh);
+ btnFinifh.MouseUpEventHandler += (sender, e) =>
+ {
+ System.Threading.Tasks.Task.Run(async () =>
+ {
+ Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+ try
+ {
+ if (IsModifyName)
+ {
+ var doorLockDeviceList = new List<CommonDevice> { };
+ doorLockDeviceList.Add(doorLock);
+ var result = await Common.LocalDevice.Current.ReMacName(doorLockDeviceList, modifyDeviceName);
+ if (result)
+ {
+ if (devicNameAction != null)
+ {
+ devicNameAction(modifyDeviceName);
+ }
+ }
+ }
+ }
+ catch { }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ });
+ }
+ });
+ };
}
#region 鈼� 鎺ュ彛瀹炵幇__________________________
--
Gitblit v1.8.0