| | |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | var bindResult = await currentKey.ClearBindInfoAsync(); |
| | | if (bindResult.clearBindInfoResponseData != null) |
| | | if (bindResult != null && bindResult.clearBindInfoResponseData != null) |
| | | { |
| | | if (bindResult.clearBindInfoResponseData.Result != 0) |
| | | { |
| | |
| | | isDelSuccess = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | CommonPage.Loading.Start(""); |
| | | var delResult = new DelDeviceBindResponseAllData(); |
| | | delResult = await currentKey.DelDeviceBindAsync(delDevice); |
| | | if (delResult.delDeviceBindResponseData?.RemoveBindList != null) |
| | | //if (delResult != null) |
| | | //{ |
| | | // if (delResult.removeBindResultResponseData != null) |
| | | // { |
| | | // if (delResult.removeBindResultResponseData.Result == 0) |
| | | // { |
| | | // currentKey.bindList.Remove(bindDevice); |
| | | // RefreshList(); |
| | | // return 0; |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | // } |
| | | // } |
| | | // else if (delResult.delDeviceBindResponseData != null) |
| | | // { |
| | | // foreach (var remTarget in delResult.delDeviceBindResponseData.RemoveBindList) |
| | | // { |
| | | // if (remTarget.Result == 0) |
| | | // { |
| | | // currentKey.bindList.Remove(bindDevice); |
| | | // RefreshList(); |
| | | // //如果是场景,用户删除清空当前到房间列表 |
| | | // currentKey.RoomId = ""; |
| | | // currentKey.ReSave(); |
| | | // return 0; |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | //} |
| | | |
| | | if (delResult != null && delResult.removeBindResultResponseData != null) |
| | | { |
| | | foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) |
| | | if (delResult.delDeviceBindResponseData?.RemoveBindList != null) |
| | | { |
| | | switch (re.Result) |
| | | foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) |
| | | { |
| | | case 0: |
| | | currentKey.bindList.Remove(bindDevice); |
| | | RefreshList(); |
| | | //如果是场景,用户删除清空当前到房间列表 |
| | | currentKey.RoomId = ""; |
| | | currentKey.ReSave(); |
| | | return 0; |
| | | break; |
| | | case 1: |
| | | currentKey.bindList.Clear(); |
| | | try |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | |
| | | var getBindList = await currentKey.GetDeviceBindAsync(); |
| | | var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | if (getBindList != null) |
| | | switch (re.Result) |
| | | { |
| | | case 0: |
| | | currentKey.bindList.Remove(bindDevice); |
| | | RefreshList(); |
| | | //如果是场景,用户删除清空当前到房间列表 |
| | | currentKey.RoomId = ""; |
| | | currentKey.ReSave(); |
| | | return 0; |
| | | break; |
| | | case 1: |
| | | currentKey.bindList.Clear(); |
| | | try |
| | | { |
| | | if (getBindList.getAllBindResponseData != null) |
| | | { |
| | | foreach (var b in getBindList.getAllBindResponseData.BindList) |
| | | { |
| | | if (b.BindCluster == currentClusterID) |
| | | { |
| | | if (b.BindCluster == 6) |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | |
| | | if (b.BindType == 2) |
| | | var getBindList = await currentKey.GetDeviceBindAsync(); |
| | | var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { }; |
| | | if (getBindList != null) |
| | | { |
| | | if (getBindList.getAllBindResponseData != null) |
| | | { |
| | | foreach (var b in getBindList.getAllBindResponseData.BindList) |
| | | { |
| | | if (b.BindCluster == currentClusterID) |
| | | { |
| | | if (b.BindCluster == 6) |
| | | { |
| | | bindSceneListTemp.Add(b); |
| | | |
| | | if (b.BindType == 2) |
| | | { |
| | | bindSceneListTemp.Add(b); |
| | | } |
| | | else |
| | | { |
| | | bindDeviceListTemp.Add(b); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | bindDeviceListTemp.Add(b); |
| | | currentKey.bindList.Add(b); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | currentKey.bindList.Add(b); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (currentKey.panelMode == 1) |
| | | { |
| | | currentKey.bindList = bindSceneListTemp; |
| | | } |
| | | else if (currentKey.panelMode == 100 || currentKey.panelMode == 101 || currentKey.panelMode == 102) |
| | | { |
| | | currentKey.bindList = bindDeviceListTemp; |
| | | } |
| | | } |
| | | if (currentKey.panelMode == 1) |
| | | catch { } |
| | | finally |
| | | { |
| | | currentKey.bindList = bindSceneListTemp; |
| | | } |
| | | else if (currentKey.panelMode == 100 || currentKey.panelMode == 101 || currentKey.panelMode == 102) |
| | | { |
| | | currentKey.bindList = bindDeviceListTemp; |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | RefreshList(); |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | break; |
| | | case 4: |
| | | if (delResult.removeBindResultResponseData != null) |
| | | { |
| | | if (delResult.removeBindResultResponseData.Result == 0) |
| | | { |
| | | currentKey.bindList.Remove(bindDevice); |
| | | RefreshList(); |
| | | return 0; |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | else |
| | | break; |
| | | case 2: |
| | | if (delResult.removeBindResultResponseData != null) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | if (delResult.removeBindResultResponseData.Result == 0) |
| | | { |
| | | currentKey.bindList.Remove(bindDevice); |
| | | RefreshList(); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | } |
| | | } |
| | | catch { } |