From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs | 140 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 140 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs new file mode 100755 index 0000000..6bab0d1 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs @@ -0,0 +1,140 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DeviceLight +{ + /// <summary> + /// mini澶滅伅鐨勫姛鑳借缃晫闈� + /// </summary> + public class MiniNightLightFunctionSettionForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧鐨勬煇涓�鍥炶矾 + /// </summary> + private CommonDevice device = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + public void ShowForm(CommonDevice i_device) + { + this.device = i_device; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var btnPic = new PicViewControl(508, 204); + btnPic.Y = Application.GetRealHeight(179); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "DeviceItem/MiniNightLightDevice.png"; + bodyFrameLayout.AddChidren(btnPic); + + var listBackControl = new VerticalFrameControl(); + listBackControl.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackControl); + + //鍒濆鍖栨甯� + var tableContr = new InformationEditorControl(); + var listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1166); + + //鍥炶矾澶囨敞 + string caption = Language.StringByID(R.MyInternationalizationString.uDeviceEpointNote); + string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(this.device); + var btnDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2); + btnDeviceName.txtInput.MaxByte = 48;//闄愬埗鍙兘杈撳叆48涓瓧鑺� + listview.AddChidren(btnDeviceName); + btnDeviceName.InitControl(); + btnDeviceName.AddBottomLine(); + btnDeviceName.txtInput.FinishInputEvent += () => + { + string oldName = Common.LocalDevice.Current.GetDeviceEpointName(this.device); + if (btnDeviceName.Text.Trim() == string.Empty) + { + //灏嗗悕瀛楄繕鍘� + btnDeviceName.Text = oldName; + } + if (oldName != btnDeviceName.Text.Trim()) + { + //璁惧鍚嶇О淇敼 + var result = Common.LocalDevice.Current.ReName(this.device, btnDeviceName.Text.Trim()); + if (result == false) + { + return; + } + //鍥炶矾澶囨敞淇敼鎴愬姛! + string msg = Language.StringByID(R.MyInternationalizationString.uDeviceEpointReNoteSuccess); + this.ShowMassage(ShowMsgType.Tip, msg); + } + }; + + //鎵�灞炲尯鍩� + var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2); + listview.AddChidren(rowBeloneArea); + rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uBelongArea), this.device); + //搴曠嚎 + rowBeloneArea.AddBottomLine(); + rowBeloneArea.SelectRoomEvent += (roomKeys) => + { + //鍙樻洿鎴块棿 + HdlRoomLogic.Current.ChangedRoom(this.device, roomKeys); + }; + + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(this.device, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) + { + listview.AddChidren(rowFunction); + rowFunction.InitControl(); + //搴曠嚎 + rowFunction.AddBottomLine(); + } + //鍒濆鍖栨甯冨畬鎴� + tableContr.FinishInitControl(); + + //淇濆瓨 + var btnFinish = new BottomClickButton(); + btnFinish.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnFinish); + btnFinish.ButtonClickEvent += (sender, e) => + { + string newName = btnDeviceName.Text.Trim(); + string oldName = Common.LocalDevice.Current.GetDeviceEpointName(device); + if (oldName != newName) + { + //璁惧鍚嶇О淇敼 + var result = Common.LocalDevice.Current.ReName(device, newName); + if (result == false) + { + return; + } + } + //鍏抽棴鑷韩 + this.CloseForm(); + }; + } + + #endregion + } +} -- Gitblit v1.8.0