From 160785587667cc0d927f85e44c139ec9dde13a9e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 25 十一月 2019 14:30:13 +0800 Subject: [PATCH] 原来的 IOS 工程舍弃(注:没有合并其他组员的代码) --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs | 144 ++++++++++++++++++++++++------------------------ 1 files changed, 72 insertions(+), 72 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs index f42aa76..b906169 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/SelectDeviceForm.cs @@ -12,41 +12,41 @@ { #region 鈻� 鍙橀噺澹版槑___________________________ - /// <summary> - /// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝浼氬厛鍏抽棴鐣岄潰鍐嶆墽琛屽洖璋冩柟娉�,涓嶢ctionSelectDeviceEx涓嶅叡瀛�) - /// </summary> + /// <summary> + /// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝浼氬厛鍏抽棴鐣岄潰鍐嶆墽琛屽洖璋冩柟娉�,涓嶢ctionSelectDeviceEx涓嶅叡瀛�) + /// </summary> public Action<List<CommonDevice>> ActionSelectDevice = null; - /// <summary> - /// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝涓嶄細鍏抽棴鐣岄潰,涓嶢ctionSelectDevice涓嶅叡瀛�,鍏抽棴鐣岄潰璇疯皟鐢–loseForm鍑芥暟) - /// </summary> - public Action<List<CommonDevice>> ActionSelectDeviceEx = null; - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> + /// <summary> + /// 璁惧閫夋嫨纭畾鍚庣殑鍥炶皟鍑芥暟(姝ゅ嚱鏁板湪鐐瑰嚮纭鍚庯紝涓嶄細鍏抽棴鐣岄潰,涓嶢ctionSelectDevice涓嶅叡瀛�,鍏抽棴鐣岄潰璇疯皟鐢–loseForm鍑芥暟) + /// </summary> + public Action<List<CommonDevice>> ActionSelectDeviceEx = null; + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> private VerticalListControl listView = null; /// <summary> /// 鍓嶅洖閫夋嫨鐨勮 /// </summary> private DeviceSelectControl oldSelectRow = null; - #endregion + #endregion - #region 鈻� 鍒濆鍖朹____________________________ + #region 鈻� 鍒濆鍖朹____________________________ /// <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) - { - //璁剧疆鏍囬淇℃伅 + /// <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); + this.InitMiddleFrame(i_listShowDevice, i_listSelectDevice, SelcetCancel, SelectOnlyOne); } /// <summary> @@ -56,22 +56,22 @@ { //娓呯┖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; + } + + listView = new VerticalListControl(29); + listView.Y = Application.GetRealHeight(-6); + listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6); + listView.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(listView); //娣诲姞鎵�鏈夎澶囪 - HdlThreadLogic.Current.RunMainInThread(() => + HdlThreadLogic.Current.RunMainInThread(() => { int count = i_listShowDevice.Count - 1; for (int i = 0; i < i_listShowDevice.Count; i++) @@ -80,15 +80,15 @@ this.AddDeviceRow(i_listShowDevice[i], i_listSelectDevice, SelcetCancel, SelectOnlyOne, i != count); } //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� - listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23), Application.GetRealHeight(6)); + listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23), Application.GetRealHeight(6)); }); //瀹屾垚 var btnfinish = new BottomClickButton(); btnfinish.TextID = R.MyInternationalizationString.uFinish; - bodyFrameLayout.AddChidren(btnfinish); - btnfinish.ButtonClickEvent += (sender, e) => - { + bodyFrameLayout.AddChidren(btnfinish); + btnfinish.ButtonClickEvent += (sender, e) => + { List<CommonDevice> listDevice = this.GetListDeviceFromRow(); if (ActionSelectDeviceEx != null) { @@ -96,51 +96,51 @@ return; } - this.CloseForm(); - if (ActionSelectDevice != null) - { - ActionSelectDevice(listDevice); + this.CloseForm(); + if (ActionSelectDevice != null) + { + ActionSelectDevice(listDevice); ActionSelectDevice = null; - } - }; + } + }; } - #endregion + #endregion - #region 鈻� 娣诲姞璁惧琛宊________________________ - + #region 鈻� 娣诲姞璁惧琛宊________________________ + /// <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> - private void AddDeviceRow(CommonDevice device, List<string> i_listSelectDevice, bool SelcetCancel, bool SelectOnlyOne, bool addLine) - { - string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - var row = new DeviceSelectControl(device, SelectOnlyOne == false, listView.rowSpace / 2); - row.MainKeys = mainkeys; - listView.AddChidren(row); - row.InitControl(); - //搴曠嚎 + /// <param name="SelcetCancel">鍒濆閫変腑鐘舵�佺殑璁惧鑳藉惁鍙栨秷 true:鍙互 false:涓嶅厑璁�</param> + /// <param name="SelectOnlyOne">鏄惁鍙兘閫夋嫨涓�涓� true:鍙兘閫夋嫨涓�涓� false:鍙互澶氶��</param> + /// <param name="addLine">鏄惁娣诲姞搴曠嚎</param> + private void AddDeviceRow(CommonDevice device, List<string> i_listSelectDevice, bool SelcetCancel, bool SelectOnlyOne, bool addLine) + { + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + var row = new DeviceSelectControl(device, SelectOnlyOne == false, listView.rowSpace / 2); + row.MainKeys = mainkeys; + listView.AddChidren(row); + row.InitControl(); + //搴曠嚎 if (addLine == true) { row.AddBottomLine(); - } - - //璁剧疆閫夋嫨鐘舵�� - string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - if (i_listSelectDevice.Contains(mainKeys) == true) + } + + //璁剧疆閫夋嫨鐘舵�� + string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + if (i_listSelectDevice.Contains(mainKeys) == true) { - row.SelectCancel = SelcetCancel; - row.IsSelected = true; + row.SelectCancel = SelcetCancel; + row.IsSelected = true; if (SelectOnlyOne == true) { oldSelectRow = row; - } - } + } + } if (SelectOnlyOne == true) { row.ButtonClickEvent += (sender, e) => @@ -157,30 +157,30 @@ oldSelectRow = row; } }; - } + } } - #endregion + #endregion #region 鈻� 鑾峰彇閫変腑璁惧_______________________ /// <summary> /// 鑾峰彇閫変腑鐨勮澶� /// </summary> - /// <returns></returns> + /// <returns></returns> private List<CommonDevice> GetListDeviceFromRow() { List<CommonDevice> listDevice = new List<CommonDevice>(); - for (int i = 0; ; i++) + for (int i = 0; i < this.listView.ChildrenCount; i++) { - var row = (DeviceSelectControl)this.listView.GetChildren(i); - if (row == null) + var myView = this.listView.GetChildren(i); + if (myView is DeviceSelectControl) { - break; - } - if (row.IsSelected == true) - { - listDevice.Add(row.device); + var row = (DeviceSelectControl)myView; + if (row.IsSelected == true) + { + listDevice.Add(row.device); + } } } return listDevice; @@ -193,11 +193,11 @@ /// <summary> /// 鐣岄潰鍏抽棴 /// </summary> - public override void CloseForm() + public override void CloseFormBefore() { ActionSelectDeviceEx = null; - base.CloseForm(); + base.CloseFormBefore(); } #endregion -- Gitblit v1.8.0