From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 30 九月 2019 13:22:40 +0800 Subject: [PATCH] 合并了徐梅的按键面板绑定 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 1160 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 582 insertions(+), 578 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index f8540ac..84aa6f9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -1,269 +1,471 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Shared.Common; -using Shared.Phone.UserView; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.Device -{ - /// <summary> - /// 缂栬緫璁惧鐨勪俊鎭�(杩欓噷淇敼鐨勬槸MAC鍚�,杩欎釜鐢婚潰浼氭洿鏀筂AC鐨勭墿鐞嗗悕瀛�) - /// </summary> - public class DeviceMacInfoEditorForm : UserCenterCommonForm, ZigBee.Common.IStatus - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 鐢婚潰姝e父鍏抽棴鐨勫洖璋冨嚱鏁� - /// </summary> - public Action<string> ActionFormClose = null; - /// <summary> - /// 璁惧瀵硅薄 - /// </summary> - private List<CommonDevice> listNewDevice = null; - /// <summary> - /// 璁剧疆绐楀笜缁翠慨妯″紡Btn - /// </summary> - private SwichControl switchBtn = null; - /// <summary> - /// 鑾峰彇寰楀埌浜嗛暅鍍忎俊鎭� - /// </summary> - private bool receiveImageInfo = false; +锘縰sing System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Shared.Common; +using Shared.Phone.UserView; +using ZigBee.Device; - #endregion +namespace Shared.Phone.UserCenter.Device +{ + /// <summary> + /// 缂栬緫璁惧鐨勪俊鎭�(杩欓噷淇敼鐨勬槸MAC鍚�,杩欎釜鐢婚潰浼氭洿鏀筂AC鐨勭墿鐞嗗悕瀛�) + /// </summary> + public class DeviceMacInfoEditorForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧瀵硅薄 + /// </summary> + private List<CommonDevice> listNewDevice = null; + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listview = null; + /// <summary> + /// 璁惧鐨勮澶囩被鍨� + /// </summary> + private HashSet<DeviceType> listDeviceType = new HashSet<DeviceType>(); + /// <summary> + /// 璁惧鍏蜂綋绫诲瀷鐨勪俊鎭� + /// </summary> + private DeviceEnumInfo deviceEnumInfo = null; + + #endregion #region 鈻� 鍒濆鍖朹____________________________ - /// <summary> - /// 鏋勯�犳柟娉� - /// </summary> - public DeviceMacInfoEditorForm() - { - ZbGateway.StatusList.Add(this); - } - /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="listdevices">璁惧鍒楄〃</param> - public void ShowForm(List<CommonDevice> listdevices) - { - this.listNewDevice = listdevices; - - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceInfo)); - - //鍒濆鍖栧垹闄よ澶囩殑鐣岄潰(鍙充笂) - this.InitDeleteDeviceForm(); - - new System.Threading.Thread(() => + /// <param name="deviceMac">璁惧mac鍦板潃</param> + public void ShowForm(string deviceMac) + { + this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + //鎺掑簭 + this.listNewDevice.Sort((obj1, obj2) => { - //閲嶆柊鑾峰彇纭欢淇℃伅 - this.RefreshHardFirmwareInfo(); - Application.RunOnMainThread(() => + if (obj1.DeviceEpoint > obj2.DeviceEpoint) { - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - }); - }) - { IsBackground = true }.Start(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - private void InitMiddleFrame() - { - this.bodyFrameLayout.RemoveAll(); - - //璁惧鍥剧墖 - var btnpictrue = new PicViewControl(510, 320); - btnpictrue.Gravity = Gravity.CenterHorizontal; - btnpictrue.Y = Application.GetRealHeight(100); - Common.LocalDevice.Current.SetRealDeviceIconToControl(btnpictrue, listNewDevice); - bodyFrameLayout.AddChidren(btnpictrue); - - var listview = new VerticalScrolViewLayout(); - listview.Y = btnpictrue.Bottom + Application.GetRealHeight(100); - listview.Height = bodyFrameLayout.Height - btnpictrue.Bottom - Application.GetRealHeight(100); - bodyFrameLayout.AddChidren(listview); - - //鐢熶骇鍟嗗悕绉� - var row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnManuView = new RowTopGrayView(false); - btnManuView.TextID = R.MyInternationalizationString.uManufacturerName; - row.AddChidren(btnManuView); - var btnManu = new RowBottomBlackView(false); - btnManu.Text = listNewDevice[0].ManufacturerName; - if (string.IsNullOrEmpty(btnManu.Text) == true) - { - if (listNewDevice[0].DriveCode > 0) - { - //铏氭嫙璁惧鍥哄畾浣跨敤HDL - listNewDevice[0].ManufacturerName = "HDL"; - listNewDevice[0].ReSave(); - btnManu.Text = "HDL"; + return 1; } + return -1; + }); + + this.listDeviceType.Clear(); + foreach (var device in listNewDevice) + { + //鏀堕泦璁惧绫诲瀷 + this.listDeviceType.Add(device.Type); } - row.AddChidren(btnManu); + //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 + this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice); - //璁惧鍨嬪彿 - row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnModelIdView = new RowTopGrayView(false); - btnModelIdView.TextID = R.MyInternationalizationString.uModelIdentifier; - row.AddChidren(btnModelIdView); - var btnModelId = new RowBottomBlackView(false); - btnModelId.Text = listNewDevice[0].ModelIdentifier; - row.AddChidren(btnModelId); + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceInfo)); - //搴忓垪鍙� - row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnSerialView = new RowTopGrayView(false); - btnSerialView.TextID = R.MyInternationalizationString.uSerialNumber; - row.AddChidren(btnSerialView); - var btnSerial = new RowBottomBlackView(false); - btnSerial.Text = listNewDevice[0].SerialNumber; - if (string.IsNullOrEmpty(btnSerial.Text) == true) - { - btnSerial.Text = listNewDevice[0].DeviceAddr; - } - row.AddChidren(btnSerial); + //鍒濆鍖栧彸涓婅鑿滃崟 + this.InitTopRightMenu(); - //浜у搧鍚嶇О - string caption = Language.StringByID(R.MyInternationalizationString.uProductName); - string nameValue = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); - var btnDeviceView = new EditorNameValueRow(caption, nameValue); - listview.AddChidren(btnDeviceView); - btnDeviceView.InitControl(); - //璇疯緭鍏ヤ骇鍝佸悕绉� - btnDeviceView.SetEmptyNameTip(Language.StringByID(R.MyInternationalizationString.uProductNameMastInput)); - //缂栬緫浜у搧鍚嶇О - btnDeviceView.SetDialogTitle(Language.StringByID(R.MyInternationalizationString.uEditorProductName)); - btnDeviceView.ActionNameChangedEvent += (deviceName) => - { - //璁惧閲嶅懡鍚嶇劧鍚庢墦寮�鏂扮殑鐢婚潰 - this.DeviceReName(deviceName); - }; + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); - //鍙湁鏄渤涓滅殑璁惧鐨勬椂鍊� - if (Common.LocalDevice.Current.IsHdlDevice(listNewDevice[0]) == true) - { - //娣诲姞銆愯儗鍏夎缃�戣 - this.AddBackLightRow(listview); - - //娣诲姞 銆愭柟鍚戜笌闄愪綅銆戣 - this.AddDirectionLimitRow(listview); - - //娣诲姞 銆愮淮鎶ゆā寮忋�戣 - this.AddMaintenanceModeRow(listview); - - //娣诲姞銆愬浐浠朵俊鎭�戣 - this.AddFirmwareVersionRow(listview); - } + //閲嶆柊鑾峰彇纭欢淇℃伅 + this.RefreshHardFirmwareInfo(); } - #endregion - - #region 鈻� 纭欢淇℃伅___________________________ - /// <summary> - /// 閲嶆柊鑾峰彇纭欢淇℃伅 + /// 鍒濆鍖栦腑閮ㄦ帶浠� /// </summary> - private void RefreshHardFirmwareInfo() + private void InitMiddleFrame() { - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); + //娓呯┖bodyFrame + this.ClearBodyFrame(); - bool isReceive = false; - //閲嶆柊鑾峰彇纭欢淇℃伅 - Common.LocalDevice.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0], true, (device, reportData) => + //鍒濆鍖栨甯� + this.InitFrameTable(); + + //鍥剧墖 + var btnPic = new DeviceInfoIconControl(listNewDevice[0]); + btnPic.Y = Application.GetRealHeight(92); + btnPic.Gravity = Gravity.CenterHorizontal; + bodyFrameLayout.AddChidren(btnPic); + btnPic.InitControl(); + + //璁惧澶囨敞 + string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote); + string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); + var btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2); + listview.AddChidren(btnNote); + btnNote.InitControl(); + //鍒掔嚎 + btnNote.AddBottomLine(); + btnNote.txtInput.FinishInputEvent += () => { - for (int i = 1; i < listNewDevice.Count; i++) + string oldName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); + if (btnNote.Text.Trim() == string.Empty) { - //鍏ㄩ儴鍥炶矾鐨勪俊鎭兘鏄竴鑷寸殑 - DeviceAttributeLogic.Current.SetHardFirmwareInfo(device.DeviceStatusReport, listNewDevice[i]); - listNewDevice[i].ReSave(); + btnNote.Text = oldName; } - isReceive = true; - }); - int count = 20; - while (isReceive == false && count > 0) + if (oldName != btnNote.Text.Trim()) + { + //淇敼鍚嶅瓧 + this.DeviceReName(btnNote.Text.Trim(), false); + } + }; + + //璁惧绫诲瀷 + caption = Language.StringByID(R.MyInternationalizationString.uDeviceType); + deviceName = Common.LocalDevice.Current.GetDeviceObjectText(listNewDevice); + var btnType = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2); + btnType.UseClickStatu = false; + listview.AddChidren(btnType); + btnType.InitControl(); + //鍒掔嚎 + btnType.AddBottomLine(); + + //娣诲姞鍏ㄩ儴鑿滃崟 + this.AddAllMenuRow(); + + //淇濆瓨 + var btnFinish = new BottomClickButton(); + //鍊熺敤Y杞村潗鏍�(璁╄繖涓尯鍩熶笉鑳界偣鍑昏彍鍗�) + var frameBack = new FrameLayout(); + frameBack.Y = btnFinish.Yaxis; + frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis; + bodyFrameLayout.AddChidren(frameBack); + + btnFinish.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnFinish); + btnFinish.ButtonClickEvent += (sender, e) => { - //绛夊緟璁惧闀滃儚鐨勫弽棣� - System.Threading.Thread.Sleep(100); - count--; - } - if (count <= 0) + string oldName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); + if (btnNote.Text.Trim() == string.Empty) + { + btnNote.Text = oldName; + } + if (oldName != btnNote.Text.Trim()) + { + //淇敼鍚嶅瓧 + this.DeviceReName(btnNote.Text.Trim(), true); + } + else + { + //鍏抽棴鑷韩 + this.CloseForm(); + } + }; + + var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount; + if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height) { - //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋� - Common.LocalDevice.Current.RemoveDeviceHardInfoThread(listNewDevice[0]); + //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩 + var frameTemp = new FrameLayout(); + frameTemp.Height = frameBack.Height + Application.GetRealHeight(115); + listview.AddChidren(frameTemp); } - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); } #endregion - #region 鈻� 鑳屽厜璁剧疆___________________________ + #region 鈻� 鍒濆鍖栨甯僟________________________ /// <summary> - /// 娣诲姞銆愯儗鍏夎缃�戣 + /// 鍒濆鍖栨甯� /// </summary> - /// <param name="listview"></param> - private void AddBackLightRow(VerticalScrolViewLayout listview) + private void InitFrameTable() { - bool canAddRow = false; - foreach (var device in listNewDevice) + //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾) + int halfRoundHeigth = Application.GetRealHeight(116) / 2; + //寮у害鐨勫渾 + var btnRound = new NormalViewControl(bodyFrameLayout.Width, halfRoundHeigth * 2, false); + btnRound.Y = Application.GetRealHeight(369); + btnRound.BackgroundColor = UserCenterColor.Current.White; + btnRound.Radius = (uint)halfRoundHeigth; + bodyFrameLayout.AddChidren(btnRound); + //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瑕嗙洊寮у害鐨勫渾鐨勫崐杈�) + var detailBackFrame = new FrameLayout(); + detailBackFrame.Y = btnRound.Bottom - btnRound.Height / 2; + detailBackFrame.Height = Application.GetRealHeight(1368);//楂樺害灏辨槸瑕佸畠瓒呰繃 + detailBackFrame.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(detailBackFrame); + + //淇℃伅缂栬緫 + var btnTile = new NormalViewControl(800, 60, true); + btnTile.X = ControlCommonResourse.XXLeft; + btnTile.TextSize = 15; + btnTile.TextColor = UserCenterColor.Current.TextColor2; + btnTile.TextID = R.MyInternationalizationString.uInfoEditor; + detailBackFrame.AddChidren(btnTile); + + this.listview = new VerticalListControl(12); + listview.Y = btnTile.Bottom + Application.GetRealHeight(17); + listview.Height = Application.GetRealHeight(1368) - halfRoundHeigth - btnTile.Bottom - Application.GetRealHeight(17); + detailBackFrame.AddChidren(listview); + } + + #endregion + + #region 鈻� 娣诲姞鑿滃崟___________________________ + + /// <summary> + /// 娣诲姞鍏ㄩ儴鑿滃崟 + /// </summary> + private void AddAllMenuRow() + { + bool isHdlDevice = Common.LocalDevice.Current.IsHdlDevice(listNewDevice[0]); + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣) { - if (device.Type == DeviceType.OnOffSwitch) + //鍙湁鏄渤涓滅殑璁惧鐨勬椂鍊� + if (isHdlDevice == true) { - canAddRow = true; - break; + //娣诲姞銆愮敤鎴风鐞嗐�戣 + this.AddUserManageRow(); + //娣诲姞銆愯繙绋嬪紑閿併�戣 + this.AddRemoteUnLocksRow(); + //娣诲姞銆愰棬閿佹椂闂淬�戣 + this.AddDoorLocksTimeRow(); } } - if (canAddRow == false) + else { - //蹇呴』鏈変竴璺洖璺槸OnOffSwitch鎵嶈 - return; + //娣诲姞銆愭寜閿缃�戣(闈㈡澘涓撶敤) + this.AddPanelSettionRow(); + //娣诲姞銆愬姛鑳借缃�戣 + this.AddFunctionSettionRow(); + //娣诲姞銆愬共鎺ョ偣璁剧疆銆戣 + this.AddDryContactSettionRow(); } + //娣诲姞銆愰�氱敤淇℃伅銆戣 + this.AddGeneralInformationRow(); - //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 - var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice); - //濡傛灉鏄帶鍒堕潰鏉� - if (myDeviceType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 || myDeviceType.BeloneType == DeviceBeloneType.A璋冨厜鍣�) + if (isHdlDevice == true) { - //鑳屽厜璁剧疆 - var statuRowLight = new StatuRowLayout(listview); + //娣诲姞銆愬浐浠跺崌绾с�戣 + this.AddFirmwareUpdateRow(); + } + } - var btnBackLight = new RowCenterView(false); - btnBackLight.TextID = R.MyInternationalizationString.uBackLightSettion; - statuRowLight.AddChidren(btnBackLight); - //鑳屽厜璁剧疆鍚戝彸鐨勫浘鏍� - statuRowLight.AddRightIconControl(); - statuRowLight.MouseUpEvent += (sender, e) => + #endregion + + #region 鈻� 鐢ㄦ埛绠$悊(闂ㄩ攣)_____________________ + + /// <summary> + /// 娣诲姞銆愮敤鎴风鐞嗐�戣锛堥棬閿佷笓鐢級 + /// </summary> + private void AddUserManageRow() + { + //濡傛灉鏄櫤鑳介棬閿� + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣) + { + //鐢ㄦ埛绠$悊 + string caption = Language.StringByID(R.MyInternationalizationString.uUserManage); + var btnRow = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnRow); + btnRow.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnRow.AddRightArrow(); + //搴曠嚎 + btnRow.AddBottomLine(); + btnRow.ButtonClickEvent += (sender, e) => { - var form = new DevicePanel.PanelBackLightSettionForm(); - this.AddForm(form, listNewDevice); }; } } - #endregion + #endregion - #region 鈻� 鍥轰欢淇℃伅___________________________ + #region 鈻� 杩滅▼寮�閿�(闂ㄩ攣)_____________________ /// <summary> - /// 娣诲姞銆愬浐浠朵俊鎭�戣 + /// 娣诲姞銆愯繙绋嬪紑閿併�戣锛堥棬閿佷笓鐢級 /// </summary> - /// <param name="listview"></param> - private void AddFirmwareVersionRow(VerticalScrolViewLayout listview) + private void AddRemoteUnLocksRow() + { + //濡傛灉鏄櫤鑳介棬閿� + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣) + { + //杩滅▼寮�閿� + string caption = Language.StringByID(R.MyInternationalizationString.uRemoteUnLocks); + var btnRow = new FrameRowControl(listview.rowSpace / 2); + btnRow.UseClickStatu = false; + listview.AddChidren(btnRow); + btnRow.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + var btnswitch = btnRow.AddMostRightEmptyIcon(104, 63); + btnRow.ChangedChidrenBindMode(btnswitch, ChidrenBindMode.NotBind); + btnswitch.UnSelectedImagePath = "Item/Switch.png"; + btnswitch.SelectedImagePath = "Item/SwitchSelected.png"; + //搴曠嚎 + btnRow.AddBottomLine(); + + btnswitch.ButtonClickEvent += (sender, e) => + { + btnswitch.IsSelected = !btnswitch.IsSelected; + }; + } + } + + #endregion + + #region 鈻� 闂ㄩ攣鏃堕棿(闂ㄩ攣)_____________________ + + /// <summary> + /// 娣诲姞銆愰棬閿佹椂闂淬�戣锛堥棬閿佷笓鐢級 + /// </summary> + private void AddDoorLocksTimeRow() + { + //濡傛灉鏄櫤鑳介棬閿� + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣) + { + //闂ㄩ攣鏃堕棿 + string caption = Language.StringByID(R.MyInternationalizationString.uDoorLocksTime); + var btnRow = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnRow); + btnRow.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnRow.AddRightArrow(); + //搴曠嚎 + btnRow.AddBottomLine(); + btnRow.ButtonClickEvent += (sender, e) => + { + }; + } + } + + #endregion + + #region 鈻� 鎸夐敭璁剧疆(闈㈡澘)_____________________ + + /// <summary> + /// 娣诲姞銆愭寜閿缃�戣 + /// </summary> + private void AddPanelSettionRow() + { + //蹇呴』鏄渤涓滆澶�,蹇呴』鏄潰鏉匡紝骞朵笖鏈夊共鎺ョ偣鎵嶈 + if (deviceEnumInfo.IsHdlDevice == false || deviceEnumInfo.BeloneType != DeviceBeloneType.A鎸夐敭闈㈡澘 || listDeviceType.Contains(DeviceType.OnOffSwitch) == false) + { + return; + } + //鎸夐敭璁剧疆 + string caption = Language.StringByID(R.MyInternationalizationString.uPanelSettion); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + var form = new DevicePanel.PanelButtonSettionForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + }; + } + + #endregion + + #region 鈻� 鍔熻兘璁剧疆(閫氱敤)_____________________ + + /// <summary> + /// 娣诲姞銆愬姛鑳借缃�戣 + /// </summary> + private void AddFunctionSettionRow() + { + //鍔熻兘璁剧疆 + string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + //娌充笢鐨勯潰鏉胯澶� + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 && deviceEnumInfo.IsHdlDevice == true) + { + var form = new DevicePanel.PanelFunctionSettionForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + } + else + { + var form = new DeviceRelay.DeviceFunctionSettionForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + } + }; + } + + #endregion; + + #region 鈻� 骞叉帴鐐硅缃�(骞叉帴鐐�)_________________ + + /// <summary> + /// 娣诲姞銆愬共鎺ョ偣璁剧疆銆戣 + /// </summary> + private void AddDryContactSettionRow() + { + if (this.listDeviceType.Contains(DeviceType.OnOffSwitch) == false) + { + //蹇呴』鏈変竴璺洖璺槸OnOffSwitch鎵嶈,闈㈡澘鐨勫共鎺ョ偣鐨勮瘽锛屼娇鐢ㄧ殑鏄埆鐨勮彍鍗� + return; + } + if (deviceEnumInfo.IsHdlDevice == true && deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘) + { + //娌充笢鐨勯潰鏉跨殑璇濓紝瀹冩湁鑷繁鐨勯厤缃晫闈�, + //濡傛灉鏄涓夋柟璁惧鐨勮瘽锛屼娇鐢ㄦ櫘閫氬共鎺ョ偣鐣岄潰(瀹冭兘浣跨敤缁戝畾鍔熻兘,鏃犺儗鍏夎缃�) + return; + } + + //骞叉帴鐐硅缃� + string caption = Language.StringByID(R.MyInternationalizationString.uDryContactSettion); + var btnBackLight = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnBackLight); + btnBackLight.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnBackLight.AddRightArrow(); + //搴曠嚎 + btnBackLight.AddBottomLine(); + btnBackLight.ButtonClickEvent += (sender, e) => + { + var form = new DeviceRelay.DeviceDryContactSettionForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + }; + } + + #endregion + + #region 鈻� 閫氱敤淇℃伅___________________________ + + /// <summary> + /// 娣诲姞銆愰�氱敤淇℃伅銆戣 + /// </summary> + private void AddGeneralInformationRow() + { + string caption = Language.StringByID(R.MyInternationalizationString.uGeneralInformation); + var btnGeneral = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnGeneral); + btnGeneral.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnGeneral.AddRightArrow(); + //搴曠嚎 + btnGeneral.AddBottomLine(); + btnGeneral.ButtonClickEvent += (sender, e) => + { + var form = new DeviceGeneralInformationForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + }; + } + + #endregion + + #region 鈻� 鍥轰欢鍗囩骇___________________________ + + /// <summary> + /// 娣诲姞銆愬浐浠跺崌绾с�戣 + /// </summary> + private void AddFirmwareUpdateRow() { //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず杩欎竴琛� var oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr); @@ -272,23 +474,29 @@ return; } - var statuRow = new StatuRowLayout(listview); - //鍥轰欢淇℃伅 - var btnUpview = new RowCenterView(false); - btnUpview.TextID = R.MyInternationalizationString.uFirmwareInformation; - statuRow.AddChidren(btnUpview); + //鍥轰欢鍗囩骇 + string caption = Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate); + var rowUpDate = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowUpDate); + rowUpDate.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + rowUpDate.AddRightArrow(); + //搴曠嚎 + rowUpDate.AddBottomLine(); + //鎻愮ず鏈夋柊鐗堟湰 - var btnNewVersion = new RowNewVersionTipView(); + var btnNewVersion = new PicViewControl(78, 55); + btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png"; btnNewVersion.Visible = false; - statuRow.AddChidren(btnNewVersion); + btnNewVersion.X = Application.GetRealWidth(242); + btnNewVersion.Y= Application.GetRealHeight(23); + rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); - statuRow.AddRightIconControl(); - - statuRow.MouseUpEvent += (sender, e) => + rowUpDate.ButtonClickEvent += (sender, e) => { btnNewVersion.Visible = false; var form = new DeviceFirmwareInfoForm(); - this.AddForm(form, listNewDevice); + form.AddForm(listNewDevice[0].DeviceAddr); }; //璁剧疆璁惧鐨勭増鏈俊鎭� @@ -300,418 +508,214 @@ /// </summary> /// <param name="btnNewVersion">鏈夋柊鐗堟湰鐨勬彁绀烘帶浠�</param> /// <param name="oTADevice">ota璁惧</param> - private void SetDeviceVersionInfo(RowNewVersionTipView btnNewVersion, OTADevice oTADevice) + private void SetDeviceVersionInfo(PicViewControl btnNewVersion, OTADevice oTADevice) { new System.Threading.Thread(async () => { + bool receiveImageInfo = false; //璁剧疆璁惧鍏ㄩ儴鐨勯暅鍍忎俊鎭� - Common.LocalDevice.Current.SetAllImageInfoToOtaDevice(oTADevice, this.OtaImageInfoActionBack); + HdlDeviceImageInfoLogic.Current.SetAllImageInfoToOtaDevice(oTADevice, (device, reportData) => + { + receiveImageInfo = true; + }); int count = 5; - while (this.receiveImageInfo == false && count > 0) + while (receiveImageInfo == false && count > 0) { //绛夊緟璁惧闀滃儚鐨勫弽棣� await Task.Delay(300); count--; } - //鍙橀噺杩樺師 - this.receiveImageInfo = false; + //绉婚櫎浜嬩欢 + HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(oTADevice); oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr); //娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - var result = await FirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); + var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); //鑾峰彇璁惧鏈�鏂扮増鏈� - var deviceFirmware = FirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice, + var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString(), oTADevice.ImgVersion); - if (deviceFirmware != null) + if (deviceFirmware != null && deviceFirmware.FirmwareVersion > oTADevice.ImgVersion) { - if (deviceFirmware.FirmwareVersion > oTADevice.ImgVersion) + Application.RunOnMainThread(() => { - Application.RunOnMainThread(() => + if (btnNewVersion != null) { btnNewVersion.Visible = true; - }); - } + } + }); } }) { IsBackground = true }.Start(); } + #endregion + + #region 鈻� 淇敼鍚嶅瓧___________________________ + /// <summary> - /// 鑾峰彇鍒颁簡OTA闀滃儚淇℃伅鍥炶皟(100%鐗瑰畾鍥炶皟) + /// 璁惧閲嶅懡鍚� /// </summary> - /// <param name="device"></param> - /// <param name="reportData"></param> - private void OtaImageInfoActionBack(CommonDevice device, CommonDevice.DeviceStatusReportData reportData) + /// <param name="i_deviceName">deviceName.</param> + private async void DeviceReName(string i_deviceName,bool closeForm) { - this.receiveImageInfo = true; + //寮�鍚繘搴︽潯 + this.ShowProgressBar(); + + //淇敼MAC鍚� + string deviceName = i_deviceName.Trim(); + var result = await Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName); + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + + if (result == false) + { + return; + } + if (closeForm == true) + { + //鍏抽棴鐣岄潰 + this.CloseForm(); + } + else + { + //璁惧澶囨敞淇敼鎴愬姛! + string msg = Language.StringByID(R.MyInternationalizationString.uDeviceReNoteSuccess); + this.ShowMassage(ShowMsgType.Tip, msg); + } } #endregion - #region 鈻� 鏂瑰悜闄愪綅___________________________ + #region 鈻� 鍙充笂瑙掕彍鍗昣________________________ - /// <summary> - ///娣诲姞 銆愭柟鍚戦檺浣嶃�戣 - /// </summary> - /// <param name="listview">Listview.</param> - private void AddDirectionLimitRow(VerticalScrolViewLayout listview) - { - bool canAddRow = false; - foreach (var device in listNewDevice) - { - if (device.Type == DeviceType.WindowCoveringDevice) - { - canAddRow = true; - break; - } - } - if (canAddRow == false) - { - //蹇呴』鏈変竴璺洖璺槸WindowCoveringDevice鎵嶈 - return; - } - - //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 - var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice); - //濡傛灉鏄獥甯� - if (myDeviceType.BeloneType == DeviceBeloneType.A绐楀笜) - { - //鏂瑰悜涓庨檺浣嶈缃� - var directionLimitRow = new StatuRowLayout(listview); - - var directionLimitBtn = new RowCenterView(false); - directionLimitBtn.TextID = R.MyInternationalizationString.DirectionLimit; - directionLimitRow.AddChidren(directionLimitBtn); - //鏂瑰悜涓庨檺浣嶈缃悜鍙崇殑鍥炬爣 - var btnLightRight = new RowRightIconView(); - directionLimitRow.AddChidren(btnLightRight); - directionLimitRow.MouseUpEvent += (sender, e) => - { - var form = new RollerShadeDirectionLimitSettingForm(); - this.AddForm(form, listNewDevice); - }; - } - } - - #endregion - - #region 鈻� 缁存姢妯″紡___________________________ - - /// <summary> - /// 娣诲姞 銆愮淮鎶ゆā寮忋�戣 - /// </summary> - /// <param name="listview">Listview.</param> - /// <param name="statu">If set to <c>true</c> statu.</param> - private void AddMaintenanceModeRow(VerticalScrolViewLayout listview, bool statu = false) - { - bool canAddRow = false; - foreach (var device in listNewDevice) - { - if (device.Type == DeviceType.WindowCoveringDevice) - { - var rollershade = device as Rollershade; - canAddRow = true; - break; - } - } - if (canAddRow == false) - { - //蹇呴』鏈変竴璺洖璺槸WindowCoveringDevice鎵嶈 - return; - } - //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 - var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice); - //濡傛灉鏄獥甯� - if (myDeviceType.BeloneType == DeviceBeloneType.A绐楀笜) - { - //绐楀笜鍙栫涓�鍥炶矾 - var rollerShade = listNewDevice[0] as Rollershade; - //缁存姢妯″紡 璁剧疆 - var maintenanceModeRow = new RowLayout - { - Height = ControlCommonResourse.ListViewRowHeight - }; - listview.AddChidren(maintenanceModeRow); - - //涓嶄笂闈炶繙绋� - if (rollerShade.Gateway == null) - { - return; - } - //if (rollerShade.Gateway.IsVirtual) - //{ - UserHomeView.ReadStatus(rollerShade, () => - { - rollerShade.ReadCurtainDirectionAndMode(); - },3); - //} - //else - //{ - // //闃叉鐭椂闂村唴澶氭璇诲彇 - // if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) - // { - // rollerShade.ReadCurtainDirectionAndMode(); - // } - //} - - var maintenanceModeBtn = new RowTopGrayView(false); - maintenanceModeBtn.TextID = R.MyInternationalizationString.MaintenanceMode; - maintenanceModeRow.AddChidren(maintenanceModeBtn); - - var Start_ban_switchBtn = new RowBottomBlackView(false); - Start_ban_switchBtn.TextID = R.MyInternationalizationString.Start_Forbid_Hand_Pull_Switch; - maintenanceModeRow.AddChidren(Start_ban_switchBtn); - - switchBtn = new SwichControl(); - switchBtn.Tag = rollerShade; - maintenanceModeRow.AddChidren(switchBtn); - switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance; - switchBtn.MouseUpEventHandler += async (sender, e) => - { - try - { - CommonPage.Loading.Start(); - switchBtn.IsSelected = !switchBtn.IsSelected; - var setWritableValueResponAllData = await rollerShade.SetCurtianMaintenanceAsync(switchBtn.IsSelected); - - await System.Threading.Tasks.Task.Delay(5000); - - if (setWritableValueResponAllData == null || setWritableValueResponAllData.setWritableValueResponData == null) - { - Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - switchBtn.IsSelected = false; - return; - } - var status = setWritableValueResponAllData.setWritableValueResponData.Status; - //浠ュ悗琛ュ厖鎻愮ず - //0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級 - //34锛氫笉鏀寔璇ュ睘鎬� - //135锛氭棤鏁堢殑灞炴�у�� - //141锛氭棤鏁堢殑鏁版嵁绫诲瀷 - if (status == 0) - { - System.Console.WriteLine("鍒囨崲缁存姢妯″紡鎴愬姛"); - //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success); - } - else - { - Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ChangeMaintenanceMode_Fail); - switchBtn.IsSelected = false; - } - } - catch(Exception ex) - { - System.Console.WriteLine("璁剧疆缁存姢妯″紡澶辫触"+ex); - } - finally - { - CommonPage.Loading.Hide(); - } - - }; - } - } - - #endregion - - #region 鈻� 淇敼鍚嶅瓧___________________________ - - /// <summary> - /// 璁惧閲嶅懡鍚� - /// </summary> - /// <param name="i_deviceName">deviceName.</param> - private async void DeviceReName(string i_deviceName) - { - //淇敼MAC鍚� - string deviceName = i_deviceName.Trim(); - var result = await Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName); - if (result == false) - { - return; - } - - Application.RunOnMainThread(() => - { - if (ActionFormClose != null) - { - this.ActionFormClose(deviceName); - } - }); - } - - #endregion - - #region 鈻� 鍒犻櫎鐣岄潰___________________________ - /// <summary> - /// 鍒濆鍖栧垹闄よ澶囩殑鐣岄潰 - /// </summary> - private void InitDeleteDeviceForm() + /// 鍒濆鍖栧彸涓婅鑿滃崟 + /// </summary> + private void InitTopRightMenu() { - var btnIcon = new TopLayoutMostRightView(); + var btnIcon = new MostRightIconControl(69, 69); btnIcon.UnSelectedImagePath = "Item/More.png"; - btnIcon.SelectedImagePath = "Item/MoreSelected.png"; topFrameLayout.AddChidren(btnIcon); - btnIcon.MouseUpEventHandler += ((sender, e) => + btnIcon.InitControl(); + btnIcon.ButtonClickEvent += ((sender, e) => { - //鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈� - this.ShowDeleteDeviceDialogForm(); + //鏄剧ず鍙充笂瑙掕彍鍗曠晫闈� + this.ShowTopRightMenu(); }); - } - - /// <summary> - /// 鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈� - /// </summary> - private void ShowDeleteDeviceDialogForm() - { - var frame = new TopRightMenuControl(this, 1); - //鍒犻櫎璁惧 - string deviceMenu = Language.StringByID(R.MyInternationalizationString.uDeleteDevice); - frame.AddRowMenu(deviceMenu, (obj) => - { - //纭瑕佸垹闄よ璁惧锛焮0}(鍒犻櫎璁惧鍚�,缁戝畾鐩爣灏嗘秷澶�) - string msg = Language.StringByID(R.MyInternationalizationString.uDeleteDeviceMsg); - if (msg.Contains("{0}") == true) - { - msg = string.Format(msg, "\r\n"); - } - this.ShowConfirmMsg(msg, "DoDeleteDevice"); - }); } - /// <summary> - /// 鍒犻櫎鎸囧畾璁惧 - /// </summary> - public async void DoDeleteDevice() + /// <summary> + /// 鏄剧ず鍙充笂瑙掕彍鍗曠晫闈� + /// </summary> + private void ShowTopRightMenu() + { + int menuCount = 1; + string deviceMenu = string.Empty; + //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘(鎷跨鐐规渶灏忕殑閭d釜鍥炶矾鍘诲畾浣�) + bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]); + if (canTest == true) + { + menuCount = 2; + } + var frame = new TopRightMenuControl(this, menuCount); + if (canTest == true) + { + //瀹氫綅 + deviceMenu = Language.StringByID(R.MyInternationalizationString.uFixedPosition); + frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () => + { + //鍙戦�佸畾浣嶅姛鑳� + Common.LocalDevice.Current.SetFixedPositionCommand(listNewDevice[0]); + }); + } + + //鍒犻櫎 + deviceMenu = Language.StringByID(R.MyInternationalizationString.uDelete); + frame.AddRowMenu(deviceMenu, "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () => + { + //纭鍒犻櫎璇ヨ澶囧強鍔熻兘锛� + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteDeviceMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //鍒犻櫎鎸囧畾璁惧 + this.DoDeleteDevice(); + }); + }); + + } + + /// <summary> + /// 鍒犻櫎鎸囧畾璁惧 + /// </summary> + private async void DoDeleteDevice() { //寮�鍚繘搴︽潯 - this.ShowProgressBar(); - //鍒犻櫎璁惧 + this.ShowProgressBar(); + //鍒犻櫎璁惧 bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice); - this.CloseProgressBar(); - + this.CloseProgressBar(); + if (result == false) { return; - } - - Application.RunOnMainThread(() => + } + + Application.RunOnMainThread(() => { //鍏抽棴鐣岄潰 this.CloseForm(); - //绉婚櫎璁惧鍒楄〃鐣岄潰鎸囧畾鐨勮澶� - this.LoadFormMethodByName("DeviceManagementMainForm", "RemoveDeviceFromMemory", listNewDevice); - }); + }); } - #endregion + #endregion - #region 鈻� 鍏抽棴鐣岄潰___________________________ + #region 鈻� 鍏抽棴鐣岄潰___________________________ /// <summary> /// 鐢婚潰鍏抽棴 /// </summary> - /// <param name="isCloseForm">鏄惁鍏抽棴鐣岄潰,false鐨勬椂鍊�,鍙細璋冪敤鍏抽棴鍑芥暟閲岄潰鐨勯檮鍔犲姛鑳�</param> - public override void CloseForm(bool isCloseForm = true) - { - ZbGateway.StatusList.Remove(this); - base.CloseForm(isCloseForm); - } - - #endregion + public override void CloseForm() + { + //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋� + HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]); - #region 鈻� 璁惧鎺ュ彛___________________________ - /// <summary> - /// Changed the specified common. - /// </summary> - /// <param name="common">Common.</param> - public void Changed(CommonDevice common) - { - } - /// <summary> - /// 璁惧鐘舵�佹洿鏂版帴鍙� - /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para> - /// <para>type锛氬鏋滀负 IASInfoReport:RemoveDeviceRespon</para> - /// <para>type锛氬鏋滀负 DeviceStatusReport:璁惧涓婃姤</para> - /// <para>type锛氬鏋滀负 IASInfoReport:IAS瀹夐槻淇℃伅涓婃姤</para> - /// <para>type锛氬鏋滀负 OnlineStatusChange: 璁惧鍦ㄧ嚎鐘舵�佹洿鏂�</para> - /// </summary> - /// <param name="common">Common.</param> - /// <param name="typeTag">Type tag.</param> - public void DeviceInfoChange(CommonDevice common, string typeTag) - { - if (typeTag == "DeviceStatusReport") - { - Application.RunOnMainThread(() => - { - try - { - if (switchBtn == null) - { - return; - } - var device = switchBtn.Tag as CommonDevice; - - //鏄惁涓哄綋鍓嶈澶� - if (device.DeviceEpoint != common.DeviceEpoint || device.DeviceAddr != common.DeviceAddr) - { - return; - } - if ((common as Rollershade).DeviceStatusReport.CluterID != 258) - { - return; - } - var rollerShade = device as Rollershade; - rollerShade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - - var attriButeList = rollerShade.DeviceStatusReport.AttriBute; - if(attriButeList==null) - { - return; - } - foreach (var attriBute in attriButeList) - { - //缁存姢妯″紡 - if (attriBute.AttributeId == 23) - { - if (0 < (attriBute.AttriButeData & 0x04)) - { - switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance = true; - } - else - { - switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance = false; - } - rollerShade.LastDateTime = DateTime.Now; - } - } - - } - catch (Exception ex) - { - System.Console.WriteLine($"Error:{ex.Message}"); - } - }); - } - } - /// <summary> - /// Changeds the IL ogic status. - /// </summary> - /// <param name="logic">Logic.</param> - public void ChangedILogicStatus(ZigBee.Device.Logic logic) - { - } - /// <summary> - /// Changeds the IS cene status. - /// </summary> - /// <param name="scene">Scene.</param> - public void ChangedISceneStatus(Scene scene) - { - } - #endregion - } -} + base.CloseForm(); + } + + #endregion + + #region 鈻� 纭欢淇℃伅___________________________ + + /// <summary> + /// 閲嶆柊鑾峰彇纭欢淇℃伅 + /// </summary> + private void RefreshHardFirmwareInfo() + { + if (listNewDevice[0].DriveCode > 0) + { + //铏氭嫙璁惧娌℃湁杩欑鎿嶄綔 + return; + } + //閲嶆柊鑾峰彇纭欢淇℃伅 + HdlDeviceHardInfoLogic.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0], (device, reportData) => + { + for (int i = 1; i < listNewDevice.Count; i++) + { + //鍏ㄩ儴鍥炶矾鐨勪俊鎭兘鏄竴鑷寸殑 + HdlDeviceHardInfoLogic.Current.SetHardFirmwareInfo(device.DeviceStatusReport, listNewDevice[i]); + listNewDevice[i].ReSave(); + } + }); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + #endregion + } +} -- Gitblit v1.8.0