From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs | 101 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 96 insertions(+), 5 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSettingSub.cs index fe70ffa..03a5d1a 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> @@ -142,12 +145,54 @@ if (i == 0) { bottomRowLayout.Y = Application.GetRealHeight(220); - btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm) + ":"; + 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; + var btnDeviceNameEditText = new EditText() + { + X = Application.GetRealWidth(46), + Width = Application.GetRealWidth(731), + Height = Application.GetRealHeight(58), + TextColor = ZigbeeColor.Current.XMGray3, + 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); } @@ -233,12 +278,12 @@ } else { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); } } else { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); } } }; @@ -248,6 +293,52 @@ 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, + }; + 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