From 351bdda734832d821a9764b0cde8be5d83c4ec50 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 01 十二月 2022 09:56:25 +0800
Subject: [PATCH] 2022年12月01日09:56:23
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs | 290 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 145 insertions(+), 145 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs
old mode 100755
new mode 100644
index 9e242ab..c933c36
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs
@@ -1,21 +1,21 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-using ZigBee.Device;
-
-namespace Shared.Phone.UserCenter
-{
- /// <summary>
- /// 璁惧閫夋嫨鐨勭晫闈�
- /// </summary>
- public class SelectDeviceForm : EditorCommonForm
- {
- #region 鈻� 鍙橀噺澹版槑___________________________
-
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter
+{
+ /// <summary>
+ /// 璁惧閫夋嫨鐨勭晫闈�
+ /// </summary>
+ public class SelectDeviceForm : EditorCommonForm
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
/// <summary>
/// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝浼氬厛鍏抽棴鐣岄潰鍐嶆墽琛屽洖璋冩柟娉�,涓嶢ctionSelectDeviceEx涓嶅叡瀛�)
/// </summary>
- public Action<List<CommonDevice>> ActionSelectDevice = null;
+ public Action<List<CommonDevice>> ActionSelectDevice = null;
/// <summary>
/// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝涓嶄細鍏抽棴鐣岄潰,涓嶢ctionSelectDevice涓嶅叡瀛�,鍏抽棴鐣岄潰璇疯皟鐢–loseForm鍑芥暟)
/// </summary>
@@ -23,97 +23,97 @@
/// <summary>
/// 鍒楄〃鎺т欢
/// </summary>
- private VerticalListControl listView = null;
- /// <summary>
- /// 鍓嶅洖閫夋嫨鐨勮
- /// </summary>
- private DeviceSelectControl oldSelectRow = null;
-
+ private VerticalListControl listView = null;
+ /// <summary>
+ /// 鍓嶅洖閫夋嫨鐨勮
+ /// </summary>
+ private DeviceSelectControl oldSelectRow = null;
+
#endregion
-
+
#region 鈻� 鍒濆鍖朹____________________________
-
- /// <summary>
- /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
- /// </summary>
- /// <param name="i_listShowDevice">闇�瑕佹樉绀鸿澶囧垪琛�(鏈変簺鐣岄潰闇�瑕佸墧闄や竴浜涗笉瑕佺殑璁惧)</param>
- /// <param name="i_listSelectDevice">鎸囧畾鍝簺璁惧鐨勫垵濮嬬姸鎬佷负閫変腑鐘舵��(璁惧鐨勪富閿�)</param>
+
+ /// <summary>
+ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+ /// </summary>
+ /// <param name="i_listShowDevice">闇�瑕佹樉绀鸿澶囧垪琛�(鏈変簺鐣岄潰闇�瑕佸墧闄や竴浜涗笉瑕佺殑璁惧)</param>
+ /// <param name="i_listSelectDevice">鎸囧畾鍝簺璁惧鐨勫垵濮嬬姸鎬佷负閫変腑鐘舵��(璁惧鐨勪富閿�)</param>
/// <param name="SelcetCancel">鍒濆閫変腑鐘舵�佺殑璁惧鑳藉惁鍙栨秷 true:鍙互 false:涓嶅厑璁�</param>
/// <param name="SelectOnlyOne">鏄惁鍙兘閫夋嫨涓�涓� true:鍙兘閫夋嫨涓�涓� false:鍙互澶氶��</param>
public void ShowForm(List<CommonDevice> i_listShowDevice, List<string> i_listSelectDevice, bool SelcetCancel = true, bool SelectOnlyOne = false)
{
//璁剧疆鏍囬淇℃伅
- base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uSelectDevice));
-
- //鍒濆鍖栦腑閮ㄤ俊鎭�
- this.InitMiddleFrame(i_listShowDevice, i_listSelectDevice, SelcetCancel, SelectOnlyOne);
- }
-
- /// <summary>
- /// 鍒濆鍖栦腑閮ㄤ俊鎭�
- /// </summary>
- private void InitMiddleFrame(List<CommonDevice> i_listShowDevice, List<string> i_listSelectDevice, bool SelcetCancel, bool SelectOnlyOne)
- {
- //娓呯┖bodyFrame
- this.ClearBodyFrame();
+ base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uSelectDevice));
- if (i_listShowDevice.Count == 0)
- {
- //娌℃湁鍙坊鍔犵殑鐩爣
- this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotHadAddTarget));
- return;
+ //鍒濆鍖栦腑閮ㄤ俊鎭�
+ this.InitMiddleFrame(i_listShowDevice, i_listSelectDevice, SelcetCancel, SelectOnlyOne);
+ }
+
+ /// <summary>
+ /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+ /// </summary>
+ private void InitMiddleFrame(List<CommonDevice> i_listShowDevice, List<string> i_listSelectDevice, bool SelcetCancel, bool SelectOnlyOne)
+ {
+ //娓呯┖bodyFrame
+ this.ClearBodyFrame();
+
+ if (i_listShowDevice.Count == 0)
+ {
+ //娌℃湁鍙坊鍔犵殑鐩爣
+ this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotHadAddTarget));
+ return;
}
listView = new VerticalListControl(29);
listView.Y = Application.GetRealHeight(-6);
listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
listView.BackgroundColor = UserCenterColor.Current.White;
- bodyFrameLayout.AddChidren(listView);
-
- //娣诲姞鎵�鏈夎澶囪
+ bodyFrameLayout.AddChidren(listView);
+
+ //娣诲姞鎵�鏈夎澶囪
HdlThreadLogic.Current.RunMainInThread(() =>
- {
- int count = i_listShowDevice.Count - 1;
- for (int i = 0; i < i_listShowDevice.Count; i++)
- {
- //娣诲姞鏄庣粏琛�
- this.AddDeviceRow(i_listShowDevice[i], i_listSelectDevice, SelcetCancel, SelectOnlyOne, i != count);
- }
- //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
- listView.AdjustRealHeight(Application.GetRealHeight(23));
- });
-
- //瀹屾垚
- var btnfinish = new BottomClickButton();
- btnfinish.TextID = R.MyInternationalizationString.uFinish;
+ {
+ int count = i_listShowDevice.Count - 1;
+ for (int i = 0; i < i_listShowDevice.Count; i++)
+ {
+ //娣诲姞鏄庣粏琛�
+ this.AddDeviceRow(i_listShowDevice[i], i_listSelectDevice, SelcetCancel, SelectOnlyOne, i != count);
+ }
+ //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+ listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23), Application.GetRealHeight(6));
+ });
+
+ //瀹屾垚
+ var btnfinish = new BottomClickButton();
+ btnfinish.TextID = R.MyInternationalizationString.uFinish;
bodyFrameLayout.AddChidren(btnfinish);
btnfinish.ButtonClickEvent += (sender, e) =>
{
- List<CommonDevice> listDevice = this.GetListDeviceFromRow();
- if (ActionSelectDeviceEx != null)
- {
- ActionSelectDeviceEx(listDevice);
- return;
- }
-
+ List<CommonDevice> listDevice = this.GetListDeviceFromRow();
+ if (ActionSelectDeviceEx != null)
+ {
+ ActionSelectDeviceEx(listDevice);
+ return;
+ }
+
this.CloseForm();
if (ActionSelectDevice != null)
{
ActionSelectDevice(listDevice);
- ActionSelectDevice = null;
+ ActionSelectDevice = null;
}
};
- }
-
+ }
+
#endregion
-
+
#region 鈻� 娣诲姞璁惧琛宊________________________
- /// <summary>
- /// 娣诲姞璁惧琛�
- /// </summary>
- /// <param name="device">璁惧</param>
- /// <param name="i_listSelectDevice">鎸囧畾鍝簺璁惧鐨勫垵濮嬬姸鎬佷负閫変腑鐘舵��(璁惧鐨勪富閿�)</param>
+ /// <summary>
+ /// 娣诲姞璁惧琛�
+ /// </summary>
+ /// <param name="device">璁惧</param>
+ /// <param name="i_listSelectDevice">鎸囧畾鍝簺璁惧鐨勫垵濮嬬姸鎬佷负閫変腑鐘舵��(璁惧鐨勪富閿�)</param>
/// <param name="SelcetCancel">鍒濆閫変腑鐘舵�佺殑璁惧鑳藉惁鍙栨秷 true:鍙互 false:涓嶅厑璁�</param>
/// <param name="SelectOnlyOne">鏄惁鍙兘閫夋嫨涓�涓� true:鍙兘閫夋嫨涓�涓� false:鍙互澶氶��</param>
/// <param name="addLine">鏄惁娣诲姞搴曠嚎</param>
@@ -125,81 +125,81 @@
listView.AddChidren(row);
row.InitControl();
//搴曠嚎
- if (addLine == true)
- {
- row.AddBottomLine();
+ if (addLine == true)
+ {
+ row.AddBottomLine();
}
//璁剧疆閫夋嫨鐘舵��
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
if (i_listSelectDevice.Contains(mainKeys) == true)
- {
+ {
row.SelectCancel = SelcetCancel;
row.IsSelected = true;
- if (SelectOnlyOne == true)
- {
- oldSelectRow = row;
+ if (SelectOnlyOne == true)
+ {
+ oldSelectRow = row;
}
}
- if (SelectOnlyOne == true)
- {
- row.ButtonClickEvent += (sender, e) =>
- {
- //鍙栧弽
- row.IsSelected = !row.IsSelected;
- if (oldSelectRow != null && oldSelectRow.MainKeys != row.MainKeys)
- {
- oldSelectRow.IsSelected = false;
- oldSelectRow = null;
- }
- if (row.IsSelected == true)
- {
- oldSelectRow = row;
- }
- };
+ if (SelectOnlyOne == true)
+ {
+ row.ButtonClickEvent += (sender, e) =>
+ {
+ //鍙栧弽
+ row.IsSelected = !row.IsSelected;
+ if (oldSelectRow != null && oldSelectRow.MainKeys != row.MainKeys)
+ {
+ oldSelectRow.IsSelected = false;
+ oldSelectRow = null;
+ }
+ if (row.IsSelected == true)
+ {
+ oldSelectRow = row;
+ }
+ };
}
- }
-
+ }
+
#endregion
-
- #region 鈻� 鑾峰彇閫変腑璁惧_______________________
-
- /// <summary>
- /// 鑾峰彇閫変腑鐨勮澶�
- /// </summary>
+
+ #region 鈻� 鑾峰彇閫変腑璁惧_______________________
+
+ /// <summary>
+ /// 鑾峰彇閫変腑鐨勮澶�
+ /// </summary>
/// <returns></returns>
- private List<CommonDevice> GetListDeviceFromRow()
- {
- List<CommonDevice> listDevice = new List<CommonDevice>();
- for (int i = 0; ; i++)
- {
- var row = (DeviceSelectControl)this.listView.GetChildren(i);
- if (row == null)
- {
- break;
- }
- if (row.IsSelected == true)
- {
- listDevice.Add(row.device);
- }
- }
- return listDevice;
- }
-
- #endregion
-
- #region 鈻� 鐣岄潰鍏抽棴___________________________
-
- /// <summary>
- /// 鐣岄潰鍏抽棴
- /// </summary>
- public override void CloseForm()
- {
- ActionSelectDeviceEx = null;
-
- base.CloseForm();
- }
-
- #endregion
- }
-}
+ private List<CommonDevice> GetListDeviceFromRow()
+ {
+ List<CommonDevice> listDevice = new List<CommonDevice>();
+ for (int i = 0; i < this.listView.ChildrenCount; i++)
+ {
+ var myView = this.listView.GetChildren(i);
+ if (myView is DeviceSelectControl)
+ {
+ var row = (DeviceSelectControl)myView;
+ if (row.IsSelected == true)
+ {
+ listDevice.Add(row.device);
+ }
+ }
+ }
+ return listDevice;
+ }
+
+ #endregion
+
+ #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+ /// <summary>
+ /// 鐣岄潰鍏抽棴
+ /// </summary>
+ public override void CloseFormBefore()
+ {
+ ActionSelectDeviceEx = null;
+
+ base.CloseFormBefore();
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0