From 6a518151a9a8efb62c768198aebe4a0ff9ce77f2 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 21 十一月 2019 11:11:12 +0800
Subject: [PATCH] 2019-11-21-1
---
ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs | 531 +++++++++++++++++++++++++++-------------------------
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs | 30 --
ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml | 24 +-
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs | 5
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide | 0
5 files changed, 293 insertions(+), 297 deletions(-)
diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index 6664264..d1d18f0 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,19 +2,19 @@
<MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.SelectDevice" />
<MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.913cb77b0eef11c9119c61a02bc00fec01bf67d6" />
<MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/LogicCommunalPage.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/MemberList.cs">
<Files>
- <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs" Line="339" Column="51" />
- <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs" Line="418" Column="82" />
- <File FileName="Shared/Phone/UserView/HomePage.cs" Line="97" Column="64" />
- <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="470" Column="76" />
- <File FileName="Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs" Line="249" Column="1" />
- <File FileName="Shared/Common/CommonPage.cs" Line="42" Column="52" />
- <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="536" Column="30" />
- <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="723" Column="1" />
+ <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs" Line="334" Column="77" />
+ <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs" Line="413" Column="18" />
+ <File FileName="Shared/Phone/UserView/HomePage.cs" />
+ <File FileName="Shared/Phone/Device/Logic/Send.cs" />
+ <File FileName="Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs" />
+ <File FileName="Shared/Common/CommonPage.cs" />
+ <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" />
<File FileName="Shared/Phone/Device/Logic/DeviceStateCondition.cs" Line="1450" Column="54" />
- <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs" Line="215" Column="59" />
- <File FileName="Shared/Common/Logic.cs" Line="66" Column="15" />
+ <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs" />
+ <File FileName="Shared/Common/Logic.cs" />
+ <File FileName="Shared/Phone/Device/Logic/MemberList.cs" Line="12" Column="16" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -29,7 +29,7 @@
<Node name="Device" expanded="True">
<Node name="Logic" expanded="True">
<Node name="DoorLockLogic" expanded="True" />
- <Node name="LogicCommunalPage.cs" selected="True" />
+ <Node name="MemberList.cs" selected="True" />
</Node>
</Node>
<Node name="UserCenter" expanded="True">
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index 61e5425..d37b547 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
index e009bb3..8d531a1 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
@@ -14,6 +14,7 @@
Button selectedIcon = new Button();
VerticalScrolViewLayout middle;
public int conditionsIndex = -1;
+
public async void Show()
{
#region 鏈�涓婇潰鐨勫竷灞�浠g爜
@@ -284,27 +285,7 @@
TextSize = 14,
};
doorlockRow.AddChidren(doorlockBtn);
- //(0鎸夐敭/3鍗�/15鎸囩汗)
- //switch (userIdmode.OpenMode.ToString())
- //{
- // case "0":
- // {
- // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.lockpassword);
- // }
- // break;
- // case "3":
- // {
- // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.ic);
- // }
- // break;
- // case "15":
- // {
- // doorlockBtn.Text = Language.StringByID(MyInternationalizationString.fingerprint);
- // }
- // break;
- //}
-
-
+
var doorlockSelected = new Button
{
X = Application.GetRealWidth(860),
@@ -395,7 +376,7 @@
{
if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1")
{
- if (Common.Logic.CurrentLogic.Accounts[i]["Account"] == membershipIfon.UserName + modeName && Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
+ if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
{
addAccount = true;
break;
@@ -409,13 +390,16 @@
}
else
{
+ ///鎵惧嚭涔嬪墠鐨勬棫鏁版嵁绉婚櫎鎺夛紝鍐嶉噸鏂版坊鍔犳柊鏁版嵁锛�
+ string accountuserId = Common.Logic.CurrentLogic.Conditions[conditionsIndex]["AttriButeData2"];
Common.Logic.CurrentLogic.Conditions.RemoveAt(conditionsIndex);
Common.Logic.CurrentLogic.Conditions.Insert(conditionsIndex, lockConditionsInfo);
for (int i = 0; i < Common.Logic.CurrentLogic.Accounts.Count; i++)
{
if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1")
{
- if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
+ ///鎵惧嚭涔嬪墠鐨勬棫鏁版嵁绉婚櫎鎺夛紝鍐嶉噸鏂版坊鍔犳柊鏁版嵁锛�
+ if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == accountuserId)
{
Common.Logic.CurrentLogic.Accounts.RemoveAt(i);
Common.Logic.CurrentLogic.Accounts.Insert(i, accounts);
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
index 449d462..ebf8d23 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
@@ -81,11 +81,6 @@
Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑
Common.Logic.CurrentLogic.LogicType = 1;
Common.Logic.CurrentLogic.Relationship = 1;
- //Config.Instance.Guid鐢ㄦ潵璇嗗埆璐﹀彿韬唤锛�
- var accounts = new System.Collections.Generic.Dictionary<string, string>();
- accounts.Add("Type","1");
- accounts.Add("Account", Config.Instance.Guid);
- Common.Logic.CurrentLogic.Accounts.Add(accounts);
Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
var lockLogicCommunalPage = new LockLogicCommunalPage();
UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index 423a369..edb61d2 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -14,13 +14,13 @@
Tag = "Logic";
}
Button selectedIcon = new Button();
- public static bool edit=false;
-
+ public static bool edit = false;
+ VerticalScrolViewLayout middle;
- public async void Show(CommonDevice common, Dictionary<string, string> editdeviceConditionsInfo=null)
+ public async void Show(CommonDevice common, Dictionary<string, string> editdeviceConditionsInfo = null)
{
-
-
+
+
UserView.HomePage.Instance.ScrollEnabled = false;
this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
#region 鏈�涓婇潰鐨勫竷灞�浠g爜
@@ -73,7 +73,7 @@
};
#endregion
- var middle = new VerticalScrolViewLayout
+ middle = new VerticalScrolViewLayout
{
Y = topRowLayout.Bottom,
Height = Application.GetRealHeight(1920 - 184),
@@ -94,14 +94,22 @@
}
}
-
+ CommonPage.Loading.Start();
if (!d)
{
var allMemberslist = await Send.AllMembers(common.DeviceAddr);
Send.LockList.AddRange(allMemberslist);
}
+ UserList(macport, common, editdeviceConditionsInfo);
+ CommonPage.Loading.Hide();
+ }
+ /// <summary>
+ /// 鎴愬憳鍒楄〃鐨勬柟娉�
+ /// </summary>
+ /// <param name="macport"></param>
+ void UserList(string macport, CommonDevice common, Dictionary<string, string> editdeviceConditionsInfo)
+ {
-
foreach (var user in Send.LockList)
{
if (user.DoorLockMacPort != macport)
@@ -112,7 +120,7 @@
{
Height = Application.GetRealHeight(160),
BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- // LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ // LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
};
middle.AddChidren(userFramelayout);
@@ -148,253 +156,7 @@
EventHandler<MouseEventArgs> useridclick = (sender, e) =>
{
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- this.AddChidren(flMain);
- flMain.MouseUpEventHandler += (sender1, e1) =>
- {
- flMain.RemoveFromParent();
- };
-
- var lockcolorfra = new FrameLayout
- {
- Width = Application.GetRealWidth(1080),
- Height = Application.GetRealHeight(100),
- Y = Application.GetRealHeight(1920 - 100),
- BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
- };
- flMain.AddChidren(lockcolorfra);
-
- var lockcolorfra1 = new FrameLayout
- {
-
- Width = Application.GetRealWidth(1080),
- Height = Application.GetRealHeight(530),
- Y = Application.GetRealHeight(1920 - 530),
- BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
- Radius = (uint)Application.GetRealHeight(60),
- };
- flMain.AddChidren(lockcolorfra1);
-
- #region -------鍙栨秷 瀹屾垚
- var lockRow = new RowLayout
- {
- Height = Application.GetRealHeight(140),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- lockcolorfra1.AddChidren(lockRow);
- var Btncancel = new Button
- {
- TextID = MyInternationalizationString.cancel,
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- Height = Application.GetRealHeight(140),
- Width = Application.GetRealWidth(200),
- X = Application.GetRealWidth(80),
- TextAlignment = TextAlignment.CenterLeft,
- TextSize = 14,
- };
- lockRow.AddChidren(Btncancel);
- Btncancel.MouseUpEventHandler += (sender16, e16) =>
- {
- flMain.RemoveFromParent();
- UserView.HomePage.Instance.ScrollEnabled = true;
- };
-
- var Btntitle = new Button
- {
- TextID = MyInternationalizationString.security,
- TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
- Height = Application.GetRealHeight(140),
- Width = Application.GetRealWidth(320),
- TextAlignment = TextAlignment.Center,
- X = Btncancel.Right + Application.GetRealWidth(100),
- TextSize = 16,
- Text = user.UserName,
- };
- lockRow.AddChidren(Btntitle);
- var Btncomplete = new Button
- {
- TextID = MyInternationalizationString.complete,
- TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
- Height = Application.GetRealHeight(140),
- Width = Application.GetRealWidth(200),
- TextAlignment = TextAlignment.CenterRight,
- X = Btntitle.Right + Application.GetRealWidth(100),
- TextSize = 14,
-
- };
- lockRow.AddChidren(Btncomplete);
- #endregion
- ///瀹氫袱涓彉閲忚褰曚箣鍓嶇殑鍙�硷紱
- string userId = "";
- string openMode = "";
- string accountname = "";
- string SelectedDeviceStatuscondition = "";
- lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50);
- lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50);
- for (int i = 0; i < user.UserIdMode.Count; i++)
- {
- var userifon = user.UserIdMode[i];
- var doorlockfra = new FrameLayout
- {
- Height = Application.GetRealHeight(160),
- Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * i),
- };
- lockcolorfra1.AddChidren(doorlockfra);
-
- var doorlockRow = new RowLayout
- {
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(920),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(80),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- doorlockfra.AddChidren(doorlockRow);
-
- var doorlockBtn = new Button
- {
- Width = Application.GetRealWidth(600),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
- Text= userifon.ModeName,
- TextSize = 14,
- };
- doorlockRow.AddChidren(doorlockBtn);
-
- var doorlockSelected = new Button
- {
- X = Application.GetRealWidth(860),
- Width = Application.GetMinRealAverage(60),
- Height = Application.GetMinRealAverage(60),
- UnSelectedImagePath = "ZigeeLogic/selected.png",
- Visible = false,
- Gravity = Gravity.CenterVertical,
-
- };
- doorlockRow.AddChidren(doorlockSelected);
- if ((user.UserIdMode.Count - 1) == i)
- {
- doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
- }
- EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) =>
- {
- SelectedDeviceStatuscondition = "DoorLock";
- selectedIcon.Visible = false;
- selectedIcon = doorlockSelected;
- doorlockSelected.Visible = true;
- userId = userifon.UserId;
- openMode = userifon.OpenMode.ToString();
- accountname = Btntitle.Text + doorlockBtn.Text;
- //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
- };
- doorlockRow.MouseUpEventHandler += doorlockclick;
- doorlockBtn.MouseUpEventHandler += doorlockclick;
- doorlockSelected.MouseUpEventHandler += doorlockclick;
- doorlockfra.MouseUpEventHandler += doorlockclick;
-
- if (edit && editdeviceConditionsInfo != null)
- {
-
- if (editdeviceConditionsInfo["AttriButeData2"] == userifon.UserId.ToString())
- {
- selectedIcon.Visible = false;
- selectedIcon = doorlockSelected;
- doorlockSelected.Visible = true;
- }
-
- }
-
- }
-
-
- Btncomplete.MouseUpEventHandler += (sender3, e3) =>
- {
- string userIdstr = "", openModestr="";
- var deviceConditionsInfo = new Dictionary<string, string>();
- var userdictionary = new Dictionary<string, string>();
- deviceConditionsInfo.Add("Type", "1");
- deviceConditionsInfo.Add("IsValid", "1");
- deviceConditionsInfo.Add("MacAddr", common.DeviceAddr);
- deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString());
- deviceConditionsInfo.Add("Cluster_ID", "64529");
- deviceConditionsInfo.Add("AttriButeData1", "2");
- deviceConditionsInfo.Add("Range", "0");
- deviceConditionsInfo.Add("AttriButeId", openMode);
- deviceConditionsInfo.Add("AttriButeData2", userId);
- userdictionary.Add("Account",accountname);
- userdictionary.Add("Type", "1");
- userdictionary.Add("UserId", userId);
- if (edit)
- {
- openModestr = editdeviceConditionsInfo["AttriButeId"];
- userIdstr = editdeviceConditionsInfo["AttriButeData2"];
- }
- else
- {
- openModestr = deviceConditionsInfo["AttriButeId"];
- userIdstr = deviceConditionsInfo["AttriButeData2"];
- }
- if (SelectedDeviceStatuscondition != "")
- {
- bool addConditions = false;
- bool addAccounts = false;
- for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
- {
- if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1")
- {
- if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString()))
- {
- if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == openModestr && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == userIdstr)
- {
- Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
- Common.Logic.CurrentLogic.Conditions.Insert(i, deviceConditionsInfo);
- addConditions = true;
- break;
- }
- }
- }
- }
- for (int j = 0; j < Common.Logic.CurrentLogic.Accounts.Count; j++)
- {
- if (Common.Logic.CurrentLogic.Accounts[j]["Type"] == "1")
- {
- if (Common.Logic.CurrentLogic.Accounts[j]["UserId"] == userIdstr)
- {
- Common.Logic.CurrentLogic.Accounts.RemoveAt(j);
- Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary);
- addAccounts = true;
- break;
- }
- }
- }
- if (!addConditions)
- {
- Common.Logic.CurrentLogic.Conditions.Add(deviceConditionsInfo);
- }
- if (!addAccounts)
- {
- Common.Logic.CurrentLogic.Accounts.Add(userdictionary);
- }
- }
- else
- {
- if (!edit)
- {
- var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
- Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
- Language.StringByID(MyInternationalizationString.complete));
- alert.Show();
- return;
- }
-
- }
- flMain.RemoveFromParent();
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
-
- };
+ User(user, common, editdeviceConditionsInfo);
};
userBtn.MouseUpEventHandler += useridclick;
@@ -403,7 +165,262 @@
userRow.MouseUpEventHandler += useridclick;
}
- }
+
+ }
+ /// <summary>
+ /// 褰撳墠鎴愬憳淇℃伅鐨勬柟娉�
+ /// </summary>
+ /// <param name="user"></param>
+ void User(Send.MembershipIfon user, CommonDevice common, Dictionary<string, string> editdeviceConditionsInfo)
+ {
+ var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+ this.AddChidren(flMain);
+ flMain.MouseUpEventHandler += (sender1, e1) =>
+ {
+ flMain.RemoveFromParent();
+ };
+
+ var lockcolorfra = new FrameLayout
+ {
+ Width = Application.GetRealWidth(1080),
+ Height = Application.GetRealHeight(100),
+ Y = Application.GetRealHeight(1920 - 100),
+ BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+ };
+ flMain.AddChidren(lockcolorfra);
+
+ var lockcolorfra1 = new FrameLayout
+ {
+
+ Width = Application.GetRealWidth(1080),
+ Height = Application.GetRealHeight(530),
+ Y = Application.GetRealHeight(1920 - 530),
+ BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+ Radius = (uint)Application.GetRealHeight(60),
+ };
+ flMain.AddChidren(lockcolorfra1);
+
+ #region -------鍙栨秷 瀹屾垚
+ var lockRow = new RowLayout
+ {
+ Height = Application.GetRealHeight(140),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+ };
+ lockcolorfra1.AddChidren(lockRow);
+ var Btncancel = new Button
+ {
+ TextID = MyInternationalizationString.cancel,
+ TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+ Height = Application.GetRealHeight(140),
+ Width = Application.GetRealWidth(200),
+ X = Application.GetRealWidth(80),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextSize = 14,
+ };
+ lockRow.AddChidren(Btncancel);
+ Btncancel.MouseUpEventHandler += (sender16, e16) =>
+ {
+ flMain.RemoveFromParent();
+ UserView.HomePage.Instance.ScrollEnabled = true;
+ };
+
+ var Btntitle = new Button
+ {
+ TextID = MyInternationalizationString.security,
+ TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
+ Height = Application.GetRealHeight(140),
+ Width = Application.GetRealWidth(320),
+ TextAlignment = TextAlignment.Center,
+ X = Btncancel.Right + Application.GetRealWidth(100),
+ TextSize = 16,
+ Text = user.UserName,
+ };
+ lockRow.AddChidren(Btntitle);
+ var Btncomplete = new Button
+ {
+ TextID = MyInternationalizationString.complete,
+ TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
+ Height = Application.GetRealHeight(140),
+ Width = Application.GetRealWidth(200),
+ TextAlignment = TextAlignment.CenterRight,
+ X = Btntitle.Right + Application.GetRealWidth(100),
+ TextSize = 14,
+
+ };
+ lockRow.AddChidren(Btncomplete);
+ #endregion
+ ///瀹氫袱涓彉閲忚褰曚箣鍓嶇殑鍙�硷紱
+ string userId = "";
+ string openMode = "";
+ string accountname = "";
+ string SelectedDeviceStatuscondition = "";
+ lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50);
+ lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50);
+ for (int i = 0; i < user.UserIdMode.Count; i++)
+ {
+ var userifon = user.UserIdMode[i];
+ var doorlockfra = new FrameLayout
+ {
+ Height = Application.GetRealHeight(160),
+ Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * i),
+ };
+ lockcolorfra1.AddChidren(doorlockfra);
+
+ var doorlockRow = new RowLayout
+ {
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(920),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(80),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+ };
+ doorlockfra.AddChidren(doorlockRow);
+
+ var doorlockBtn = new Button
+ {
+ Width = Application.GetRealWidth(600),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
+ Text = userifon.ModeName,
+ TextSize = 14,
+ };
+ doorlockRow.AddChidren(doorlockBtn);
+
+ var doorlockSelected = new Button
+ {
+ X = Application.GetRealWidth(860),
+ Width = Application.GetMinRealAverage(60),
+ Height = Application.GetMinRealAverage(60),
+ UnSelectedImagePath = "ZigeeLogic/selected.png",
+ Visible = false,
+ Gravity = Gravity.CenterVertical,
+
+ };
+ doorlockRow.AddChidren(doorlockSelected);
+ if ((user.UserIdMode.Count - 1) == i)
+ {
+ doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
+ }
+ EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) =>
+ {
+ SelectedDeviceStatuscondition = "DoorLock";
+ selectedIcon.Visible = false;
+ selectedIcon = doorlockSelected;
+ doorlockSelected.Visible = true;
+ userId = userifon.UserId;
+ openMode = userifon.OpenMode.ToString();
+ accountname = Btntitle.Text + doorlockBtn.Text;
+ //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+ };
+ doorlockRow.MouseUpEventHandler += doorlockclick;
+ doorlockBtn.MouseUpEventHandler += doorlockclick;
+ doorlockSelected.MouseUpEventHandler += doorlockclick;
+ doorlockfra.MouseUpEventHandler += doorlockclick;
+
+ if (edit && editdeviceConditionsInfo != null)
+ {
+
+ if (editdeviceConditionsInfo["AttriButeData2"] == userifon.UserId.ToString())
+ {
+ selectedIcon.Visible = false;
+ selectedIcon = doorlockSelected;
+ doorlockSelected.Visible = true;
+ }
+
+ }
+
+ }
+ Btncomplete.MouseUpEventHandler += (sender3, e3) =>
+ {
+ string userIdstr = "", openModestr = "";
+ var deviceConditionsInfo = new Dictionary<string, string>();
+ var userdictionary = new Dictionary<string, string>();
+ deviceConditionsInfo.Add("Type", "1");
+ deviceConditionsInfo.Add("IsValid", "1");
+ deviceConditionsInfo.Add("MacAddr", common.DeviceAddr);
+ deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString());
+ deviceConditionsInfo.Add("Cluster_ID", "64529");
+ deviceConditionsInfo.Add("AttriButeData1", "2");
+ deviceConditionsInfo.Add("Range", "0");
+ deviceConditionsInfo.Add("AttriButeId", openMode);
+ deviceConditionsInfo.Add("AttriButeData2", userId);
+ userdictionary.Add("Account", accountname);
+ userdictionary.Add("Type", "1");
+ userdictionary.Add("UserId", userId);
+ if (edit)
+ {
+ openModestr = editdeviceConditionsInfo["AttriButeId"];
+ userIdstr = editdeviceConditionsInfo["AttriButeData2"];
+ }
+ else
+ {
+ openModestr = deviceConditionsInfo["AttriButeId"];
+ userIdstr = deviceConditionsInfo["AttriButeData2"];
+ }
+ if (SelectedDeviceStatuscondition != "")
+ {
+ bool addConditions = false;
+ bool addAccounts = false;
+ for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
+ {
+ if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1")
+ {
+ if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString()))
+ {
+ if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == openModestr && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == userIdstr)
+ {
+ Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
+ Common.Logic.CurrentLogic.Conditions.Insert(i, deviceConditionsInfo);
+ addConditions = true;
+ break;
+ }
+ }
+ }
+ }
+ for (int j = 0; j < Common.Logic.CurrentLogic.Accounts.Count; j++)
+ {
+ if (Common.Logic.CurrentLogic.Accounts[j]["Type"] == "1")
+ {
+ if (Common.Logic.CurrentLogic.Accounts[j]["UserId"] == userIdstr)
+ {
+ Common.Logic.CurrentLogic.Accounts.RemoveAt(j);
+ Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary);
+ addAccounts = true;
+ break;
+ }
+ }
+ }
+ if (!addConditions)
+ {
+ Common.Logic.CurrentLogic.Conditions.Add(deviceConditionsInfo);
+ }
+ if (!addAccounts)
+ {
+ Common.Logic.CurrentLogic.Accounts.Add(userdictionary);
+ }
+ }
+ else
+ {
+ if (!edit)
+ {
+ var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
+ Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
+ Language.StringByID(MyInternationalizationString.complete));
+ alert.Show();
+ return;
+ }
+
+ }
+ flMain.RemoveFromParent();
+ var logicCommunalPage = new LogicCommunalPage();
+ UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+ UserView.HomePage.Instance.PageIndex += 1;
+ logicCommunalPage.Show(() => { });
+
+ };
+
+
+ }
}
}
--
Gitblit v1.8.0