New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.DeviceAirConditioner
|
| | | {
|
| | | /// <summary>
|
| | | /// 空调室内机设置界面
|
| | | /// </summary>
|
| | | public class IndoorUnitSettionForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listview = null;
|
| | | /// <summary>
|
| | | /// 当前选择的网关
|
| | | /// </summary>
|
| | | private AC deviceAc = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_deviceAc">选择的空调回路</param>
|
| | | public void ShowForm(AC i_deviceAc)
|
| | | {
|
| | | this.deviceAc = i_deviceAc;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uIndoorUnitSettion));
|
| | |
|
| | | //初始化右上角菜单
|
| | | this.InitTopRightMenu();
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //初始化桌布
|
| | | var tableContr = new InformationEditorControl();
|
| | | this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 369, 1368);
|
| | |
|
| | | //图片
|
| | | var btnPic = new DeviceInfoIconControl();
|
| | | btnPic.Y = Application.GetRealHeight(92);
|
| | | btnPic.Gravity = Gravity.CenterHorizontal;
|
| | | bodyFrameLayout.AddChidren(btnPic);
|
| | | btnPic.InitControl(this.deviceAc);
|
| | |
|
| | | //设备备注
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
|
| | | string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
|
| | | var btnNote = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2);
|
| | | listview.AddChidren(btnNote);
|
| | | btnNote.InitControl();
|
| | | //划线
|
| | | btnNote.AddBottomLine();
|
| | | btnNote.txtInput.FinishInputEvent += async () =>
|
| | | {
|
| | | string oldName = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
|
| | | if (btnNote.Text.Trim() == string.Empty)
|
| | | {
|
| | | //将名字还原
|
| | | btnNote.Text = oldName;
|
| | | }
|
| | | if (oldName != btnNote.Text)
|
| | | {
|
| | | //设备名称修改
|
| | | var result = await Common.LocalDevice.Current.ReName(deviceAc, btnNote.Text);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //设备备注修改成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceReNoteSuccess);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | }
|
| | | };
|
| | |
|
| | | //设备类型
|
| | | caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
|
| | | nameValue = Common.LocalDevice.Current.GetDeviceObjectText(new List<CommonDevice>() { deviceAc });
|
| | | var btnType = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2);
|
| | | btnType.UseClickStatu = false;
|
| | | listview.AddChidren(btnType);
|
| | | btnType.InitControl();
|
| | | //划线
|
| | | btnType.AddBottomLine();
|
| | |
|
| | | //所属区域
|
| | | var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
|
| | | listview.AddChidren(rowBeloneArea);
|
| | | rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uBelongArea), deviceAc);
|
| | | //底线
|
| | | rowBeloneArea.AddBottomLine();
|
| | | rowBeloneArea.SelectRoomEvent += (roomKeys) =>
|
| | | {
|
| | | Common.Room.CurrentRoom.ChangedRoom(deviceAc, roomKeys);
|
| | | };
|
| | |
|
| | | //空调模式
|
| | | var rowMode = new FrameRowControl(listview.rowSpace / 2);
|
| | | listview.AddChidren(rowMode);
|
| | | rowMode.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerMode), 600);
|
| | | rowMode.AddRightArrow();
|
| | | rowMode.AddBottomLine();
|
| | | rowMode.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new AirConditionerModeForm();
|
| | | form.AddForm(deviceAc);
|
| | | };
|
| | |
|
| | | //初始化桌布完成
|
| | | tableContr.FinishInitControl(bodyFrameLayout, this.listview);
|
| | | tableContr = null;
|
| | |
|
| | | //保存
|
| | | var btnFinish = new BottomClickButton();
|
| | | btnFinish.TextID = R.MyInternationalizationString.uSave;
|
| | | bodyFrameLayout.AddChidren(btnFinish);
|
| | | btnFinish.ButtonClickEvent += async (sender, e) =>
|
| | | {
|
| | | string oldName = Common.LocalDevice.Current.GetDeviceEpointName(deviceAc);
|
| | | if (oldName != btnNote.Text)
|
| | | {
|
| | | //设备名称修改
|
| | | var result = await Common.LocalDevice.Current.ReName(deviceAc, btnNote.Text);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | this.CloseForm();
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 右上角菜单_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化右上角菜单
|
| | | /// </summary>
|
| | | private void InitTopRightMenu()
|
| | | {
|
| | | //检测此回路是否拥有定位功能(拿端点最小的那个回路去定位)
|
| | | bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(deviceAc);
|
| | | if (canTest == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var btnIcon = new MostRightIconControl(69, 69);
|
| | | btnIcon.UnSelectedImagePath = "Item/More.png";
|
| | | topFrameLayout.AddChidren(btnIcon);
|
| | | btnIcon.InitControl();
|
| | | btnIcon.ButtonClickEvent += ((sender, e) =>
|
| | | {
|
| | | //显示右上角菜单界面
|
| | | this.ShowTopRightMenu();
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示右上角菜单界面
|
| | | /// </summary>
|
| | | private void ShowTopRightMenu()
|
| | | {
|
| | | var frame = new TopRightMenuControl(1);
|
| | | //定位
|
| | | var deviceMenu = Language.StringByID(R.MyInternationalizationString.uFixedPosition);
|
| | | frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
|
| | | {
|
| | | //发送定位功能
|
| | | Common.LocalDevice.Current.SetFixedPositionCommand(deviceAc);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|