using System;
|
using System.Collections.Generic;
|
using Shared.Common;
|
using Shared.Phone.UserCenter.Device;
|
using ZigBee.Device;
|
namespace Shared.Phone.UserCenter.DoorLock
|
{
|
public class MemberFrozenPage : DoorLockCommonLayout
|
{
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="doorLock"></param>
|
public MemberFrozenPage(ZigBee.Device.DoorLock doorLock, MemberInfoRes accountObj)
|
{
|
this.doorLock = doorLock;
|
this.curAccountObj = accountObj;
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
|
}
|
|
#region 变量申明
|
/// <summary>
|
/// 当前门锁
|
/// </summary>
|
ZigBee.Device.DoorLock doorLock;
|
/// <summary>
|
/// 当前成员对象v
|
/// </summary>
|
MemberInfoRes curAccountObj;
|
/// <summary>
|
/// 刷新View
|
/// </summary>
|
VerticalRefreshLayout bodyView;
|
#endregion
|
|
/// <summary>
|
/// 初始化数据信息
|
/// </summary>
|
void ReadDoorLockUserInfo()
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
try
|
{
|
//☆マーク☆
|
//var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
|
//var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, curAccountObj.SubAccountDistributedMark);
|
//var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, curAccountObj.SubAccountDistributedMark);
|
//var result2 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, curAccountObj?.SubAccountDistributedMark);
|
//if (result2 == true)
|
//{
|
// doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] = true;
|
//}
|
//else
|
//{
|
// doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] = false;
|
//}
|
//var result3 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, curAccountObj.SubAccountDistributedMark);
|
//if (result3 == true)
|
//{
|
// doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark] = true;
|
//}
|
//else
|
//{
|
// doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark] = false;
|
//}
|
}
|
catch { }
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
MidRefresh();
|
bodyView.EndHeaderRefreshing();
|
});
|
}
|
});
|
}
|
|
/// <summary>
|
/// UI显示
|
/// </summary>
|
public void Show()
|
{
|
string accountTitle = curAccountObj.ShowName;
|
this.TopFrameLayout(this, accountTitle);
|
|
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
this.btnBack.MouseUpEventHandler += eHandlerBack;
|
this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
|
this.MidFrameLayout(this);
|
|
bodyView = new VerticalRefreshLayout()
|
{
|
};
|
this.midFrameLayout.AddChidren(bodyView);
|
MidRefresh();
|
|
bodyView.BeginHeaderRefreshingAction += () =>
|
{
|
bodyView.BeginHeaderRefreshing();
|
ReadDoorLockUserInfo();
|
};
|
}
|
/// <summary>
|
/// 中部布局
|
/// </summary>
|
public async void MidRefresh()
|
{
|
bodyView.RemoveAll();
|
|
for (int i = 0; i < 3; i++)
|
{
|
var RowView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(127 + 23),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
bodyView.AddChidren(RowView);
|
|
var btnText = new Button()
|
{
|
X = Application.GetRealWidth(58),
|
Width = Application.GetRealWidth(300),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
|
Gravity = Gravity.CenterVertical,
|
TextSize = 14,
|
};
|
RowView.AddChidren(btnText);
|
|
var btnRightFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(204),
|
X = Application.GetRealWidth(919 - 58),
|
Y = Application.GetRealHeight(25),
|
};
|
RowView.AddChidren(btnRightFrameLayout);
|
|
var btnRight = new Button()
|
{
|
Height = Application.GetRealHeight(60),
|
Width = Application.GetRealWidth(60),
|
X = Application.GetRealWidth(72),
|
Y = Application.GetRealHeight(32),
|
UnSelectedImagePath = "DoorLock/RightIcon.png",
|
};
|
btnRightFrameLayout.AddChidren(btnRight);
|
|
var line2 = new Button()
|
{
|
Y = RowView.Height - 1,
|
X = Application.GetRealWidth(58),
|
Width = Application.GetRealWidth(962),
|
Height = 1,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
};
|
RowView.AddChidren(line2);
|
|
if (i == 0)
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.LockMethod);
|
}
|
else if (i == 1)
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.FrozenUser);
|
btnRight.X = Application.GetRealWidth(50);
|
btnRight.Y = Application.GetRealHeight(32);
|
btnRight.Height = Application.GetRealHeight(63);
|
btnRight.Width = Application.GetRealWidth(104);
|
btnRight.UnSelectedImagePath = "DoorLock/Switch.png";
|
btnRight.SelectedImagePath = "DoorLock/SwitchOn.png";
|
//☆マーク☆
|
//var result = doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark];
|
//if (result == true)
|
//{
|
// btnRight.IsSelected = true;
|
//}
|
//else
|
//{
|
// btnRight.IsSelected = false;
|
//}
|
}
|
else if (i == 2)
|
{
|
//☆マーク☆
|
//if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == false)
|
//{
|
// btnText.Text = Language.StringByID(R.MyInternationalizationString.TempUnlockPermission);
|
// btnRight.X = Application.GetRealWidth(50);
|
// btnRight.Y = Application.GetRealHeight(32);
|
// btnRight.Height = Application.GetRealHeight(63);
|
// btnRight.Width = Application.GetRealWidth(104);
|
// btnRight.UnSelectedImagePath = "DoorLock/Switch.png";
|
// btnRight.SelectedImagePath = "DoorLock/SwitchOn.png";
|
// line2.Visible = false;
|
|
// var result1 = doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark];
|
// if (result1 == true)
|
// {
|
// btnRight.IsSelected = true;
|
// }
|
// else
|
// {
|
// btnRight.IsSelected = false;
|
// }
|
//}
|
//else
|
//{
|
// btnText.Width = 0;
|
// btnRight.Width = 0;
|
// line2.Width = 0;
|
// RowView.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout;
|
//}
|
}
|
|
int currentIndex = i;
|
EventHandler<MouseEventArgs> eHandler = (sender, e) =>
|
{
|
if (currentIndex == 0)
|
{
|
var unLockMethod = new Shared.Phone.UserCenter.DoorLock.UnLockMethod(doorLock, curAccountObj);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(unLockMethod);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
unLockMethod.Show();
|
}
|
else if (currentIndex == 1)
|
{
|
if (!btnRight.IsSelected)
|
{
|
FreezeUser(true);
|
}
|
else
|
{
|
FreezeUser(false);
|
}
|
}
|
else if (currentIndex == 2)
|
{
|
if (!btnRight.IsSelected)
|
{
|
HasRemoteUnlockAccessMethod(true);
|
}
|
else
|
{
|
HasRemoteUnlockAccessMethod(false);
|
}
|
}
|
};
|
if (i == 0)
|
{
|
btnRightFrameLayout.MouseUpEventHandler += eHandler;
|
btnRight.MouseUpEventHandler += eHandler;
|
RowView.MouseUpEventHandler += eHandler;
|
btnText.MouseUpEventHandler += eHandler;
|
}
|
else if (i == 1)
|
{
|
btnRightFrameLayout.MouseUpEventHandler += eHandler;
|
btnRight.MouseUpEventHandler += eHandler;
|
}
|
else if (i == 2)
|
{
|
btnRightFrameLayout.MouseUpEventHandler += eHandler;
|
btnRight.MouseUpEventHandler += eHandler;
|
}
|
}
|
}
|
|
/// <summary>
|
/// 冻结账户
|
/// </summary>
|
/// <param name="isFreeze"></param>
|
void FreezeUser(bool isFreeze)
|
{
|
var dialog = new Dialog { };
|
string textFreeze = "";
|
if (isFreeze)
|
{
|
textFreeze = Language.StringByID(R.MyInternationalizationString.SureToFreezeAccount);
|
}
|
else
|
{
|
textFreeze = Language.StringByID(R.MyInternationalizationString.SureToUnFreeze);
|
}
|
|
string msg = Language.StringByID(R.MyInternationalizationString.GoPersonalCenter);
|
var alert = new ShowMsgControl(ShowMsgType.Confirm, textFreeze, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm));
|
alert.Show();
|
//使用确认型弹框时,的回调函数
|
alert.ConfirmClickEvent += () =>
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
int successConunt = 0;
|
int operateConunt = -1;
|
Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
|
try
|
{
|
//☆マーク☆
|
//var doorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
//var curAccountDoorLockUserList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetAccountDoorLockUserList(doorLock, curAccountObj.SubAccountDistributedMark);
|
//if (curAccountDoorLockUserList.Count != 0)
|
//{
|
// //修改云端存储信息
|
// operateConunt = curAccountDoorLockUserList.Count;
|
// var tempGroupId = new List<List<int>>();
|
// var tempUserIdList = new List<int> { };
|
// foreach (var curDoorLockUser in curAccountDoorLockUserList)
|
// {
|
// // 账户中没有门锁用户
|
// if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId))
|
// {
|
// }
|
// else
|
// {
|
// if (tempUserIdList.Count == 9)
|
// {
|
// tempGroupId.Add(tempUserIdList);
|
// tempUserIdList = new List<int>();
|
// }
|
// tempUserIdList.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId));
|
// }
|
// }
|
// tempGroupId.Add(tempUserIdList);
|
// //批量冻结门锁中的账户
|
// ZigBee.Device.DoorLock.AccessType accessType;
|
// if (isFreeze)
|
// {
|
// accessType = ZigBee.Device.DoorLock.AccessType.DisEnableMoreUsers;
|
// }
|
// else
|
// {
|
// accessType = ZigBee.Device.DoorLock.AccessType.EnableMoreUsers;
|
// }
|
// //冻结/解冻用户
|
// int count1 = tempGroupId.Count;
|
// if (tempGroupId.Count == 1)
|
// {
|
// foreach (var a in tempGroupId)
|
// {
|
// if (a.Count == 0)
|
// {
|
// count1 = 0;
|
// break;
|
// }
|
// }
|
// }
|
// int count2 = 0;
|
|
// int tempCount = 0;
|
// for (int i = 0; i < tempGroupId.Count; i++)
|
// {
|
// var tempUserIdList1 = tempGroupId[i];
|
// if (tempUserIdList1.Count == 0)
|
// {
|
// break;
|
// }
|
// var passData = doorLock.FreezeAccountData(tempUserIdList1, accessType);
|
// var resultData = await doorLock.DefaultControlAsync(passData);
|
// if (resultData != null && resultData.defaultControlResponseData != null)
|
// {
|
// if (resultData.defaultControlResponseData.status == 32)
|
// {
|
// count2++;
|
// }
|
// else if (resultData.defaultControlResponseData.status == 33)
|
// {
|
// count2++;
|
// }
|
// System.Threading.Thread.Sleep(1000);
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
// });
|
// return;
|
// }
|
// tempCount++;
|
// }
|
|
// // 批量冻结门锁中的账户后,准备冻结云端账户
|
// if (count2 == count1)
|
// {
|
// foreach (var curDoorLockUser in curAccountDoorLockUserList)
|
// {
|
// if (isFreeze)
|
// {
|
// var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //☆マーク☆
|
// //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// refreshDoorLockData.IsOtherAccountCtrl = true;
|
// }
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
|
// refreshDoorLockData.OpenLockMode = curDoorLockUser.OpenLockMode;
|
// refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId;
|
// refreshDoorLockData.PrimaryId = curDoorLockUser.Id;
|
// refreshDoorLockData.IsFreezeUser = true;
|
// refreshDoorLockData.IsTempUnlockAuthority = doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark];
|
// //冻结云端
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// successConunt++;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// if (isFreeze)
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.FreezeFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// else
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnFreezeFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// return;
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// else
|
// {
|
// var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //☆マーク☆
|
// //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// refreshDoorLockData.IsOtherAccountCtrl = true;
|
// }
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
|
// refreshDoorLockData.OpenLockMode = curDoorLockUser.OpenLockMode;
|
// refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId;
|
// refreshDoorLockData.PrimaryId = curDoorLockUser.Id;
|
// refreshDoorLockData.IsFreezeUser = false;
|
// refreshDoorLockData.IsTempUnlockAuthority = doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark];
|
// //解冻云端
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// successConunt++;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.FreezeFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// if (isFreeze)
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.FreezeFailed) + ".", Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
// }
|
// else
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnFreezeFailed) + ".", Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
// }
|
// });
|
// }
|
//}
|
//else
|
//{
|
// //添加云端存储信息
|
// //冻结/解冻云端
|
// var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //☆マーク☆
|
// //addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// addLockInfo.IsOtherAccountCtrl = true;
|
// }
|
// addLockInfo.CloudAccountId = curAccountObj.SubAccountDistributedMark;
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
// addLockInfo.EntryTime = System.DateTime.Now;
|
// if (isFreeze)
|
// {
|
// addLockInfo.IsFreezeUser = true;
|
// }
|
// else
|
// {
|
// addLockInfo.IsFreezeUser = false;
|
// }
|
// addLockInfo.IsTempUnlockAuthority = doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark];
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// operateConunt = 0;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// if (isFreeze)
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.FreezeFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// else
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnFreezeFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// return;
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
|
// });
|
// }
|
//}
|
}
|
catch { }
|
finally
|
{
|
if (operateConunt == successConunt)
|
{
|
//☆マーク☆
|
//if (isFreeze)
|
//{
|
// doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] = true;
|
//}
|
//else
|
//{
|
// doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] = false;
|
//}
|
//doorLock.ReSave();
|
}
|
Application.RunOnMainThread(() =>
|
{
|
MidRefresh();
|
CommonPage.Loading.Hide();
|
});
|
}
|
});
|
};
|
}
|
|
/// <summary>
|
/// 是否给子账户拥有远程开锁的条件
|
/// </summary>
|
/// <param name="hasAccess"></param>
|
void HasRemoteUnlockAccessMethod(bool hasAccess)
|
{
|
string msg = Language.StringByID(R.MyInternationalizationString.SureGiveAccessToSubaccount);
|
if (!hasAccess)
|
{
|
msg = Language.StringByID(R.MyInternationalizationString.SureCancelAccessToSubaccount);
|
}
|
var alert = new ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm));
|
alert.Show();
|
//使用确认型弹框时,的回调函数
|
alert.ConfirmClickEvent += () =>
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
int successConunt = 0;
|
int operateConunt = -1;
|
Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
|
try
|
{
|
//☆マーク☆
|
//var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetAccountDoorLockUserList(doorLock, curAccountObj.SubAccountDistributedMark);
|
//var uList = new List<string> { };
|
//if (resultList != null)
|
//{
|
// foreach (var a in resultList)
|
// {
|
// uList.Add(a.CloudAccountId);
|
// }
|
//}
|
|
//var d = uList.Find((value) => { return value == curAccountObj.SubAccountDistributedMark; });
|
//if (d != null)
|
//{
|
// //修改云端存储信息
|
// var curAccountDoorLockUserList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetAccountDoorLockUserList(doorLock, curAccountObj.SubAccountDistributedMark);
|
|
// foreach (var curDoorLockUser in curAccountDoorLockUserList)
|
// {
|
// operateConunt = curAccountDoorLockUserList.Count;
|
// if (hasAccess)
|
// {
|
// var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //☆マーク☆
|
// //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// refreshDoorLockData.IsOtherAccountCtrl = true;
|
// }
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
// refreshDoorLockData.PrimaryId = curDoorLockUser.Id;
|
// refreshDoorLockData.IsFreezeUser = false;
|
// refreshDoorLockData.IsTempUnlockAuthority = true;
|
// // 授权
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// successConunt++;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GiveAccessToSubaccountFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// else
|
// {
|
// var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// refreshDoorLockData.IsOtherAccountCtrl = true;
|
// }
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
// refreshDoorLockData.PrimaryId = curDoorLockUser.Id;
|
// refreshDoorLockData.IsFreezeUser = false;
|
// refreshDoorLockData.IsTempUnlockAuthority = false;
|
// //取消权限
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// successConunt++;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CancelAccessToSubaccountFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
// }
|
// }
|
//}
|
//else
|
//{
|
// //新增,且不冻结
|
// var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
|
// if (UserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
// {
|
// //☆マーク☆
|
// //addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
// addLockInfo.IsOtherAccountCtrl = true;
|
// }
|
// addLockInfo.CloudAccountId = curAccountObj.SubAccountDistributedMark;
|
// if (doorLock.DeviceAddr != null)
|
// {
|
// addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
|
// }
|
// addLockInfo.EntryTime = System.DateTime.Now;
|
// addLockInfo.IsFreezeUser = false;
|
// if (hasAccess)
|
// {
|
// addLockInfo.IsTempUnlockAuthority = true;
|
// }
|
// else
|
// {
|
// addLockInfo.IsTempUnlockAuthority = false;
|
// }
|
// var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
|
// if (result != null)
|
// {
|
// if (result.Code == HttpMessageEnum.A正常)
|
// {
|
// operateConunt = 0;
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// if (hasAccess)
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GiveAccessToSubaccountFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// else
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CancelAccessToSubaccountFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// }
|
// return;
|
// });
|
// }
|
// }
|
// else
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
// });
|
// }
|
//}
|
|
}
|
catch { }
|
finally
|
{
|
if (operateConunt == successConunt)
|
{
|
//☆マーク☆
|
//if (hasAccess)
|
//{
|
// doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark] = true;
|
//}
|
//else
|
//{
|
// doorLock.HasRemoteUnlockAccess[curAccountObj.SubAccountDistributedMark] = false;
|
//}
|
doorLock.ReSave();
|
}
|
Application.RunOnMainThread(() =>
|
{
|
MidRefresh();
|
CommonPage.Loading.Hide();
|
});
|
}
|
});
|
};
|
}
|
}
|
}
|