| | |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | btnFinifh.MouseUpEventHandler += async (sender, e) => |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | bool isFinish = false; |
| | | try |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | if (currentKey.bindList.Count != 0) |
| | | { |
| | | var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey); |
| | | if (bindResult != null && bindResult.clearBindInfoResponseData != null) |
| | | { |
| | | if (bindResult.clearBindInfoResponseData.Result != 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | currentKey.bindList.Clear(); |
| | | } |
| | | } |
| | | else |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | if (currentKey.bindList.Count != 0) |
| | | { |
| | | var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey); |
| | | if (bindResult != null && bindResult.clearBindInfoResponseData != null) |
| | | { |
| | | if (bindResult.clearBindInfoResponseData.Result != 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | currentKey.bindList.Clear(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Scene_Trigger); |
| | | if (temp == null || temp.setWritableValueResponData == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Scene_Trigger); |
| | | if (temp == null || temp.setWritableValueResponData == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | if (temp.setWritableValueResponData.Status != 0) |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | } |
| | | if (temp.setWritableValueResponData.Status != 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.ChangeBindMode); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | currentKey.panelMode = 1; |
| | | var addBindeDev = new AddBindData(); |
| | | addBindeDev.DeviceAddr = currentKey.DeviceAddr; |
| | | addBindeDev.Epoint = currentKey.DeviceEpoint; |
| | | foreach (var de in targetListDevice) |
| | | { |
| | | if (de.DeviceAddr != null) |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var addBindInfo = new AddBindListObj(); |
| | | addBindInfo.BindType = 0; |
| | | addBindInfo.BindCluster = 6; |
| | | addBindInfo.BindMacAddr = de.DeviceAddr; |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.ChangeBindMode); |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | currentKey.panelMode = 1; |
| | | var addBindeDev = new AddBindData(); |
| | | addBindeDev.DeviceAddr = currentKey.DeviceAddr; |
| | | addBindeDev.Epoint = currentKey.DeviceEpoint; |
| | | foreach (var de in targetListDevice) |
| | | { |
| | | if (de.DeviceAddr != null) |
| | | { |
| | | var addBindInfo = new AddBindListObj(); |
| | | addBindInfo.BindType = 0; |
| | | addBindInfo.BindCluster = 6; |
| | | addBindInfo.BindMacAddr = de.DeviceAddr; |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | }
|
| | | foreach (var de in targetListScene) |
| | | {
|
| | | var addBindInfo = new AddBindListObj();
|
| | | addBindInfo.BindType = 1;
|
| | | addBindInfo.BindCluster = 6;
|
| | | addBindInfo.BindScenesId = de.Id;
|
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | }
|
| | | foreach (var de in targetListScene) |
| | | {
|
| | | var addBindInfo = new AddBindListObj();
|
| | | addBindInfo.BindType = 1;
|
| | | addBindInfo.BindCluster = 6;
|
| | | addBindInfo.BindScenesId = de.Id;
|
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | |
| | | var dev = new AddedDeviceBindResponseAllData(); |
| | | dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev); |
| | | if (dev != null && dev.addedDeviceBindResponseData != null) |
| | | { |
| | | if (dev.addedDeviceBindResponseData.Result == 0) |
| | | var dev = new AddedDeviceBindResponseAllData(); |
| | | dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev); |
| | | if (dev != null && dev.addedDeviceBindResponseData != null) |
| | | { |
| | | currentKey.bindList = dev.addedDeviceBindResponseData.BindList; |
| | | targetListDevice.Clear(); |
| | | targetListScene.Clear(); |
| | | isFinish = true; |
| | | if (isFinish) |
| | | if (dev.addedDeviceBindResponseData.Result == 0) |
| | | { |
| | | if (action != null) |
| | | currentKey.bindList = dev.addedDeviceBindResponseData.BindList; |
| | | targetListDevice.Clear(); |
| | | targetListScene.Clear(); |
| | | isFinish = true; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | action(currentKey.bindList); |
| | | } |
| | | this.RemoveFromParent(); |
| | | if (isFinish) |
| | | { |
| | | if (action != null) |
| | | { |
| | | action(currentKey.bindList); |
| | | } |
| | | this.RemoveFromParent(); |
| | | } |
| | | else |
| | | { |
| | | this.RemoveFromParent(); |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | }); |
| | | } |
| | | else if (dev.addedDeviceBindResponseData.Result == 1) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindFailed), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | this.RemoveFromParent(); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | }); |
| | | } |
| | | else if (dev.addedDeviceBindResponseData.Result == 1) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindFailed), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | }); |
| | | |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | { |
| | | MaxWidth = 150, |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | catch { } |
| | | }); |
| | | }; |
| | | #endregion |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | bool IsTip = false; |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | if (currentKey.bindList.Count != 0) |
| | | { |
| | | if (IsTip) |
| | | { |
| | | return; |
| | | } |
| | | IsTip = true; |
| | | if (btnChoose.IsSelected) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName); |