| | |
| | | public Action<List<BindListResponseObj>> action;//回调绑定目标页面刷新 |
| | | int currentModeID = 0;//当前模式ID |
| | | string curDeviceBindType = "";//当前设备绑定类型 |
| | | List<int> typeDetailModeList = new List<int> { }; |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="gateway">Gateway.</param> |
| | | /// <param name="key">Key.</param> |
| | | private void KeyModeList() |
| | | async private void KeyModeList() |
| | | { |
| | | midVerticalScrolViewLayout.RemoveAll(); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case "AddSwitch": |
| | | currentClusterID = 6; |
| | | AddSwitchMode(); |
| | | typeDetailModeList = await GetAddSwitchMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | } |
| | | else |
| | | { |
| | | AddSwitchMode(); |
| | | } |
| | | break; |
| | | case "AddDimmer": |
| | | AddDimmerMode(); |
| | | currentClusterID = 8; |
| | | typeDetailModeList = await GetAddDimmerMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | } |
| | | else |
| | | { |
| | | AddDimmerMode(); |
| | | } |
| | | break; |
| | | case "AddCurtain": |
| | | currentClusterID = 258; |
| | | AddCurtainMode(); |
| | | typeDetailModeList = await GetAddCurtainMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | } |
| | | else |
| | | { |
| | | AddCurtainMode(); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void AddSwitchMode() |
| | | /// <summary> |
| | | /// 获取开关具体类型 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | System.Threading.Tasks.Task<List<int>> GetAddSwitchMode() |
| | | { |
| | | return System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | }); |
| | | typeDetailModeList.Clear(); |
| | | List<int> result3 = new List<int> { }; |
| | | try |
| | | { |
| | | //获取第三级功能 |
| | | if (currentKey.privateFuncThirdLevelList.Count == 0 || currentKey.privateFuncThirdLevelList.Contains(100) == false || currentKey.privateFuncThirdLevelList.Contains(101) == false || currentKey.privateFuncThirdLevelList.Contains(102) == false) |
| | | { |
| | | result3 = await currentKey.GetPanelDeviceFunctionLevel3(256, 100); |
| | | foreach (var l3 in result3) |
| | | { |
| | | currentKey.privateFuncThirdLevelList.Add(l3); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (currentKey.privateFuncThirdLevelList.Contains(100) == true) |
| | | { |
| | | result3.Add(100); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(101) == true) |
| | | { |
| | | result3.Add(101); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(102) == true) |
| | | { |
| | | result3.Add(102); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var aa = ex.Message; |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | return result3; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取调光具体类型 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | System.Threading.Tasks.Task<List<int>> GetAddDimmerMode() |
| | | { |
| | | return System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | }); |
| | | typeDetailModeList.Clear(); |
| | | List<int> result3 = new List<int> { }; |
| | | try |
| | | { |
| | | //获取第三级功能 |
| | | if (currentKey.privateFuncThirdLevelList.Count == 0 |
| | | || currentKey.privateFuncThirdLevelList.Contains(200) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(201) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(203) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(204) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(205) == false) |
| | | { |
| | | result3 = await currentKey.GetPanelDeviceFunctionLevel3(256, 200); |
| | | foreach (var l3 in result3) |
| | | { |
| | | currentKey.privateFuncThirdLevelList.Add(l3); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (currentKey.privateFuncThirdLevelList.Contains(200) == true) |
| | | { |
| | | result3.Add(200); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(201) == true) |
| | | { |
| | | result3.Add(201); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(203) == true) |
| | | { |
| | | result3.Add(203); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(204) == true) |
| | | { |
| | | result3.Add(204); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(205) == true) |
| | | { |
| | | result3.Add(205); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | return result3; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取窗帘具体类型 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | System.Threading.Tasks.Task<List<int>> GetAddCurtainMode() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | }); |
| | | return System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | typeDetailModeList.Clear(); |
| | | List<int> result3 = new List<int> { }; |
| | | try |
| | | { |
| | | //获取第三级功能 |
| | | if (currentKey.privateFuncThirdLevelList.Count == 0 |
| | | || currentKey.privateFuncThirdLevelList.Contains(300) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(301) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(302) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(303) == false |
| | | || currentKey.privateFuncThirdLevelList.Contains(304) == false) |
| | | { |
| | | result3 = await currentKey.GetPanelDeviceFunctionLevel3(256, 300); |
| | | foreach (var l3 in result3) |
| | | { |
| | | currentKey.privateFuncThirdLevelList.Add(l3); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (currentKey.privateFuncThirdLevelList.Contains(300) == true) |
| | | { |
| | | result3.Add(300); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(301) == true) |
| | | { |
| | | result3.Add(301); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(302) == true) |
| | | { |
| | | result3.Add(302); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(303) == true) |
| | | { |
| | | result3.Add(303); |
| | | } |
| | | if (currentKey.privateFuncThirdLevelList.Contains(304) == true) |
| | | { |
| | | result3.Add(304); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | return result3; |
| | | }); |
| | | } |
| | | |
| | | async private void AddSwitchMode() |
| | | { |
| | | if (typeDetailModeList == null) |
| | | { |
| | | //再次动态获取按键支持的类 |
| | | typeDetailModeList = await GetAddSwitchMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | Button oldMode = null; |
| | | for (int i = 0; i < 3; i++) |
| | | int i = 0; |
| | | foreach (var modeSwitchValue in typeDetailModeList) |
| | | { |
| | | #region 绑定表UI显(无数据处理) |
| | | var rowLayout = new FrameLayout() |
| | |
| | | rowLayout.AddChidren(line2); |
| | | #endregion |
| | | |
| | | if (i == 0) |
| | | switch (modeSwitchValue) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffOn); |
| | | case 100: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffOn); |
| | | break; |
| | | case 101: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffoFF); |
| | | break; |
| | | case 102: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffOnOff); |
| | | break; |
| | | } |
| | | if (i == 1) |
| | | |
| | | if (i == typeDetailModeList.Count - 1) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffoFF); |
| | | } |
| | | if (i == 2) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.OnOffOnOff); |
| | | line2.Visible = false; |
| | | } |
| | | |
| | |
| | | rowLayout.MouseUpEventHandler += hander; |
| | | btnModeText.MouseUpEventHandler += hander; |
| | | btnChoose.MouseUpEventHandler += hander; |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | private void AddDimmerMode() |
| | | async private void AddDimmerMode() |
| | | { |
| | | if (typeDetailModeList == null) |
| | | { |
| | | //再次动态获取按键支持的类 |
| | | typeDetailModeList = await GetAddDimmerMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | Button oldMode = null; |
| | | for (int i = 0; i < 5; i++) |
| | | int i = 0; |
| | | |
| | | List<int> typeDetailModeListTemp = new List<int> { }; |
| | | foreach (var modeSwitchValue in typeDetailModeList) |
| | | { |
| | | if (modeSwitchValue == 202) |
| | | { |
| | | continue; |
| | | } |
| | | typeDetailModeListTemp.Add(modeSwitchValue); |
| | | } |
| | | |
| | | foreach (var modeSwitchValue in typeDetailModeListTemp) |
| | | { |
| | | #region 绑定表UI显(无数据处理) |
| | | var rowLayout = new FrameLayout() |
| | |
| | | }; |
| | | rowLayout.AddChidren(line2); |
| | | #endregion |
| | | switch (modeSwitchValue) |
| | | { |
| | | case 200: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode1); |
| | | break; |
| | | case 201: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode2); |
| | | break; |
| | | case 203: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode3); |
| | | break; |
| | | case 204: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode4); |
| | | break; |
| | | case 205: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode5); |
| | | break; |
| | | } |
| | | |
| | | if (i == 0) |
| | | if (i == typeDetailModeList.Count - 1) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode1); |
| | | } |
| | | if (i == 1) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode2); |
| | | } |
| | | if (i == 2) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode3); |
| | | } |
| | | if (i == 3) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode4); |
| | | } |
| | | if (i == 4) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.DimmerMode5); |
| | | line2.Visible = false; |
| | | } |
| | | |
| | |
| | | rowLayout.MouseUpEventHandler += hander; |
| | | btnModeText.MouseUpEventHandler += hander; |
| | | btnChoose.MouseUpEventHandler += hander; |
| | | |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | private void AddCurtainMode() |
| | | async private void AddCurtainMode() |
| | | { |
| | | if (typeDetailModeList == null) |
| | | { |
| | | //再次动态获取按键支持的类 |
| | | typeDetailModeList = await GetAddSwitchMode(); |
| | | if (typeDetailModeList == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | Button oldMode = null; |
| | | for (int i = 0; i < 5; i++) |
| | | int i = 0; |
| | | foreach (var modeSwitchValue in typeDetailModeList) |
| | | { |
| | | #region 绑定表UI显(无数据处理) |
| | | var rowLayout = new FrameLayout() |
| | |
| | | }; |
| | | rowLayout.AddChidren(line2); |
| | | #endregion |
| | | switch (modeSwitchValue) |
| | | { |
| | | case 300: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdUp); |
| | | break; |
| | | case 301: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdDown); |
| | | break; |
| | | case 302: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdStop); |
| | | break; |
| | | case 303: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdUpStop); |
| | | break; |
| | | case 304: |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdDownStop); |
| | | break; |
| | | } |
| | | |
| | | if (i == 0) |
| | | if (i == typeDetailModeList.Count - 1) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdUp); |
| | | } |
| | | if (i == 1) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdDown); |
| | | } |
| | | if (i == 2) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdStop); |
| | | } |
| | | if (i == 3) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdUpStop); |
| | | } |
| | | if (i == 4) |
| | | { |
| | | btnModeText.Text = Language.StringByID(R.MyInternationalizationString.WcdDownStop); |
| | | line2.Visible = false; |
| | | } |
| | | |
| | |
| | | rowLayout.MouseUpEventHandler += hander; |
| | | btnModeText.MouseUpEventHandler += hander; |
| | | btnChoose.MouseUpEventHandler += hander; |
| | | i++; |
| | | } |
| | | } |
| | | |