From b02e8275a21dc06bf54b66273485d44e007a2616 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 20 七月 2020 14:50:17 +0800 Subject: [PATCH] 新代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs | 64 ++++++++++++++++++++++++++++--- 1 files changed, 57 insertions(+), 7 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs index 601e1bd..ee4a454 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs @@ -80,6 +80,9 @@ //鍙崇澶� this.AddRightArrow(); + //璇诲彇璁惧鍔熻兘绫诲瀷 + this.ReadDeviceFunctionType(); + this.ButtonClickEvent += (sender, e) => { //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈� @@ -108,7 +111,7 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo - 1); + form.AddForm(title, listText, null, nowSelectNo - 1); form.FinishSelectEvent += (selectNo) => { if (selectNo == nowSelectNo - 1) @@ -120,14 +123,34 @@ this.Text = selectNo == -1 ? string.Empty : listText[selectNo]; nowSelectNo = selectNo + 1; - //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� - this.RefreshDfunctionType(); + this.CanClick = false; + HdlThreadLogic.Current.RunThread(() => + { + //璁剧疆鍔熻兘绫诲瀷鍒扮綉鍏� + var result = Common.LocalDevice.Current.SendDeviceFunctionTypeToGateway(this.device, (DeviceFunctionType)nowSelectNo); + + HdlThreadLogic.Current.RunMain(() => + { + if (result == true) + { + //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� + this.RefreshDfunctionType(); - //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� - UserView.UserPage.Instance.RefreshForm = true; + //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� + UserView.UserPage.Instance.RefreshAllForm = true; - //璋冪敤鍥炶皟鍑芥暟 - this.FinishSelectEvent?.Invoke(nowSelectNo); + //璋冪敤鍥炶皟鍑芥暟 + this.FinishSelectEvent?.Invoke(nowSelectNo); + } + else + { + //璁剧疆璁惧鍔熻兘绫诲瀷澶辫触 + var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSetDeviceFunctionTypeFail)); + alert.Show(); + } + this.CanClick = true; + }); + }); }; } #endregion @@ -309,5 +332,32 @@ } #endregion + + #region 鈻� 璇诲彇璁惧鍔熻兘绫诲瀷___________________ + + /// <summary> + /// 璇诲彇璁惧鍔熻兘绫诲瀷 + /// </summary> + private void ReadDeviceFunctionType() + { + HdlThreadLogic.Current.RunThread(() => + { + //璇诲彇璁惧鍔熻兘绫诲瀷 + var info = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(this.device); + if (info != null && ((int)this.device.DfunctionType) != info.FunctionType) + { + this.device.DfunctionType = (DeviceFunctionType)info.FunctionType; + HdlThreadLogic.Current.RunMain(() => + { + //鍒锋柊鎺т欢 + this.InitDefultData(); + //鍒锋柊璁惧鍔熻兘绫诲瀷 + this.RefreshDfunctionType(); + }); + } + }); + } + + #endregion } } -- Gitblit v1.8.0