From 34e965100d635346e2d4cd6e6013bdaed66b3004 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 02 一月 2020 19:52:13 +0800
Subject: [PATCH] 2019.1.2-3
---
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs | 385 +++++++++++++++++++++++-------------------------------
1 files changed, 165 insertions(+), 220 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
index c78f4f1..0f80521 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -28,7 +28,6 @@
Application.RunOnMainThread(() =>
{
-
});
}
}
@@ -47,7 +46,7 @@
#region 鈼� 鍙橀噺鐢虫槑__________________________
ZigBee.Device.DoorLock doorLock;//褰撳墠闂ㄩ攣
- VerticalRefreshLayout bodyView;//鍒锋柊View
+ VerticalListRefreshControl bodyView;//鍒锋柊View
Button currentMethod;// 褰撳墠閫夋嫨鐨勬柟寮�
Shared.Phone.UserCenter.MemberInfoRes curAccountObj;//褰撳墠璐︽埛
Button entryStatusPic;
@@ -84,6 +83,7 @@
// 绫诲瀷鍖哄垎
TypeRefresh();
CommonPage.Loading.Hide();
+ bodyView.EndHeaderRefreshing();
});
}
});
@@ -176,8 +176,9 @@
Y = Application.GetRealHeight(35),
X = Application.GetRealWidth(812 - 100),
TextAlignment = TextAlignment.CenterRight,
- TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
+ TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
TextSize = 12,
+ IsBold = true,
};
midTopFrameLayout.AddChidren(btnAllMethod);
// 绫诲瀷鍖哄垎
@@ -226,7 +227,7 @@
this.midFrameLayout.AddChidren(btnLine);
#endregion
- bodyView = new VerticalRefreshLayout()
+ bodyView = new VerticalListRefreshControl(29)
{
Y = btnLine.Bottom,
Height = Application.GetRealHeight(1921 - 184 - 116),
@@ -236,7 +237,6 @@
{
bodyView.BeginHeaderRefreshing();
ReadDoorLockUserInfo();
- bodyView.EndHeaderRefreshing();
};
BlankPicUI();
}
@@ -270,18 +270,19 @@
Gravity = Gravity.CenterHorizontal,
Visible = false,
Y = Application.GetRealHeight(844),
+ TextSize = 12,
};
blankFrameLayout.AddChidren(btnPicTip);
btnPicTip1 = new Button
{
X = Application.GetRealWidth(397),
- Y = btnPicTip.Bottom,
+ Y = Application.GetRealHeight(844 + 49),
Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation1),
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
Gravity = Gravity.CenterHorizontal,
- Visible = false,
- BackgroundColor = 0xff00ff00,
+ Visible = true,
+ TextSize = 12,
};
blankFrameLayout.AddChidren(btnPicTip1);
}
@@ -334,12 +335,6 @@
btnPicTip.Height = Application.GetRealHeight(0);
btnPicTip1.Height = Application.GetRealHeight(0);
blankFrameLayout.Height = Application.GetRealHeight(0);
- var frameLayoutRow = new FrameLayout()
- {
- Height = Application.GetMinRealAverage(0),
- BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
- };
- bodyView.AddChidren(frameLayoutRow);
int i = 0;
foreach (var curUserId in curAccountDoorLockUserList.Keys)
@@ -370,69 +365,165 @@
}
#region UI
- var rowFrameLayout = new RowLayout()
- {
- Height = Application.GetRealHeight(127 + 23),
- X = Application.GetRealWidth(58),
- Y = i * Application.GetRealHeight(150),
- Width = Application.GetRealWidth(965),
- LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
- BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
- };
- frameLayoutRow.AddChidren(rowFrameLayout);
- var btnPicFrameLayout = new FrameLayout()
+ var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2);
+ rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite;
+ bodyView.AddChidren(rowFrameLayout);
+ rowFrameLayout.frameTable.UseClickStatu = false;
+ var btnicon = rowFrameLayout.frameTable.AddLeftIcon();
+ btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png";
+ //涓婇潰闂ㄩ攣鐢ㄦ埛鍚嶇О涓�琛�
+ var memberText = "";
+ if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
{
- Width = Application.GetRealWidth(81),
- Height = Application.GetRealHeight(81),
- X = Application.GetRealWidth(40),
- Y = Application.GetRealHeight(49),
- };
- rowFrameLayout.AddChidren(btnPicFrameLayout);
-
- var btnPic = new Button()
+ memberText = curAccountObj.Account;
+ }
+ else
{
- Width = Application.GetRealWidth(84),
- Height = Application.GetRealHeight(84),
- UnSelectedImagePath = "DoorLock/DoorLockUserPic.png",
- };
- btnPicFrameLayout.AddChidren(btnPic);
-
+ memberText = curAccountObj.UserName;
+ }
+ //鎴愬憳涓�琛�
+ var btnaa = rowFrameLayout.frameTable.AddBottomView(memberText, 800);
var btnDoorlockUser = new EditText()
{
- Width = Application.GetRealWidth(1080 - 173),
+ Width = Application.GetRealWidth(800),
Height = Application.GetRealHeight(60),
- X = Application.GetRealWidth(173),
- Y = Application.GetRealHeight(35),
+ X = btnaa.X,
+ Y = rowFrameLayout.chidrenYaxis + Application.GetRealHeight(12),
TextSize = 14,
PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
TextAlignment = TextAlignment.CenterLeft,
};
- rowFrameLayout.AddChidren(btnDoorlockUser);
-
- var btnMember = new Button()
+ rowFrameLayout.frameTable.AddChidren(btnDoorlockUser, ChidrenBindMode.NotBind);
+ rowFrameLayout.frameTable.AddBottomLine();
+ var btndelete = rowFrameLayout.AddDeleteControl();
+ btndelete.ButtonClickEvent += (sender, e) =>
{
- Width = Application.GetRealWidth(1080 - 173),
- Height = Application.GetRealHeight(49),
- X = Application.GetRealWidth(173),
- Y = Application.GetRealHeight(95),
- TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
- TextSize = 14,
- TextAlignment = TextAlignment.CenterLeft,
+ string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
+ var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm));
+ alert.Show();
+ //浣跨敤纭鍨嬪脊妗嗘椂,鐨勫洖璋冨嚱鏁�
+ alert.ConfirmClickEvent += async () =>
+ {
+ try
+ {
+ CommonPage.Loading.Start("");
+ var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
+ var resultData = await doorLock.DefaultControlAsync(passData);
+ if (resultData != null && resultData.defaultControlResponseData != null)
+ {
+ if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2)
+ {
+ var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+ if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+ {
+ deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ deleteDoorLockData.IsOtherAccountCtrl = true;
+ }
+ if (doorLock.DeviceAddr != null)
+ {
+ deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+ }
+ deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+ deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
+ deleteDoorLockData.DelDoorLockDelType = 2;
+ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
+ if (result != null)
+ {
+ if (result.StateCode == "Success")
+ {
+ isSecondDel = false;
+ if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+ {
+ doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount);
+ var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+ localDoorLockObj.UserID = curDoorLockUser.UserID;
+ doorLock.localDoorLockUserList.Remove(curUserId);
+ doorLock.ReSave();
+ TypeRefresh();
+ }
+ }
+ else
+ {
+ //寮�鍏冲浘鏍�
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ }
+ else
+ {
+ isSecondDel = true;
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ }
+ else
+ {
+ if (isSecondDel)
+ {
+ var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+ if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+ {
+ deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ deleteDoorLockData.IsOtherAccountCtrl = true;
+ }
+ if (doorLock.DeviceAddr != null)
+ {
+ deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+ }
+ deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+ deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
+ deleteDoorLockData.DelDoorLockDelType = 2;
+ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
+ if (result != null)
+ {
+ if (result.StateCode == "Success")
+ {
+ isSecondDel = false;
+ if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+ {
+ doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
+ var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+ localDoorLockObj.UserID = curDoorLockUser.UserID;
+ doorLock.localDoorLockUserList.Remove(curUserId);
+ TypeRefresh();
+ }
+ }
+ else
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ }
+ else
+ {
+ isSecondDel = true;
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ }
+ else
+ {
+ if (curDoorLockUser.UserID < 10)
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ else
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+ }
+ }
+ }
+ }
+ else
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(CommonPage.Instance);
+ }
+ }
+ catch { }
+ finally
+ {
+ CommonPage.Loading.Hide();
+ }
+ };
};
- rowFrameLayout.AddChidren(btnMember);
-
- var btnDel = new Button()
- {
- Width = Application.GetRealWidth(184),
- Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice),
- TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
- TextSize = 12,
- TextAlignment = TextAlignment.Center,
- BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel,
- };
- rowFrameLayout.AddRightView(btnDel);
#endregion
#region 鏁版嵁澶勭悊
@@ -476,14 +567,6 @@
break;
}
- if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
- {
- btnMember.Text = curAccountObj.Account;
- }
- else
- {
- btnMember.Text = curAccountObj.UserName;
- }
Action<Shared.View> action = async (obj) =>
{
@@ -529,154 +612,10 @@
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
}
};
- btnDoorlockUser.EditorEnterAction += action;
-
- btnDel.MouseUpEventHandler += (sender, e) =>
- {
- var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod),
- Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
- alert.Show();
- alert.ResultEventHandler += async (sender1, e1) =>
- {
- if (e1)
- {
- try
- {
- CommonPage.Loading.Start("");
- var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
- var resultData = await doorLock.DefaultControlAsync(passData);
- if (resultData != null && resultData.defaultControlResponseData != null)
- {
- if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2)
- {
- var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
- if (UserCenterResourse.UserInfo.AuthorityNo != 1)
- {
- deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
- deleteDoorLockData.IsOtherAccountCtrl = true;
- }
- if (doorLock.DeviceAddr != null)
- {
- deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
- }
- deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
- deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
- deleteDoorLockData.DelDoorLockDelType = 2;
- var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
- if (result != null)
- {
- if (result.StateCode == "Success")
- {
- isSecondDel = false;
- if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
- {
- doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount);
- var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
- localDoorLockObj.UserID = curDoorLockUser.UserID;
- doorLock.localDoorLockUserList.Remove(curUserId);
- doorLock.ReSave();
- TypeRefresh();
- }
- }
- else
- {
- //寮�鍏冲浘鏍�
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- }
- else
- {
- isSecondDel = true;
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- }
- else
- {
- if (isSecondDel)
- {
- var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
- if (UserCenterResourse.UserInfo.AuthorityNo != 1)
- {
- deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
- deleteDoorLockData.IsOtherAccountCtrl = true;
- }
- if (doorLock.DeviceAddr != null)
- {
- deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
- }
- deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
- deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
- deleteDoorLockData.DelDoorLockDelType = 2;
- var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
- if (result != null)
- {
- if (result.StateCode == "Success")
- {
- isSecondDel = false;
- if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
- {
- doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
- var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
- localDoorLockObj.UserID = curDoorLockUser.UserID;
- doorLock.localDoorLockUserList.Remove(curUserId);
- TypeRefresh();
- }
- }
- else
- {
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- }
- else
- {
- isSecondDel = true;
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- }
- else
- {
- if (curDoorLockUser.UserID < 10)
- {
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- else
- {
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
- }
- }
- }
- }
- else
- {
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
- }
- }
- catch { }
- finally
- {
- CommonPage.Loading.Hide();
- }
- }
- };
- };
+ btnDoorlockUser.EditorEnterAction += action;
#endregion
i++;
- }
-
- //閬尅RowLayout澶氫綑鐨勭嚎鏉�
- for (int j = 0; j < curAccountDoorLockUserList.Keys.Count; j++)
- {
- var frameLayoutRowLineHide = new FrameLayout()
- {
- Height = 10,
- Width = Application.GetRealWidth(173),
- X = Application.GetRealWidth(58),
- Y = (j + 1) * Application.GetRealHeight(145),
- BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
- };
- frameLayoutRow.AddChidren(frameLayoutRowLineHide);
- }
- frameLayoutRow.Height = i * Application.GetRealHeight(150);
+ }
}
}
@@ -727,7 +666,7 @@
{
Width = Application.GetRealWidth(81),
Height = Application.GetRealHeight(81),
- Y = Application.GetRealHeight(55),
+ Y = Application.GetRealHeight(35),
};
rowFrameLayout.AddChidren(btnAllMethod);
@@ -736,7 +675,7 @@
Width = Application.GetRealWidth(311),
Height = Application.GetRealHeight(58),
X = Application.GetRealWidth(92),
- Y = Application.GetRealHeight(69),
+ Y = Application.GetRealHeight(49),
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
TextSize = 14,
TextAlignment = TextAlignment.CenterLeft,
@@ -761,6 +700,7 @@
doorLock.ReSave();
btnAllMethod.IsSelected = true;
oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ oldbuttonText.IsBold = true;
TypeRefresh();
}
dialog.Close();
@@ -797,6 +737,7 @@
{
btnAllMethod.IsSelected = true;
btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ btnMethodText.IsBold = true;
oldbutton = btnAllMethod;
oldbuttonText = btnMethodText;
}
@@ -804,6 +745,7 @@
{
btnAllMethod.IsSelected = true;
btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ btnMethodText.IsBold = true;
oldbutton = btnAllMethod;
oldbuttonText = btnMethodText;
}
@@ -811,6 +753,7 @@
{
btnAllMethod.IsSelected = true;
btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ btnMethodText.IsBold = true;
oldbutton = btnAllMethod;
oldbuttonText = btnMethodText;
}
@@ -818,6 +761,7 @@
{
btnAllMethod.IsSelected = true;
btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ btnMethodText.IsBold = true;
oldbutton = btnAllMethod;
oldbuttonText = btnMethodText;
}
@@ -825,6 +769,7 @@
{
btnAllMethod.IsSelected = true;
btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ btnMethodText.IsBold = true;
oldbutton = btnAllMethod;
oldbuttonText = btnMethodText;
}
--
Gitblit v1.8.0