| | |
| | | using System.Threading.Tasks;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.DeviceRelay
|
| | | namespace Shared.Phone.UserCenter.Device
|
| | | {
|
| | | /// <summary>
|
| | | /// 设备干接点配置
|
| | |
| | | /// </summary>
|
| | | private FrameCaptionInputControl btnDeviceName = null;
|
| | | /// <summary>
|
| | | /// 设备Mac地址
|
| | | /// 设备的某一回路
|
| | | /// </summary>
|
| | | private string deviceMac = string.Empty;
|
| | | private CommonDevice deviceObj = null;
|
| | | /// <summary>
|
| | | /// 设备需要保存的设备名字
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_deviceMac">设备Mac地址</param>
|
| | | public void ShowForm(string i_deviceMac)
|
| | | /// <param name="i_device">设备的某一回路</param>
|
| | | public void ShowForm(CommonDevice i_device)
|
| | | {
|
| | | this.deviceMac = i_deviceMac;
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | this.deviceObj = i_device;
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | //获取这一堆设备时属于什么类型的
|
| | | this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | |
|
| | |
| | | this.ShowProgressBar();
|
| | | foreach (var epoint in dicDeviceSaveName.Keys)
|
| | | {
|
| | | var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint);
|
| | | var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint);
|
| | | if (device == null || dicDeviceSaveName[epoint] == string.Empty)
|
| | | {
|
| | | //不能允许空白名字
|
| | |
| | | //这里先去获取它的干接点类型
|
| | | this.ShowProgressBar();
|
| | | //获取第七回路的配置信息
|
| | | listRelayInfo7 = await HdlPanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
|
| | | listRelayInfo7 = await HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice);
|
| | | if (listRelayInfo7 == null)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | {
|
| | | menuCount = 2;
|
| | | }
|
| | | var frame = new TopRightMenuControl(this, menuCount);
|
| | | var frame = new TopRightMenuControl(menuCount);
|
| | | if (canTest == true)
|
| | | {
|
| | | //定位
|
| | |
| | | //选择的是传感器输入
|
| | | value = 65535;
|
| | | }
|
| | | var result = await HdlPanelLogic.Current.EditorDryContactFunction((Panel)nowSelectDevice, value);
|
| | | var result = await HdlDevicePanelLogic.Current.EditorDryContactFunction((Panel)nowSelectDevice, value);
|
| | | if (result == true)
|
| | | {
|
| | | //重新初始化菜单行,隐藏或者开放绑定目标菜单
|
| | |
| | | btnBind.AddRightArrow();
|
| | | btnBind.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var panel = nowSelectDevice as ZigBee.Device.Panel;
|
| | | var bindTargetsPage = new Shared.Phone.UserCenter.DeviceBind.BindTargetsPage(panel);
|
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(bindTargetsPage);
|
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | bindTargetsPage.Show();
|
| | | };
|
| | | }
|
| | | }
|
| | |
| | | private void AddBackLightRow()
|
| | | {
|
| | | //三路继电器,或者一路调光器 的时候才能开启此选项
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | var myType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
|
| | |
|
| | | if (myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad
|
| | |
| | | btnLight.AddRightArrow();
|
| | | btnLight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new RelayThreeLoadBackLightSettionForm();
|
| | | form.AddForm(deviceMac);
|
| | | var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm();
|
| | | form.AddForm(deviceObj.DeviceAddr);
|
| | | };
|
| | | }
|
| | | }
|
| | |
| | | frame.Height = Application.GetMinRealAverage(124);
|
| | | frameBack.AddChidren(frame);
|
| | | //初始化一行设备图标
|
| | | this.InitDeviceIconFrame(frame, listIcon[i], i == 0, ref index);
|
| | | this.InitDeviceIconFrame(frame, listIcon[i], ref index);
|
| | |
|
| | | if (listIcon.Count == 1)
|
| | | {
|
| | |
| | | /// </summary>
|
| | | /// <param name="frame"></param>
|
| | | /// <param name="listDevice"></param>
|
| | | /// <param name="isFirstRow"></param>
|
| | | /// <param name="index"></param>
|
| | | /// <returns></returns>
|
| | | private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, bool isFirstRow, ref int index)
|
| | | private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, ref int index)
|
| | | {
|
| | | NormalViewControl btnTemp = null;
|
| | | //间距
|
| | |
| | | //点击事件
|
| | | btnIcon.ButtonClickEvent += this.DeviceEpointSelectEvent;
|
| | |
|
| | | if (i == 0 && isFirstRow == true)
|
| | | if (listDevice[i].DeviceEpoint == deviceObj.DeviceEpoint)
|
| | | {
|
| | | btnTemp = btnIcon;
|
| | | }
|
| | | }
|
| | | if (isFirstRow == true)
|
| | | if (btnTemp != null)
|
| | | {
|
| | | //初始化菜单行
|
| | | this.DeviceEpointSelectEvent(btnTemp, null);
|
| | |
| | | /// <returns></returns>
|
| | | private List<List<CommonDevice>> GetAllDeviceGroup()
|
| | | {
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
|
| | | bool hadDevice = false;
|
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr);
|
| | | var listRelay = new List<CommonDevice>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | |
| | | {
|
| | | //只要干接点
|
| | | listRelay.Add(device);
|
| | | if (device.DeviceEpoint == deviceObj.DeviceEpoint)
|
| | | {
|
| | | //能够匹配得到这个回路
|
| | | hadDevice = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | //排序
|
| | |
| | | }
|
| | | return -1;
|
| | | });
|
| | | if (hadDevice == false)
|
| | | {
|
| | | //如果匹配不到这个回路,则默认第一个
|
| | | this.deviceObj = listRelay[0];
|
| | | }
|
| | |
|
| | | //从下往上4个为一组
|
| | | var listIcon = new List<List<CommonDevice>>();
|
| | | var listTemp = new List<CommonDevice>();
|
| | |
| | | nowContr.TextColor = UserCenterColor.Current.TextColor1;
|
| | |
|
| | | nowSelectControl = nowContr;
|
| | | nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
|
| | | nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty)));
|
| | |
|
| | | //重新初始化菜单行
|
| | | this.InitMenuRow();
|