| | |
| | | //右箭头
|
| | | this.AddRightArrow();
|
| | |
|
| | | //读取设备功能类型
|
| | | this.ReadDeviceFunctionType();
|
| | |
|
| | | this.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //显示选择设备功能类型的界面
|
| | |
| | |
|
| | | 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)
|
| | |
| | | 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
|
| | |
| | | }
|
| | |
|
| | | #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
|
| | | }
|
| | | }
|