From f759dc1e6f49c53733eafda82207c85af18f9931 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 28 五月 2020 15:46:54 +0800
Subject: [PATCH] 2020-05-28-1
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs | 568 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 436 insertions(+), 132 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
index e1f47a1..730ce66 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
@@ -5,19 +5,8 @@
using static ZigBee.Device.BindObj;
namespace Shared.Phone.UserCenter.DeviceBind
{
- public class ChooseKeyModePage : BindCommonLayout, ZigBee.Common.IStatus
+ public class ChooseKeyModePage : BindCommonLayout
{
- /// <summary>
- /// 鎸夐敭妯″紡鎺ユ敹
- /// </summary>
- /// <param name="common">Common.</param>
- public void Changed(CommonDevice common)
- {
- Shared.Application.RunOnMainThread(() =>
- {
- });
- }
-
/// 鏋勯�犲嚱鏁�
/// </summary>
/// <param name="doorLock"></param>
@@ -29,23 +18,47 @@
this.targetList = targetSelectList;
}
- #region 鈼� 鍙橀噺鐢虫槑__________________________
- ZigBee.Device.Panel currentKey;//褰撳墠鎸夐敭
- //鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew
- VerticalScrolViewLayout midVerticalScrolViewLayout;//涓儴鍒锋柊鍒楄〃
- HorizontalScrolViewLayout btnHorizontalScrolViewLayout;//鎴块棿鍒楄〃宸﹀彸婊戝姩甯冨眬
+ #region 鍙橀噺鐢虫槑
+ /// <summary>
+ /// 褰撳墠鎸夐敭
+ /// </summary>
+ ZigBee.Device.Panel currentKey;
+ /// <summary>
+ /// 涓儴鍒锋柊鍒楄〃
+ /// </summary>
+ VerticalScrolViewLayout midVerticalScrolViewLayout;
+ /// <summary>
+ /// 鎴块棿鍒楄〃宸﹀彸婊戝姩甯冨眬
+ /// </summary>
+ HorizontalScrolViewLayout btnHorizontalScrolViewLayout;
/// <summary>
/// 鎸夐敭閰嶇疆鐨勭洰鏍囧垪琛�
/// </summary>
- List<CommonDevice> targetList = new List<CommonDevice>();//鏈湴涓存椂閫変腑鍒楄〃
+ List<CommonDevice> targetList = new List<CommonDevice>();
/// <summary>
- /// 鏂扮殑鎸夐敭閰嶇疆鐩爣鍒楄〃涓紝鐩爣瀹為檯瀛樺湪鎸夐敭涓紝姝ゆ椂瑕佸垹鎺夌殑鏁版嵁
+ /// 鏈湴鏃х殑閫変腑鍒楄〃
/// </summary>
- List<CommonDevice> oldTargetList = new List<CommonDevice>();//鏈湴鏃х殑閫変腑鍒楄〃
- int currentClusterID = 6;//褰撳墠绨嘔D
- public Action<List<BindListResponseObj>> action;//鍥炶皟缁戝畾鐩爣椤甸潰鍒锋柊
- int currentModeID = 0;//褰撳墠妯″紡ID
- string curDeviceBindType = "";//褰撳墠璁惧缁戝畾绫诲瀷
+ List<CommonDevice> oldTargetList = new List<CommonDevice>();
+ /// <summary>
+ /// 褰撳墠绨嘔D
+ /// </summary>
+ int currentClusterID = 6;
+ /// <summary>
+ /// 鍥炶皟缁戝畾鐩爣椤甸潰鍒锋柊
+ /// </summary>
+ public Action<List<BindListResponseObj>> action;
+ /// <summary>
+ /// 褰撳墠妯″紡ID
+ /// </summary>
+ int currentModeID = 0;
+ /// <summary>
+ /// 褰撳墠璁惧缁戝畾绫诲瀷
+ /// </summary>
+ string curDeviceBindType = "";
+ /// <summary>
+ /// 绫诲瀷鐨勫叿浣撴ā寮忓垪琛�
+ /// </summary>
+ List<int> typeDetailModeList = new List<int> { };
#endregion
/// <summary>
@@ -95,6 +108,7 @@
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
TextSize = 16,
+ IsBold = true,
};
bottomFrameLayout.AddChidren(btnFinifh);
#endregion
@@ -113,7 +127,7 @@
//1銆佹竻绌烘墍鏈夌洰鏍�
if (currentKey.bindList != null)
{
- var bindResult = await currentKey.ClearBindInfoAsync();
+ var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey);
if (bindResult != null && bindResult.clearBindInfoResponseData != null)
{
if (bindResult.clearBindInfoResponseData.Result != 0)
@@ -150,43 +164,43 @@
switch (currentModeID)
{
case 100:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_On);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_On);
break;
case 101:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_oFF);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_oFF);
break;
case 102:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_OnOff);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_OnOff);
break;
case 200:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Step_Up);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Step_Up);
break;
case 201:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Step_Down);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Step_Down);
break;
case 203:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Up);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Up);
break;
case 204:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Down);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Down);
break;
case 205:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Up_Down);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Up_Down);
break;
case 300:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Up);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Up);
break;
case 301:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Down);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Down);
break;
case 302:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Stop);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Stop);
break;
case 303:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Up_Stop);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Up_Stop);
break;
case 304:
- temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Down_Stop);
+ temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Down_Stop);
break;
}
if (temp != null && temp.setWritableValueResponData != null)
@@ -229,19 +243,8 @@
}
var dev = new AddedDeviceBindResponseAllData();
- dev = await currentKey.AddDeviceBindAsync(addBindeDev);
- if (dev.addedDeviceBindResponseData == null)
- {
- 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;
- }
- else
+ dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev);
+ if (dev != null && dev.addedDeviceBindResponseData != null)
{
if (dev.addedDeviceBindResponseData.Result == 0)
{
@@ -304,6 +307,17 @@
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;
+ }
}
else
{
@@ -344,30 +358,284 @@
/// </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 () =>
+ {
+ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ typeDetailModeList.Clear();
+ return new List<int>() { 100, 101, 102 };
+ }
+
+ 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 () =>
+ {
+ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ typeDetailModeList.Clear();
+ return new List<int>() { 200, 201, 203, 204, 205 };
+ }
+
+ 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();
+ //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ });
+ typeDetailModeList.Clear();
+ return new List<int>() { 300, 301, 302, 303, 304 };
+ }
+
+ 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;
+ });
+ }
+
+ /// <summary>
+ /// 娣诲姞寮�鍏虫ā寮�
+ /// </summary>
+ 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 缁戝畾琛║I鏄撅紙鏃犳暟鎹鐞嗭級
var rowLayout = new FrameLayout()
@@ -385,13 +653,14 @@
Y = Application.GetRealHeight(58),
TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
TextAlignment = TextAlignment.CenterLeft,
+ TextSize = 14,
};
rowLayout.AddChidren(btnModeText);
var btnChoose = new Button()
{
- Width = Application.GetRealWidth(60),
- Height = Application.GetRealHeight(60),
+ Width = Application.GetMinReal(60),
+ Height = Application.GetMinReal(60),
X = Application.GetRealWidth(861 + 81),
Y = Application.GetRealHeight(35),
SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -410,17 +679,21 @@
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;
}
@@ -464,7 +737,6 @@
oldMode = btnChoose;
oldMode.IsSelected = true;
oldMode.Visible = true;
- currentKey.CurrentSwitchMode = btnModeText.Text;
if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.OnOffOn))
{
currentModeID = 100;
@@ -486,13 +758,42 @@
rowLayout.MouseUpEventHandler += hander;
btnModeText.MouseUpEventHandler += hander;
btnChoose.MouseUpEventHandler += hander;
+ i++;
}
}
- private void AddDimmerMode()
+ /// <summary>
+ /// 娣诲姞璋冨厜妯″紡
+ /// </summary>
+ 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 缁戝畾琛║I鏄撅紙鏃犳暟鎹鐞嗭級
var rowLayout = new FrameLayout()
@@ -510,13 +811,14 @@
Y = Application.GetRealHeight(58),
TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
TextAlignment = TextAlignment.CenterLeft,
+ TextSize = 14,
};
rowLayout.AddChidren(btnModeText);
var btnChoose = new Button()
{
- Width = Application.GetRealWidth(60),
- Height = Application.GetRealHeight(60),
+ Width = Application.GetMinReal(60),
+ Height = Application.GetMinReal(60),
X = Application.GetRealWidth(861 + 81),
Y = Application.GetRealHeight(35),
SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -534,26 +836,27 @@
};
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 == typeDetailModeListTemp.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;
}
@@ -609,7 +912,6 @@
oldMode = btnChoose;
oldMode.IsSelected = true;
oldMode.Visible = true;
- currentKey.CurrentSwitchMode = btnModeText.Text;
if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.DimmerMode1))
{
currentModeID = 200;
@@ -640,14 +942,31 @@
rowLayout.MouseUpEventHandler += hander;
btnModeText.MouseUpEventHandler += hander;
btnChoose.MouseUpEventHandler += hander;
-
+ i++;
}
}
- private void AddCurtainMode()
+ /// <summary>
+ /// 娣诲姞绐楀笜妯″紡
+ /// </summary>
+ 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 缁戝畾琛║I鏄撅紙鏃犳暟鎹鐞嗭級
var rowLayout = new FrameLayout()
@@ -665,13 +984,14 @@
Y = Application.GetRealHeight(58),
TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
TextAlignment = TextAlignment.CenterLeft,
+ TextSize = 14,
};
rowLayout.AddChidren(btnModeText);
var btnChoose = new Button()
{
- Width = Application.GetRealWidth(60),
- Height = Application.GetRealHeight(60),
+ Width = Application.GetMinReal(60),
+ Height = Application.GetMinReal(60),
X = Application.GetRealWidth(861 + 81),
Y = Application.GetRealHeight(35),
SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -689,26 +1009,27 @@
};
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;
}
@@ -764,7 +1085,6 @@
oldMode = btnChoose;
oldMode.IsSelected = true;
oldMode.Visible = true;
- currentKey.CurrentSwitchMode = btnModeText.Text;
if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.WcdUp))
{
currentModeID = 300;
@@ -795,24 +1115,8 @@
rowLayout.MouseUpEventHandler += hander;
btnModeText.MouseUpEventHandler += hander;
btnChoose.MouseUpEventHandler += hander;
+ i++;
}
- }
-
- private void FinisfhEventHandler(object sender, MouseEventArgs e)
- {
-
- }
-
- public void DeviceInfoChange(CommonDevice common, string typeTag)
- {
- }
-
- public void ChangedILogicStatus(ZigBee.Device.Logic logic)
- {
- }
-
- public void ChangedISceneStatus(Scene scene)
- {
}
}
}
--
Gitblit v1.8.0