| | |
| | | 231=接近感应 |
| | | 232=接近感应功能设置置失败 |
| | | 233=获取接近感应功能失败 |
| | | 235=按住面板模式(Mode)和风速(Fan)按键{0}绿色指示灯亮起。则配网成功 |
| | | ;三按键面板入网操作指示 |
| | | 235=按住面板模式按键5秒,绿色指示灯闪烁{0}进入配网状态;闪烁停止{0}指示灯变白色表示配网成功 |
| | | 236=绿色指示灯闪烁 |
| | | 237=指示灯 |
| | | 238=长按5秒(按键) |
| | | 239=长按图示按键5秒以上,指示灯变绿、闪烁{0}进入配网状态。绿灯熄灭则配网成功 |
| | | ;三按键面板入网操作指示 |
| | | 241=设置常开模式后,您的门锁将始终{0}处于打开状态,确认开启? |
| | | 242=电量 |
| | | 243=常开模式已开启 |
| | |
| | | 311=手动 |
| | | 312= 背光灯颜色 |
| | | 313=长按图示按键5秒以上,信号图标{0}快闪, 进入配网状态。信号图标常亮则配网成功 |
| | | 314=自动模式不支持操作 |
| | | |
| | | 5097=取消 |
| | | 5098=确定 |
| | |
| | | 5397=时间为空 |
| | | 5398=只支持数字输入 |
| | | |
| | | 5399=关闭失败 |
| | | 5400=开启失败 |
| | | 5401=添加失败 |
| | | 5402=时效性常开设置 |
| | | 5403=时关闭 |
| | | |
| | | 10000=HDL Home |
| | | 10001=常用 |
| | | |
| | |
| | | 11001=场景 |
| | | 11002=自动化 |
| | | |
| | | 11010=没有功能 {\r\n} 请在个人中心--设备管理处添加 |
| | | 11010=没有功能{0}请在个人中心--设备管理处添加 |
| | | 11011=编辑 |
| | | 11012=功能设置 |
| | | 11013=信息编辑 |
| | |
| | | 11021=保存 |
| | | 11022=提醒 |
| | | 11023=取消 |
| | | 11024=没有场景 {\r\n} 请点击右上角添加 |
| | | 11024=没有场景{0}请点击右上角添加 |
| | | 11025=设置 |
| | | 11026=延时 |
| | | 11027=确定删除吗? |
| | |
| | | ;温湿度传感器入网操作指示
|
| | | 21017=长按图示按键5秒以上,信号图标{0}快闪, 进入配网状态。图标常亮则配网成功
|
| | | ;方悦2按键轻触式面板入网操作指示
|
| | | 21018=按住面板左上角按键,所有按键指示灯{0}亮起,则配网成功
|
| | | 21018=长按BUTTON1按键5秒,所有指示灯{0}变为绿色并闪烁,进入配网状态
|
| | | ;方悦4按键轻触式面板入网操作指示
|
| | | 21019=按住面板左上角按键,所有按键指示灯{0}亮起,则配网成功
|
| | | 21019=长按BUTTON1按键5秒,所有指示灯{0}变为绿色并闪烁,进入配网状态
|
| | | ;方悦8按键轻触式面板入网操作指示
|
| | | 21020=按住面板左上角按键,所有按键指示灯{0}亮起,则配网成功
|
| | | 21020=长按BUTTON1按键5秒,所有指示灯{0}变为绿色并闪烁,进入配网状态
|
| | | ;方悦环境面板入网操作指示
|
| | | 21021=按住面板功能(function)按键,所有按键{0}指示灯亮起,则配网成功
|
| | | ;窗帘面板的入网操作指示
|
| | |
| | | 30037=S-one |
| | | 30038=方悦新风小模块 |
| | | 30039=Zigbee吸顶燃气传感器 |
| | | 30040=PM2.5空气质量传感器 |
| | | |
| | | ;★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★ |
| | | 40000=遮阳 |
| | |
| | | 50037=Zigbee智能门锁 |
| | | 50038=新风控制小模块 |
| | | 50039=Zigbee吸顶燃气传感器 |
| | | 50040=PM2.5空气质量传感器 |
| | | |
| | | ;★★★★下面这些是模块ID的设备类型名字,从60000开始.注:它并不需要再R.cs文件中定义★★★★
|
| | | 60000=传感器 |
| | |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Folder Include="Resources\" /> |
| | | <Folder Include="Resources\Phone\PM2.5Sensor\" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <InterfaceDefinition Include="LaunchScreen.storyboard" /> |
| | |
| | | <BundleResource Include="Resources\Phone\Device\ButtonPanelThree.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\SensorInfraredSelected.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\RepeaterSelected2.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\SensorPMTwoPointFive.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\ConverterSelected.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\RepeaterZigbeeSelected.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\SensorCarbonMonoxide.png" /> |
| | |
| | | <BundleResource Include="Resources\Phone\Gateway\WiredGateway.png" /> |
| | | <BundleResource Include="Resources\Phone\Gateway\WirelessGateway.png" /> |
| | | <BundleResource Include="Resources\Phone\Gateway\AddGatewaySuccess.png" /> |
| | | <BundleResource Include="Resources\Phone\RealDevice\SensorPMTwoPointFive.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\AirQualitySensorEpoint.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\AirQualitySensorEpointSelected.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\AirQualitySensorEpointSelected2.png" /> |
| | | <BundleResource Include="Resources\Phone\Device\SensorPMTwoPointFive.png" /> |
| | | <BundleResource Include="Resources\Phone\PM2.5Sensor\HumidityPic.png" /> |
| | | <BundleResource Include="Resources\Phone\PM2.5Sensor\PmPic.png" /> |
| | | <BundleResource Include="Resources\Phone\PM2.5Sensor\TemperaturePic.png" /> |
| | | </ItemGroup> |
| | | <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" /> |
| | | <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> |
| | |
| | | 237=指示灯 |
| | | 238=长按5秒(按键) |
| | | 239=长按图示按键5秒以上,指示灯变绿、闪烁{0}进入配网状态。绿灯熄灭则配网成功 |
| | | ;三按键面板入网操作指示 |
| | | 241=设置常开模式后,您的门锁将始终{0}处于打开状态,确认开启? |
| | | 242=电量 |
| | | 243=常开模式已开启 |
| | |
| | | 312= 背光灯颜色 |
| | | 313=长按图示按键5秒以上,信号图标{0}快闪, 进入配网状态。信号图标常亮则配网成功 |
| | | 314=自动模式不支持操作 |
| | | 315=空气质量 |
| | | 316=空气质量传感器 |
| | | |
| | | 5097=取消 |
| | | 5098=确定 |
| | |
| | | 5397=时间为空 |
| | | 5398=只支持数字输入 |
| | | |
| | | 5399=关闭失败 |
| | | 5400=开启失败 |
| | | 5401=添加失败 |
| | | 5402=时效性常开设置 |
| | | 5403=时关闭 |
| | | |
| | | 10000=HDL Home |
| | | 10001=常用 |
| | | |
| | |
| | | 11001=场景 |
| | | 11002=自动化 |
| | | |
| | | 11010=没有功能 {\r\n} 请在个人中心--设备管理处添加 |
| | | 11010=没有功能{0}请在个人中心--设备管理处添加 |
| | | 11011=编辑 |
| | | 11012=功能设置 |
| | | 11013=信息编辑 |
| | |
| | | 11021=保存 |
| | | 11022=提醒 |
| | | 11023=取消 |
| | | 11024=没有场景 {\r\n} 请点击右上角添加 |
| | | 11024=没有场景{0}请点击右上角添加 |
| | | 11025=设置 |
| | | 11026=延时 |
| | | 11027=确定删除吗? |
| | |
| | | 40016=灯光 |
| | | 40017=干接点 |
| | | 40018=新风 |
| | | 40019=PM2.5空气质量传感器 |
| | | |
| | | ;★★★★下面这些是模块ID的设备默认备注名字,从50000开始.注:它并不需要再R.cs文件中定义★★★★ |
| | | 50000=紧急按钮 |
| | |
| | | 50037=Zigbee智能门锁 |
| | | 50038=新风控制小模块 |
| | | 50039=Zigbee吸顶燃气传感器 |
| | | 30040=PM2.5空气质量传感器 |
| | | 50040=PM2.5空气质量传感器 |
| | | |
| | | ;★★★★下面这些是模块ID的设备类型名字,从60000开始.注:它并不需要再R.cs文件中定义★★★★ |
| | | 60000=传感器 |
| | |
| | | 60008=转换器 |
| | | 60009=空调模块 |
| | | 60010=智能门锁 |
| | | 60011=新风模块 |
| | | 60011=新风模块 |
| | | 60012=新风模块 |
| | | |
| | | ;//★★★★下面这些是添加新设备界面那里显示的名字,从70000开始★★★★ |
| | | 70000=2按键面板 |
| | |
| | | /// <param name="deleteRoom">是否从房间删除</param>
|
| | | public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
|
| | | {
|
| | | //删除缓存设备的话,主页需要重新刷新
|
| | | Phone.UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | if (deleteRoom == true)
|
| | | {
|
| | | //从房间中删除
|
| | |
| | | info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul;
|
| | | info.ObjectTypeNameId = 60011;//新风
|
| | | }
|
| | | //15 PM2.5传感器设备
|
| | | else if (dicType.ContainsKey(DeviceType.PMSensor) == true)
|
| | | {
|
| | | info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307;
|
| | | info.BeloneType = DeviceBeloneType.A传感器;
|
| | | info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
|
| | | info.ObjectTypeNameId = 60000;//传感器
|
| | | }
|
| | |
|
| | | int value = (int)info.BeloneType;
|
| | | if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
|
| | |
| | | list.Add(DeviceBeloneType.A未知设备); |
| | | |
| | | return list;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备在线状态列表_______________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取设备在线状态列表(注意,一个设备只返回一个回路)
|
| | | /// </summary>
|
| | | /// <param name="gwId">网关id</param>
|
| | | /// <returns></returns>
|
| | | public List<CommonDevice> GetDeviceOnlineList(string gwId)
|
| | | {
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | int statu = 0;
|
| | | var listDevice = this.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu == -1)
|
| | | {
|
| | | //当出现异常时,使用后备操作,直接获取本地的设备列表
|
| | | listDevice = this.GetDeviceByGatewayID(gwId);
|
| | | }
|
| | |
|
| | | var dicDevice = new Dictionary<string, CommonDevice>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | if (dicDevice.ContainsKey(device.DeviceAddr) == false)
|
| | | {
|
| | | dicDevice[device.DeviceAddr] = device;
|
| | | continue;
|
| | | }
|
| | | //设备是否处于在线状态
|
| | | bool online = this.CheckDeviceIsOnline(device);
|
| | | if (online == true)
|
| | | {
|
| | | //如果设备回路在线,则优先使用在线的回路,后来的直接覆盖
|
| | | dicDevice[device.DeviceAddr] = device;
|
| | | }
|
| | | }
|
| | | var listReturn = new List<CommonDevice>();
|
| | | foreach (var device in dicDevice.Values)
|
| | | {
|
| | | listReturn.Add(device);
|
| | | }
|
| | | return listReturn;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName;
|
| | | }
|
| | | mainDevice.CurrentGateWayId = device.CurrentGateWayId;
|
| | | mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType;
|
| | | mainDevice.IsOnline = device.DeviceInfo.IsOnline;
|
| | | mainDevice.DriveCode = device.DeviceInfo.DriveCode;
|
| | | mainDevice.IasDeviceType = device.DeviceInfo.DeviceType;
|
| | |
| | | else if (deviceType == DeviceType.FreshAir) { device = new FreshAir(); }
|
| | | else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); }
|
| | | else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
|
| | | else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); }
|
| | | else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
|
| | | else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
|
| | | else { return null; }
|
| | |
| | | /// <summary>
|
| | | /// 吸顶燃气传感器
|
| | | /// </summary>
|
| | | Sensor_CeilingGas = 1306, |
| | | /// <summary> |
| | | /// PM2.5空气质量传感器 |
| | | /// </summary> |
| | | Sensor_CeilingGas = 1306,
|
| | | /// <summary>
|
| | | /// PM2.5空气质量传感器
|
| | | /// </summary>
|
| | | Sensor_PMTwoPointFive = 1307,
|
| | | |
| | |
|
| | | /// <summary>
|
| | | /// 运动传感器
|
| | | /// </summary>
|
| | |
| | | //当住宅为空时先提示用户新建住宅 |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | alert.Show(); |
| | | alert.ResultEventHandler += (sender, e) => |
| | | { |
| | | if (e) |
| | | { |
| | | // |
| | | } |
| | | }; |
| | | } |
| | | else |
| | | { |
| | |
| | | listHouse.Add(house); |
| | | } |
| | | //如果切换了账号,或者原来的id不存在,则重置住宅ID |
| | | if (UserCenterResourse.ResidenceOption.TheSameLoginAccount == false || |
| | | if (Config.Instance.TheSameLoginAccount == false || |
| | | Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) |
| | | { |
| | | Config.Instance.HomeId = listHouse[0].Id; |
| | |
| | | //目前不知道郭雪城的这个具体放在哪个的位置
|
| | | this.functionSceneAutoBodyView = new FrameLayout();
|
| | | functionSceneAutoBodyView.Y = frameSwitchBack.Bottom;
|
| | | functionSceneAutoBodyView.Height = Application.GetRealHeight(1423);
|
| | | functionSceneAutoBodyView.Height = bodyFrameLayout.Height - frameSwitchBack.Bottom;
|
| | | bodyFrameLayout.AddChidren(functionSceneAutoBodyView);
|
| | |
|
| | | //场景,功能,自动化的切换控件
|
| | |
| | | var dicGroupDevice = this.GetAllGroupDevice(room);
|
| | | if (dicGroupDevice.Count == 0)
|
| | | {
|
| | | this.ShowNoFunctionTip();
|
| | | //没有功能{0}请在个人中心--设备管理处添加
|
| | | string[] arryMsg = Language.StringByID(R.MyInternationalizationString.NoFunction).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | this.ShowNotDataImage(functionSceneBodyView, arryMsg);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 提示没有功能
|
| | | /// </summary>
|
| | | private void ShowNoFunctionTip()
|
| | | {
|
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunction);
|
| | |
|
| | | var noFunctionTip = new Button()
|
| | | {
|
| | | Y = noFunction.Bottom + Application.GetRealHeight(32),
|
| | | Height = Application.GetRealHeight(200),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = Language.StringByID(R.MyInternationalizationString.NoFunction).Replace("{\\r\\n}", "\r\n"),
|
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
|
| | | TextAlignment = TextAlignment.Center,
|
| | | IsMoreLines = true
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunctionTip);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化设备列表控件_________________
|
| | |
| | | }
|
| | | // PM2.5
|
| | | else if (device.Type == DeviceType.PMSensor)
|
| | | { |
| | | } |
| | | //彩灯(调光器) |
| | | {
|
| | | cardContr = new Controls.DevicePmSensorRowControl();
|
| | | }
|
| | | //彩灯(调光器)
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | | {
|
| | | cardContr = new Controls.DeviceColorLightRowControl();
|
| | |
| | | }
|
| | | if (listScene.Count == 0)
|
| | | {
|
| | | this.ShowNoSceneTip();
|
| | | //没有场景{0}请点击右上角添加
|
| | | string[] arryMsg = Language.StringByID(R.MyInternationalizationString.NoScene).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | this.ShowNotDataImage(functionSceneBodyView, arryMsg);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示没有场景
|
| | | /// </summary>
|
| | | private void ShowNoSceneTip()
|
| | | {
|
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunction);
|
| | |
|
| | | var noScenceTip = new Button()
|
| | | {
|
| | | Y = noFunction.Bottom + Application.GetRealHeight(32),
|
| | | Height = Application.GetRealHeight(200),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}", "\r\n"),
|
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
|
| | | TextAlignment = TextAlignment.Center,
|
| | | IsMoreLines = true
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noScenceTip);
|
| | | }
|
| | |
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般设备状态上报___________________
|
| | |
| | | //获取图片
|
| | | LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneTextId].IconPath = path1;
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = path2;
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = path2; |
| | | dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId; |
| | | if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | dic[typeInfo.BeloneTextId].IconPath = "Device/FreshAirEpoint.png";
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = "Device/FreshAirEpointSelected.png";
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId;
|
| | | if (device.Type == DeviceType.PMSensor)
|
| | | { |
| | | // PM2.5 |
| | | dic[typeInfo.BeloneTextId].IconPath = "Device/AirQualitySensorEpoint.png";
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = "Device/AirQualitySensorEpointSelected.png";
|
| | | dic[typeInfo.BeloneTextId].TextId = R.MyInternationalizationString.AirQualitySensor;
|
| | | }
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | | }
|
New file |
| | |
| | | using System; |
| | | using Shared.Phone.UserCenter; |
| | | using ZigBee.Device; |
| | | namespace Shared.Phone.Category.Controls |
| | | { |
| | | /// <summary>
|
| | | /// 分类界面的PM2.5传感器设备行控件
|
| | | /// </summary> |
| | | public class DevicePmSensorRowControl : DeviceRowCommon |
| | | { |
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="i_device"></param>
|
| | | public override void InitControl(CommonDevice i_device)
|
| | | {
|
| | | base.InitControl(i_device);
|
| | |
|
| | | //添加跳转深度卡片信息事件
|
| | | this.AddDetailInfoEvent(i_device); |
| | | } |
| | | |
| | | #region ■ 深度卡片信息_______________________
|
| | | |
| | | /// <summary>
|
| | | /// 添加跳转深度卡片信息事件
|
| | | /// </summary>
|
| | | private void AddDetailInfoEvent(CommonDevice i_device)
|
| | | {
|
| | | //深度卡片信息
|
| | | this.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | { |
| | | //PM2.5传感器类型的深度卡片界面 |
| | | var form = new MainPage.ControlForm.DevicePmSensorDetailCardForm();
|
| | | form.AddForm(i_device, HdlRoomLogic.Current.CurrentRoom, 965, 1374);
|
| | | form.FormCloseEvent += this.CardDetailInfoBackEvent;
|
| | | };
|
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 发送获取状态命令___________________
|
| | | |
| | | /// <summary>
|
| | | /// 发送获取状态命令
|
| | | /// </summary>
|
| | | public override void SendStatuComand()
|
| | | { |
| | | //检测能否发送获取状态命令 |
| | | //if (this.CheckCanSendStatuComand() == true) |
| | | //{ |
| | | HdlDeviceAttributeLogic.Current.SendFreshAirStatuComand(this.device);
|
| | | //}
|
| | | }
|
| | |
|
| | | #endregion |
| | | } |
| | | } |
| | |
| | | } |
| | | public void Show() |
| | | { |
| | | |
| | | |
| | | #region 界面的布局代码 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic; |
| | | roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate)); |
| | | |
| | | }; |
| | | securityView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | break; |
| | | case 40: |
| | | { |
| | | |
| | | openView.titleBtn.TextID = MyInternationalizationString.smokescreen; |
| | | openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | completeView.Show(1).AddChidren(openView.Show()); |
| | |
| | | } |
| | | break; |
| | | case 43: |
| | | { |
| | | {//召元说的 |
| | | openView.titleBtn.TextID = MyInternationalizationString.gas; |
| | | openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | completeView.Show(1).AddChidren(openView.Show()); |
| | |
| | | |
| | | |
| | | } |
| | | dialog.Close(); |
| | | action(editTime.Text); |
| | | dialog.Close(); |
| | | |
| | | }; |
| | | |
| | |
| | | dialog.Close(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 闪错提示框 |
| | | /// </summary> |
| | |
| | | else if (LogicView.IfString._SoneLogic == if_logic) |
| | | { |
| | | //跳到Sone门锁联动事件列表界面 |
| | | UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//移除所有标记LockListView界面 |
| | | var soneLogicList = new SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | soneLogicList.Show(); |
| | | //UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//移除所有标记LockListView界面 |
| | | //var soneLogicList = new SoneLogicList(); |
| | | //UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //soneLogicList.Show(); |
| | | |
| | | SoneLogicList.soneLogicList?.RefreshView(); |
| | | } |
| | | |
| | | } |
| | |
| | | }; |
| | | fra.AddChidren(roomnameBtn); |
| | | |
| | | if (i == 0)// |
| | | if (i == 0)//默认选中第一个房间 |
| | | { |
| | | roombjButton.IsSelected = false; |
| | | roombjButton = roombjBtn; |
| | |
| | | TextSize = 10, |
| | | }; |
| | | deviceRowLayout.AddChidren(devicetypename); |
| | | |
| | | |
| | | |
| | | //if (i == 0)//默认选中第一个设备类型 |
| | | //{ |
| | | // devicetypeButton.IsSelected = false; |
| | | // devicetypeButton = backgroundColor; |
| | | // backgroundColor.IsSelected = true; |
| | | // var list = Method.GetDeviceType(devicetypename.Text); |
| | | // ConditionDeviceView(list, devicelist); |
| | | //} |
| | | |
| | | EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => |
| | | { |
| | | devicetypeButton.IsSelected = false; |
| | |
| | | ///显示房间所有设备 |
| | | ConditionDeviceView(new List<DeviceType>(), devicelist); |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 加载该类型设备视图方法 |
| | |
| | | }; |
| | | //下拉刷新自动化列表的事件 |
| | | logicScrolView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //重新刷新logic列表 |
| | | Common.Logic.LogicList.Clear(); |
| | | Read(logicScrolView, no); |
| | | {
|
| | | if (!Config.Instance.Home.IsVirtually) |
| | | {//虚拟的不获取网关逻辑列表 |
| | | //重新刷新logic列表 |
| | | Common.Logic.LogicList.Clear(); |
| | | Read(logicScrolView, no); |
| | | } |
| | | //关闭刷新View; |
| | | logicScrolView.EndHeaderRefreshing(); |
| | | }; |
| | |
| | | /// <param name="logicScrolView"></param> |
| | | private static async void Read(VerticalRefreshLayout logicScrolView, bool no) |
| | | { |
| | | //if (Config.Instance.HomeId != UserCenter.UserCenterResourse.AccountOption.OldHomeStringId) |
| | | //{ |
| | | // //切换住宅清除之前缓存数据; |
| | | // Common.Logic.LogicList.Clear(); |
| | | // Common.Logic.LockLogicList.Clear(); |
| | | // Common.Logic.SoneLogicList.Clear(); |
| | | //} |
| | | |
| | | CommonPage.Loading.Start(); |
| | | try |
| | | { |
old mode 100644
new mode 100755
| | |
| | | { |
| | | public class SoneLogicList : FrameLayout |
| | | { |
| | | /// <summary> |
| | | /// 给Sone门锁徐梅更新界面用的 |
| | | /// </summary> |
| | | /// |
| | | |
| | | public static SoneLogicList soneLogicList; |
| | | public SoneLogicList() |
| | | { |
| | | Tag = "SoneLogic"; |
| | | soneLogicList = this; |
| | | } |
| | | /// 给徐梅刷新界面用的 |
| | | public Action<bool> action; |
| | | ///第二块第一级父控件 |
| | | FrameLayout fLayout = new FrameLayout(); |
| | | ///常开模式图标 |
| | | Button modeIconBtn = new Button(); |
| | | ///第二块第二级父控件 |
| | | FrameLayout modeFl = new FrameLayout(); |
| | | Button button1 = new Button(); |
| | | Button button2= new Button(); |
| | | ///第三块第一级父控件 |
| | | FrameLayout listLogicFl = new FrameLayout(); |
| | | ///常开自动化列表上下滑动的控件 |
| | | VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout(); |
| | | |
| | | public async void Show() |
| | | { |
| | | |
| | |
| | | UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.TextID = MyInternationalizationString.selection; |
| | | view.toptitleNameBtn.TextID = MyInternationalizationString.openmode; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | RemoveFromParent(); |
| | | UserView.HomePage.Instance.ScrollEnabled = true;
|
| | | if (updateThread != null && updateThread.IsAlive) |
| | | { |
| | | updateThread.Abort(); |
| | | } |
| | | //把静态变量的这个东西置空 |
| | | soneLogicList = null; |
| | | this.RemoveFromParent(); |
| | | if (action != null) |
| | | { |
| | | action(Send.CurrentDoorLock.IsDoorLockNormallyMode); |
| | |
| | | |
| | | #region 常开模式图标 时效性常开设置 |
| | | ///第二块第一级父控件 |
| | | var fLayout = new FrameLayout |
| | | fLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080), |
| | | Height = Application.GetRealHeight(829 - 184), |
| | |
| | | }; |
| | | middle.AddChidren(fLayout); |
| | | ///常开模式图标 |
| | | var modeIconBtn = new Button |
| | | modeIconBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(395), |
| | | Y = Application.GetRealHeight(92), |
| | |
| | | Height = Application.GetMinRealAverage(294), |
| | | }; |
| | | fLayout.AddChidren(modeIconBtn); |
| | | |
| | | if (Send.CurrentDoorLock.IsDoorLockNormallyMode) |
| | | ///第二块第二级父控件 |
| | | modeFl = new FrameLayout |
| | | { |
| | | /// 查找是否存在时效性自动化;有的话就返回自动化对象; |
| | | var logic = await SkipView.GetLogicIfon(); |
| | | }; |
| | | fLayout.AddChidren(modeFl); |
| | | |
| | | fLayout.Height = Application.GetRealHeight(780);//改变高度 |
| | | modeIconBtn.UnSelectedImagePath = "ZigeeLogic/openMode.png";//改变图标状态 |
| | | ///第二级父控件 |
| | | var openModeFl = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(455), |
| | | Height = Application.GetRealHeight(127 + 199), |
| | | Width = Application.GetRealWidth(1080), |
| | | }; |
| | | fLayout.AddChidren(openModeFl); |
| | | ///关闭时效性自动化 |
| | | Button closeBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(86), |
| | | Height = Application.GetRealHeight(127), |
| | | Width = Application.GetRealWidth(907), |
| | | Radius = (uint)Application.GetRealHeight(58), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, |
| | | TextID = MyInternationalizationString.closeUp, |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | TextSize = 16, |
| | | }; |
| | | openModeFl.AddChidren(closeBtn); |
| | | closeBtn.MouseUpEventHandler += async (sender, e) => |
| | | { |
| | | var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); |
| | | if (result)
|
| | | { |
| | | if (logic != null) |
| | | { |
| | | ///有可能只有常开模式,没有时效性自动化 |
| | | ///没有判断的话,逻辑会为空,抛出异常; |
| | | Send.DelLogic(logic.LogicId); |
| | | } |
| | | Send.CurrentDoorLock.IsDoorLockNormallyMode = false; |
| | | this.RemoveFromParent(); |
| | | var soneLogicList = new SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | soneLogicList.Show(); |
| | | soneLogicList.action = action;
|
| | | } |
| | | else |
| | | { |
| | | LogicView.TipView.ShowFlashTip("关闭失败"); |
| | | } |
| | | |
| | | }; |
| | | |
| | | ///显示失效设置时间文本控件 |
| | | var timeTextBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(127 + 69), |
| | | X = Application.GetRealWidth(125), |
| | | Width = Application.GetRealWidth(634 + 200), |
| | | Height = Application.GetRealHeight(60), |
| | | TextSize = 15, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | Text = "时效性常开设置12:20", |
| | | }; |
| | | if (logic != null) |
| | | { |
| | | ///有时效性常开才显示时间条件文本 |
| | | openModeFl.AddChidren(timeTextBtn); |
| | | } |
| | | ///时效性常开只有一个条件; |
| | | try |
| | | { |
| | | var y = DateTime.Now.ToString("yy");//那一年 |
| | | var m = DateTime.Now.ToString("mm");//那一月 |
| | | var d = DateTime.Now.ToString("dd");//那一天 |
| | | var h = int.Parse(DateTime.Now.ToString("HH"));//当前系统时间 |
| | | var me = DateTime.Now.ToLongDateString(); |
| | | var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); |
| | | int dayInt = (h + timeInt) / 24;//算出几天后执行 |
| | | int hour = (h + timeInt) % 24;//算出几天后那个时间执行 |
| | | int days = int.Parse(d) + dayInt; |
| | | timeTextBtn.Text = "时效性常开设置" + y + "年" + m + "月" + days.ToString() + "号" + hour.ToString() + "时" + "执行"; |
| | | } |
| | | catch { } |
| | | |
| | | } |
| | | else |
| | | button1 = new Button |
| | | { |
| | | fLayout.Height = Application.GetRealHeight(645);//改变高度 |
| | | modeIconBtn.UnSelectedImagePath = "ZigeeLogic/noMode.png";//改变图标状态 |
| | | ///第二级父控件 |
| | | var modeFl = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(478), |
| | | X = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(138), |
| | | Width = Application.GetRealWidth(1022), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | }; |
| | | fLayout.AddChidren(modeFl); |
| | | modeFl.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft); |
| | | modeFl.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); |
| | | ///时效性常开设置显示文本控件 |
| | | var modeTextBtn = new Button |
| | | { |
| | | }; |
| | | modeFl.AddChidren(button1); |
| | | |
| | | Y = Application.GetRealHeight(40), |
| | | X = Application.GetRealWidth(58), |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(60), |
| | | TextSize = 15, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | // Text = "时效性常开设置", |
| | | TextID = MyInternationalizationString.timeSetSone, |
| | | }; |
| | | modeFl.AddChidren(modeTextBtn); |
| | | ///下一级菜单图标控件 |
| | | var nextIconBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(104), |
| | | Height = Application.GetMinRealAverage(104), |
| | | X = Application.GetRealWidth(861), |
| | | Y = Application.GetRealHeight(17), |
| | | UnSelectedImagePath = "ZigeeLogic/nextIconSone.png", |
| | | }; |
| | | modeFl.AddChidren(nextIconBtn); |
| | | |
| | | |
| | | |
| | | nextIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | LogicView.TipView.ShowConfrimTip(() => |
| | | |
| | | {///再次确认 |
| | | LogicView.TipView.ShowInputTip(true, async (str) => |
| | | {///确认发送命令 |
| | | try |
| | | { |
| | | ///xm |
| | | var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); |
| | | if (!result) |
| | | { |
| | | LogicView.TipView.ShowFlashTip("开启失败"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | ///因为有常开模式下才可以创建失效逻辑; |
| | | SkipView.GetLogicAll();//删除之前所有失效逻辑 |
| | | var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑 |
| | | if (!addResult) |
| | | { |
| | | ///提示失败 |
| | | LogicView.TipView.ShowFlashTip("添加失败"); |
| | | return; |
| | | } |
| | | Send.CurrentDoorLock.IsDoorLockNormallyMode = true; |
| | | this.RemoveFromParent(); |
| | | var soneLogicList = new SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(soneLogicList); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | soneLogicList.Show(); |
| | | soneLogicList.action = action; |
| | | //soneLogicList.action += (c) => { |
| | | // if (action != null) |
| | | // { |
| | | // action(Send.CurrentDoorLock.IsDoorLockNormallyMode); |
| | | // } |
| | | //}; |
| | | |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | |
| | | }; |
| | | } |
| | | |
| | | button2 = new Button |
| | | { |
| | | }; |
| | | modeFl.AddChidren(button2); |
| | | ModeView(); |
| | | #endregion |
| | | |
| | | #region 常开自动化 |
| | | ///第三块第一级父控件 |
| | | var listLogicFl = new FrameLayout |
| | | listLogicFl = new FrameLayout |
| | | { |
| | | Y = fLayout.Bottom, |
| | | X = Application.GetRealWidth(58), |
| | |
| | | UnSelectedImagePath = "ZigeeLogic/add.png", |
| | | }; |
| | | addLogicfL.AddChidren(addIconBtn); |
| | | addIconBtn.MouseUpEventHandler += (sender, e) => |
| | | |
| | | var addIconclickBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(90+69+63), |
| | | Height = Application.GetRealHeight(69), |
| | | X = Application.GetRealWidth(800), |
| | | Y = Application.GetRealHeight(60), |
| | | }; |
| | | addLogicfL.AddChidren(addIconclickBtn); |
| | | addIconclickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | //读取系统当前时间:时-分 |
| | |
| | | }; |
| | | |
| | | ///常开自动化列表上下滑动的控件 |
| | | var verticalRefresh = new VerticalRefreshLayout |
| | | verticalRefresh = new VerticalRefreshLayout |
| | | { |
| | | |
| | | Y = addLogicfL.Bottom, |
| | |
| | | verticalRefresh.BeginHeaderRefreshingAction += () => |
| | | { |
| | | Common.Logic.SoneLogicList.Clear(); |
| | | Read(verticalRefresh, false); |
| | | Read(false); |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | }; |
| | | Read(verticalRefresh, true); |
| | | Read(true); |
| | | #endregion |
| | | } |
| | | /// <summary> |
| | | /// 常开模式开关切换图标界面 |
| | | /// </summary> |
| | | public async void ModeView() |
| | | { |
| | | |
| | | if (Send.CurrentDoorLock.IsDoorLockNormallyMode) |
| | | { |
| | | /// 查找是否存在时效性自动化;有的话就返回自动化对象; |
| | | var logic = await SkipView.GetLogicIfon(); |
| | | |
| | | fLayout.Height = Application.GetRealHeight(780);//改变高度 |
| | | modeIconBtn.UnSelectedImagePath = "ZigeeLogic/openMode.png";//改变图标状态 |
| | | modeFl.Y = modeIconBtn.Bottom + Application.GetRealHeight(64); |
| | | modeFl.X = Application.GetRealWidth(0); |
| | | modeFl.Height = Application.GetRealHeight(127 + 199); |
| | | modeFl.Width = Application.GetRealHeight(1080); |
| | | modeFl.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; |
| | | modeFl.SetCornerWithSameRadius(Application.GetRealHeight(0), HDLUtils.RectCornerBottomLeft); |
| | | |
| | | ///关闭时效性自动化 |
| | | button1.Y = Application.GetRealHeight(0); |
| | | button1.X = Application.GetRealWidth(86); |
| | | button1.Width = Application.GetRealWidth(907); |
| | | button1.Height = Application.GetRealHeight(127); |
| | | button1.Radius = (uint)Application.GetRealHeight(58); |
| | | button1.BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor; |
| | | button1.TextAlignment = TextAlignment.Center; |
| | | button1.TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor; |
| | | button1.TextID = MyInternationalizationString.closeUp; |
| | | button1.TextSize = 16; |
| | | |
| | | button1.MouseUpEventHandler = async (sender, e) => |
| | | { |
| | | var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); |
| | | if (result) |
| | | { |
| | | if (logic != null) |
| | | { |
| | | ///有可能只有常开模式,没有时效性自动化 |
| | | ///没有判断的话,逻辑会为空,抛出异常; |
| | | Send.DelLogic(logic.LogicId); |
| | | } |
| | | Send.CurrentDoorLock.IsDoorLockNormallyMode = false; |
| | | ModeView(); |
| | | } |
| | | else |
| | | { |
| | | LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.closeFailed)); |
| | | } |
| | | |
| | | }; |
| | | if (logic != null) |
| | | { |
| | | ///显示失效设置时间文本控件 |
| | | button2.Y = Application.GetRealHeight(127 + 69); |
| | | button2.X = Application.GetRealWidth(125); |
| | | button2.Width = Application.GetRealWidth(634 + 200); |
| | | button2.Height = Application.GetRealHeight(60); |
| | | button2.UnSelectedImagePath = "ZigeeLogic/1234.png"; |
| | | button2.TextSize = 15; |
| | | button2.TextColor = ZigbeeColor.Current.LogicTextBlackColor; |
| | | ///有时效性常开才显示时间条件文本 |
| | | } |
| | | else |
| | | { |
| | | button2.Width = Application.GetRealWidth(0); |
| | | button2.Height = Application.GetRealHeight(0); |
| | | } |
| | | ///时效性常开只有一个条件; |
| | | try |
| | | { |
| | | |
| | | var y = DateTime.Now.Year.ToString();//那一年 |
| | | var m = DateTime.Now.Month.ToString();//那一月 |
| | | var d = DateTime.Now.ToString("dd");//那一天 |
| | | var h = int.Parse(DateTime.Now.ToString("HH"));//当前系统时间 |
| | | var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); |
| | | int dayInt = (h + timeInt) / 24;//算出几天后执行 |
| | | int hour = (h + timeInt) % 24;//算出几天后那个时间执行 |
| | | int days = int.Parse(d) + dayInt; |
| | | string text1 = Language.StringByID(MyInternationalizationString.timeSensitive); |
| | | string text2 = Language.StringByID(MyInternationalizationString.yearSone); |
| | | string text3 = Language.StringByID(MyInternationalizationString.monthSone); |
| | | string text4 = Language.StringByID(MyInternationalizationString.numberSone); |
| | | string text5 = Language.StringByID(MyInternationalizationString.executeSone); |
| | | button2.Text = text1 + y + text2 + m + text3 + days.ToString() + text4 + hour.ToString() + text5; |
| | | } |
| | | catch { } |
| | | |
| | | } |
| | | else |
| | | { |
| | | fLayout.Height = Application.GetRealHeight(645);//改变高度 |
| | | modeIconBtn.UnSelectedImagePath = "ZigeeLogic/noMode.png";//改变图标状态 |
| | | modeFl.Y = modeIconBtn.Bottom + Application.GetRealHeight(92); |
| | | modeFl.X = Application.GetRealWidth(58); |
| | | modeFl.Height = Application.GetRealHeight(138); |
| | | modeFl.Width = Application.GetRealHeight(1022); |
| | | modeFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | modeFl.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); |
| | | |
| | | ///时效性常开设置显示文本控件 |
| | | button1.Y = Application.GetRealHeight(40); |
| | | button1.X = Application.GetRealWidth(58); |
| | | button1.Width = Application.GetRealWidth(600); |
| | | button1.Height = Application.GetRealHeight(60); |
| | | button1.Radius = (uint)Application.GetRealHeight(0); |
| | | button1.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | button1.TextAlignment = TextAlignment.CenterLeft; |
| | | button1.TextColor = ZigbeeColor.Current.LogicTextBlackColor; |
| | | // Text = "时效性常开设置", |
| | | button1.TextID = MyInternationalizationString.timeSetSone; |
| | | button1.TextSize = 15; |
| | | |
| | | |
| | | ///下一级菜单图标控件 |
| | | button2.Width = Application.GetMinRealAverage(104); |
| | | button2.Height = Application.GetMinRealAverage(104); |
| | | button2.X = Application.GetRealWidth(861); |
| | | button2.Y = Application.GetRealHeight(17); |
| | | button2.UnSelectedImagePath = "ZigeeLogic/nextIconSone.png"; |
| | | button2.TextSize = 15; |
| | | button2.TextColor = ZigbeeColor.Current.LogicTextBlackColor; |
| | | button2.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | LogicView.TipView.ShowConfrimTip(() => |
| | | |
| | | {///再次确认 |
| | | LogicView.TipView.ShowInputTip(true, async (str) => |
| | | {///确认发送命令 |
| | | try |
| | | { |
| | | ///xm |
| | | var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); |
| | | if (!result) |
| | | { |
| | | LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed)); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | ///因为有常开模式下才可以创建失效逻辑; |
| | | SkipView.GetLogicAll();//删除之前所有失效逻辑 |
| | | var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑 |
| | | if (!addResult) |
| | | { |
| | | ///可欣说如果常开模式开,创建自动化失败,那么将要发一条常开模式关闭命令; |
| | | UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); |
| | | ///提示失败 |
| | | LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed)); |
| | | return; |
| | | } |
| | | Send.CurrentDoorLock.IsDoorLockNormallyMode = true; |
| | | ModeView();
|
| | | //添加App开启常开模式的历史记录
|
| | | UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | |
| | | }; |
| | | } |
| | | |
| | | listLogicFl.Y = fLayout.Bottom; |
| | | listLogicFl.X = Application.GetRealWidth(58); |
| | | listLogicFl.Height = Application.GetRealHeight(Method.H - 184) - fLayout.Height; |
| | | listLogicFl.Width = Application.GetRealWidth(1022); |
| | | listLogicFl.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | } |
| | | /// <summary> |
| | | /// 读取自动化列表数据; |
| | | /// </summary> |
| | | /// <param name="verticalRefresh"></param> |
| | | private async void Read(VerticalRefreshLayout verticalRefresh, bool yes) |
| | | /// <param name="yes"></param> |
| | | private async void Read( bool yes) |
| | | { |
| | | if (yes) |
| | | { |
| | |
| | | var dd = e.Message; |
| | | } |
| | | //自动化 |
| | | RefreshView(verticalRefresh); |
| | | RefreshView(); |
| | | if (yes) |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | } |
| | | } |
| | | |
| | | RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态 |
| | | int a = 1; |
| | | /// <summary> |
| | | /// 加载自动化列表 |
| | | /// </summary> |
| | | /// <param name="verticalRefresh"></param> |
| | | RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态 |
| | | int a = 1; |
| | | private void RefreshView(VerticalRefreshLayout verticalRefresh) |
| | | public void RefreshView() |
| | | { |
| | | verticalRefresh.RemoveAll(); |
| | | foreach (var logic in Common.Logic.SoneLogicList) |
| | | { |
| | | #region 自动化布局View |
| | | |
| | | ///自动化父控件 |
| | | var fLayout = new FrameLayout |
| | | var fLayoutLogic = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(184), |
| | | }; |
| | | verticalRefresh.AddChidren(fLayout); |
| | | verticalRefresh.AddChidren(fLayoutLogic); |
| | | ///左右可滑动控件 |
| | | var logicRow = new RowLayout |
| | | { |
| | |
| | | SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少; |
| | | Tag = a.ToString(), |
| | | }; |
| | | fLayout.AddChidren(logicRow); |
| | | fLayoutLogic.AddChidren(logicRow); |
| | | //左滑菜单事件 |
| | | logicRow.OpenMenuAction += () => |
| | | { |
| | |
| | | ///线的控件 |
| | | var line = new Button |
| | | { |
| | | Y = fLayout.Height - 1, |
| | | Y = fLayoutLogic.Height - 1, |
| | | Height = 1, |
| | | Width = Application.GetRealWidth(976), |
| | | BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | fLayout.AddChidren(line); |
| | | fLayoutLogic.AddChidren(line); |
| | | #endregion |
| | | ///开关点击事件 |
| | | switchBtn.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | { |
| | | Common.Logic.SoneLogicList.Remove(logic); |
| | | //logicRow.Parent.RemoveFromParent(); |
| | | fLayout.RemoveFromParent(); |
| | | fLayoutLogic.RemoveFromParent(); |
| | | Send.DelLogic(logic.LogicId);
|
| | | }; |
| | | |
| | | };
|
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 定时更新常开模式(防止通过门锁关闭没及时刷新状态) |
| | | /// </summary> |
| | | System.Threading.Thread updateThread; |
| | | public void UpdateModeIcon() |
| | | { |
| | | updateThread = new System.Threading.Thread(() => |
| | | { |
| | | while (this.Parent != null) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | ModeView(); |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | } |
| | | }); |
| | | updateThread.Start(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | {
|
| | | this.RemoveFromParent();
|
| | | CommonPage.Instance.RemoveViewByTag("Login");
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | });
|
| | | });
|
| | | };
|
| | |
| | | {
|
| | | this.RemoveFromParent();
|
| | | CommonPage.Instance.RemoveViewByTag("Login");
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | });
|
| | | }
|
| | | else
|
| | |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
|
| | | var revertData = responseDataObj;
|
| | | //标记上一次是不是同一个账号登陆
|
| | | UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.Account = revertData.Account;
|
| | | Config.Instance.MD5PWD = revertData.MD5PWD;
|
| | | Config.Instance.Guid = revertData.Guid;
|
| | |
| | | var revertData = responseDataObj;
|
| | | Config.ReFresh();
|
| | | //标记上一次是不是同一个账号登陆
|
| | | UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.Account = revertData.Account;
|
| | | Config.Instance.Password = i_psw;
|
| | | Config.Instance.MD5PWD = revertData.MD5PWD;
|
| | |
| | | CommonPage.Loading.Hide();
|
| | | this.RemoveFromParent();
|
| | | CommonPage.Instance.RemoveViewByTag("Login");
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | });
|
| | | return;
|
| | | }
|
| | |
| | | this.RemoveFromParent();
|
| | | CommonPage.Instance.RemoveViewByTag("Register");
|
| | | CommonPage.Instance.RemoveViewByTag("Login");
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | });
|
| | | }
|
| | | else
|
| | |
| | | /// <summary>
|
| | | /// 控件
|
| | | /// </summary>
|
| | | private FreshAir FreshAirDev = null;
|
| | | private FreshAir freshAirDev = null;
|
| | | /// <summary>
|
| | | /// 状态控件
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// 设备名称控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnDeviceName = null; |
| | | |
| | | private NormalViewControl btnDeviceName = null;
|
| | |
|
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) |
| | | { |
| | | |
| | | //左滑不能 |
| | | this.ScrollEnabled = true;
|
| | | this.FreshAirDev = (FreshAir)this.device; |
| | | this.freshAirDev = (FreshAir)this.device; |
| | | //先清空 |
| | | this.listControl = new List<ButtonBase>(); |
| | | InitFreshAirControl(frameWhiteBack); |
| | |
| | | frameAcBack.BackgroundImagePath = "FreshAir/FreshAirPic.png"; |
| | | frameWhiteBack.AddChidren(frameAcBack); |
| | | |
| | | //新风自动Layout【为了扩大点击范围】 |
| | | var autoFrameLayout = new NormalViewControl(213 + 40, 63 + 80, true);
|
| | | autoFrameLayout.X = Application.GetRealWidth(275 - 20);
|
| | | autoFrameLayout.Y = Application.GetRealHeight(821 - 20); |
| | | frameWhiteBack.AddChidren(autoFrameLayout); |
| | | autoFrameLayout.ButtonClickEvent += HandlerAuto; |
| | | |
| | | // 自动(第1个,listControl【0】)
|
| | | var btnAuto = new NormalViewControl(213, 63, true);
|
| | | btnAuto.X = Application.GetRealWidth(275);
|
| | |
| | | btnAuto.IsBold = false; |
| | | btnAuto.TextAlignment = TextAlignment.Center; |
| | | frameWhiteBack.AddChidren(btnAuto);
|
| | |
|
| | | this.listControl.Add(btnAuto);
|
| | | btnAuto.ButtonClickEvent += (sender, e) =>
|
| | | { |
| | | if (!btnAuto.IsSelected) |
| | | { |
| | | this.SetFanComand(5); |
| | | } |
| | | }; |
| | | btnAuto.ButtonClickEvent += HandlerAuto; |
| | | |
| | | //自动下划线(第2个,listControl【1】) |
| | | var btnAutoLine = new NormalViewControl(72, 12, true);
|
| | |
| | | btnAutoLine.Visible = false; |
| | | frameWhiteBack.AddChidren(btnAutoLine);
|
| | | this.listControl.Add(btnAutoLine); |
| | | btnAutoLine.ButtonClickEvent += HandlerAuto; |
| | | |
| | | //新风手动Layout【为了扩大点击范围】 |
| | | var manualFrameLayout = new NormalViewControl(213 + 40, 63 + 80, true);
|
| | | manualFrameLayout.X = Application.GetRealWidth(488 - 20);
|
| | | manualFrameLayout.Y = Application.GetRealHeight(821 - 20); |
| | | frameWhiteBack.AddChidren(manualFrameLayout); |
| | | manualFrameLayout.ButtonClickEvent += HandlerManual; |
| | | |
| | | //手动(第3个,listControl【2】) |
| | | var btnManual = new NormalViewControl(213, 63, true);
|
| | |
| | | btnManual.TextAlignment = TextAlignment.Center; |
| | | frameWhiteBack.AddChidren(btnManual);
|
| | | this.listControl.Add(btnManual);
|
| | | btnManual.ButtonClickEvent += (sender, e) =>
|
| | | { |
| | | if (!btnManual.IsSelected) |
| | | { |
| | | this.SetFanComand(15); |
| | | } |
| | | }; |
| | | btnManual.ButtonClickEvent += HandlerManual; |
| | | |
| | | //手动下划线(第4个,listControl【3】) |
| | | var btnManualLine = new NormalViewControl(72, 12, true);
|
| | |
| | | btnManualLine.Visible = false; |
| | | frameWhiteBack.AddChidren(btnManualLine);
|
| | | this.listControl.Add(btnManualLine); |
| | | btnManualLine.ButtonClickEvent += HandlerManual; |
| | | |
| | | //高风(第5个,listControl【4】) |
| | | var btnHighSpeed = new IconViewControl(81);
|
| | |
| | | this.listControl.Add(btnHighSpeed);
|
| | | btnHighSpeed.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (FreshAirDev.currentFanMode == 5) |
| | | if (freshAirDev.currentFanStatus == 0) |
| | | { |
| | | return; |
| | | }
|
| | | if (freshAirDev.currentFanMode == 5) |
| | | { |
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate)); |
| | | msgContr.Show(); |
| | |
| | | |
| | | if (!btnHighSpeed.IsSelected) |
| | | { |
| | | this.listControl[4].Enable = false; |
| | | this.SetFanComand(3); |
| | | }
|
| | | };
|
| | |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | if (btnSwitch.IsSelected) |
| | | { |
| | | this.listControl[5].Enable = false; |
| | | this.SetFanComand(4); |
| | | } |
| | | else |
| | | { |
| | | this.listControl[5].Enable = false; |
| | | this.SetFanComand(0); |
| | | } |
| | | };
|
| | |
| | | this.listControl.Add(btnLowSpeed);
|
| | | btnLowSpeed.ButtonClickEvent += (sender, e) =>
|
| | | { |
| | | if (FreshAirDev.currentFanMode == 5) |
| | | if (freshAirDev.currentFanStatus == 0) |
| | | { |
| | | return; |
| | | } |
| | | if (freshAirDev.currentFanMode == 5) |
| | | { |
| | | var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AutoModeForbiddenOperate)); |
| | | msgContr.Show(); |
| | |
| | | } |
| | | if (!btnLowSpeed.IsSelected) |
| | | { |
| | | this.listControl[6].Enable = false; |
| | | this.SetFanComand(1); |
| | | }
|
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自动事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void HandlerAuto(object sender, MouseEventArgs e)
|
| | | { |
| | | if (freshAirDev.currentFanStatus == 0) |
| | | { |
| | | return; |
| | | } |
| | | if (freshAirDev.currentFanMode == 5) |
| | | { |
| | | return; |
| | | } |
| | | if (!listControl[0].IsSelected) |
| | | { |
| | | this.listControl[0].Enable = false; |
| | | this.SetFanComand(5); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 手动事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void HandlerManual(object sender, MouseEventArgs e)
|
| | | { |
| | | if (freshAirDev.currentFanStatus == 0) |
| | | { |
| | | return; |
| | | } |
| | | if (freshAirDev.currentFanMode == 15) |
| | | { |
| | | return; |
| | | } |
| | | if (!this.listControl[2].IsSelected) |
| | | { |
| | | this.listControl[2].Enable = false; |
| | | this.SetFanComand(15); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | |
| | | }
|
| | | }
|
| | | }
|
| | | this.listControl[0].Enable = true;
|
| | | this.listControl[2].Enable = true;
|
| | | this.listControl[4].Enable = true;
|
| | | this.listControl[5].Enable = true;
|
| | | this.listControl[6].Enable = true;
|
| | | return false;
|
| | | } |
| | | #endregion |
| | |
| | | switch (command) |
| | | { |
| | | case 0: |
| | | FreshAirDev.Close(); |
| | | freshAirDev.Close(); |
| | | break; |
| | | case 1: |
| | | FreshAirDev.SetLowSpeed(); |
| | | freshAirDev.SetLowSpeed(); |
| | | break; |
| | | case 3: |
| | | FreshAirDev.SetHighSpeed(); |
| | | freshAirDev.SetHighSpeed(); |
| | | break; |
| | | case 4: |
| | | FreshAirDev.Open(); |
| | | freshAirDev.Open(); |
| | | break; |
| | | case 5: |
| | | FreshAirDev.SetAuto(); |
| | | freshAirDev.SetAuto(); |
| | | break; |
| | | case 15: |
| | | FreshAirDev.SetManual(); |
| | | freshAirDev.SetManual(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | private void UpdateStatus() |
| | | { |
| | | //设置状态文字 |
| | | if (FreshAirDev.currentFanStatus == 4)
|
| | | if (freshAirDev.currentFanStatus == 4)
|
| | | { |
| | | this.listControl[5].Enable = true; |
| | | //打开 |
| | | this.listControl[5].IsSelected = true; |
| | | //设置状态文字 |
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); |
| | | }
|
| | | if (FreshAirDev.currentFanStatus == 0)
|
| | | if (freshAirDev.currentFanStatus == 0)
|
| | | {
|
| | | //关闭
|
| | | this.listControl[0].TextColor = ZigbeeColor.Current.XMGray3; |
| | |
| | | this.listControl[3].Visible = false; |
| | | this.listControl[4].IsSelected = false; |
| | | this.listControl[5].IsSelected = false; |
| | | this.listControl[6].IsSelected = false;
|
| | | this.listControl[6].IsSelected = false; |
| | | this.listControl[5].Enable = true;
|
| | | //设置状态文字
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
|
| | | return; |
| | | } |
| | | |
| | | //设置模式 |
| | | if (FreshAirDev.currentFanMode == 5)
|
| | | if (freshAirDev.currentFanMode == 5)
|
| | | { |
| | | this.listControl[0].TextColor = ZigbeeColor.Current.XMGray1; |
| | | this.listControl[0].IsBold = true; |
| | |
| | | this.listControl[2].TextColor = ZigbeeColor.Current.XMGray3; |
| | | this.listControl[2].IsBold = false; |
| | | this.listControl[3].Visible = false; |
| | | this.listControl[0].Enable = true; |
| | | }
|
| | | else if (FreshAirDev.currentFanMode == 15)
|
| | | else if (freshAirDev.currentFanMode == 15)
|
| | | {
|
| | | this.listControl[0].TextColor = ZigbeeColor.Current.XMGray3; |
| | | this.listControl[0].IsBold = false; |
| | |
| | | this.listControl[2].TextColor = ZigbeeColor.Current.XMGray1; |
| | | this.listControl[2].IsBold = true; |
| | | this.listControl[3].Visible = true; |
| | | this.listControl[2].Enable = true; |
| | | } |
| | | |
| | | //设置风速 |
| | | if (FreshAirDev.currentFanSpeed == 1)
|
| | | if (freshAirDev.currentFanSpeed == 1)
|
| | | { |
| | | this.listControl[4].IsSelected = false; |
| | | this.listControl[6].IsSelected = true; |
| | | this.listControl[6].Enable = true; |
| | | }
|
| | | else if (FreshAirDev.currentFanSpeed == 3)
|
| | | else if (freshAirDev.currentFanSpeed == 3)
|
| | | {
|
| | | this.listControl[4].IsSelected = true; |
| | | this.listControl[6].IsSelected = false; |
| | | this.listControl[4].Enable = true; |
| | | } |
| | | } |
| | | #endregion |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared.Common; |
| | | using Shared.Phone.UserCenter; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.MainPage.ControlForm |
| | | { |
| | | /// <summary>
|
| | | /// PM2.5传感器类型的深度卡片界面
|
| | | /// </summary> |
| | | public class DevicePmSensorDetailCardForm : DeviceDetailCardCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | /// <summary>
|
| | | /// 界面上可以操作的控件
|
| | | /// </summary>
|
| | | private List<ButtonBase> listControl = new List<ButtonBase>(); |
| | | /// <summary>
|
| | | /// 控件
|
| | | /// </summary>
|
| | | private PMSensor pMSensor = null;
|
| | | /// <summary>
|
| | | /// 状态控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnStatu = null;
|
| | | /// <summary>
|
| | | /// 当前的文本
|
| | | /// </summary>
|
| | | private string CurrentText = string.Empty;
|
| | |
|
| | | /// <summary>
|
| | | /// 设备名称控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnDeviceName = null;
|
| | |
|
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) |
| | | { |
| | | //左滑不能 |
| | | this.ScrollEnabled = true;
|
| | | this.pMSensor = (PMSensor)this.device; |
| | | //先清空 |
| | | this.listControl = new List<ButtonBase>(); |
| | | InitFreshAirControl(frameWhiteBack); |
| | | UpdateStatus(); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 初始化PM2.5传感器控件
|
| | | /// </summary>
|
| | | /// <param name="frameWhiteBack"></param>
|
| | | private void InitFreshAirControl(FrameLayout frameWhiteBack)
|
| | | { |
| | | //湿度容器 |
| | | var frameHumidityPic = new FrameLayout(); |
| | | frameHumidityPic.X = Application.GetMinRealAverage(138);
|
| | | frameHumidityPic.Y = Application.GetRealHeight(242);
|
| | | frameHumidityPic.Width = Application.GetMinRealAverage(311);
|
| | | frameHumidityPic.Height = Application.GetMinRealAverage(351); |
| | | frameHumidityPic.BackgroundImagePath = "PM2.5Sensor/HumidityPic.png"; |
| | | frameWhiteBack.AddChidren(frameHumidityPic); |
| | | |
| | | //湿度文本 |
| | | var btnHumidityText = new NormalViewControl(311, 49, true);
|
| | | btnHumidityText.Y = Application.GetRealHeight(45); |
| | | btnHumidityText.TextID = R.MyInternationalizationString.Humidity; |
| | | btnHumidityText.TextSize = 12; |
| | | btnHumidityText.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnHumidityText.TextAlignment = TextAlignment.Center; |
| | | frameHumidityPic.AddChidren(btnHumidityText); |
| | | |
| | | //湿度数据(第1个,listControl【0】) |
| | | var btnHumidityStatus = new NormalViewControl(193, 92, true);
|
| | | btnHumidityStatus.Y = Application.GetRealHeight(181); |
| | | btnHumidityStatus.Text = "20"; |
| | | btnHumidityStatus.TextSize = 32; |
| | | btnHumidityStatus.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnHumidityStatus.TextAlignment = TextAlignment.CenterRight; |
| | | frameHumidityPic.AddChidren(btnHumidityStatus); |
| | | this.listControl.Add(btnHumidityStatus); |
| | | |
| | | //湿度单位 |
| | | var btnHumidityUnit = new NormalViewControl(37 + 81, 40, true);
|
| | | btnHumidityUnit.Y = Application.GetRealHeight(181 + 46); |
| | | btnHumidityUnit.X = Application.GetRealWidth(190); |
| | | btnHumidityUnit.Text = "%"; |
| | | btnHumidityUnit.TextSize = 14; |
| | | btnHumidityUnit.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnHumidityUnit.TextAlignment = TextAlignment.CenterLeft; |
| | | frameHumidityPic.AddChidren(btnHumidityUnit); |
| | | |
| | | //温度容器 |
| | | var frameTemperaturePic = new FrameLayout(); |
| | | frameTemperaturePic.X = Application.GetMinRealAverage(518);
|
| | | frameTemperaturePic.Y = Application.GetRealHeight(242);
|
| | | frameTemperaturePic.Width = Application.GetMinRealAverage(311);
|
| | | frameTemperaturePic.Height = Application.GetMinRealAverage(351); |
| | | frameTemperaturePic.BackgroundImagePath = "PM2.5Sensor/TemperaturePic.png"; |
| | | frameWhiteBack.AddChidren(frameTemperaturePic); |
| | | //温度文本 |
| | | var btnTemperatureText = new NormalViewControl(311, 49, true);
|
| | | btnTemperatureText.Y = Application.GetRealHeight(45); |
| | | btnTemperatureText.TextID = R.MyInternationalizationString.Temperature; |
| | | btnTemperatureText.TextSize = 12; |
| | | btnTemperatureText.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnTemperatureText.TextAlignment = TextAlignment.Center; |
| | | frameTemperaturePic.AddChidren(btnTemperatureText); |
| | | |
| | | //温度数据(第2个,listControl【1】) |
| | | var btnTemperatureStatus = new NormalViewControl(193, 92, true);
|
| | | btnTemperatureStatus.Y = Application.GetRealHeight(181); |
| | | btnTemperatureStatus.Text = "20"; |
| | | btnTemperatureStatus.TextSize = 32; |
| | | btnTemperatureStatus.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnTemperatureStatus.TextAlignment = TextAlignment.CenterRight; |
| | | frameTemperaturePic.AddChidren(btnTemperatureStatus); |
| | | this.listControl.Add(btnTemperatureStatus); |
| | | |
| | | //温度单位 |
| | | var btnTemperatureUnit = new NormalViewControl(40 + 81, 40, true);
|
| | | btnTemperatureUnit.Y = Application.GetRealHeight(181 + 46); |
| | | btnTemperatureUnit.X = Application.GetRealWidth(188); |
| | | btnTemperatureUnit.Text = "℃"; |
| | | btnTemperatureUnit.TextSize = 14; |
| | | btnTemperatureUnit.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnTemperatureUnit.TextAlignment = TextAlignment.CenterLeft; |
| | | frameTemperaturePic.AddChidren(btnTemperatureUnit); |
| | | |
| | | //PM2.5传感器的PM2.5容器 |
| | | var framePmPic = new FrameLayout(); |
| | | framePmPic.X = Application.GetMinRealAverage(138);
|
| | | framePmPic.Y = Application.GetRealHeight(662);
|
| | | framePmPic.Width = Application.GetMinRealAverage(311);
|
| | | framePmPic.Height = Application.GetMinRealAverage(351); |
| | | framePmPic.BackgroundImagePath = "PM2.5Sensor/PmPic.png"; |
| | | frameWhiteBack.AddChidren(framePmPic); |
| | | //PM2.5文本 |
| | | var btnPmText = new NormalViewControl(311, 49, true);
|
| | | btnPmText.Y = Application.GetRealHeight(45); |
| | | btnPmText.Text = "PM2.5"; |
| | | btnPmText.TextSize = 12; |
| | | btnPmText.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnPmText.TextAlignment = TextAlignment.Center; |
| | | framePmPic.AddChidren(btnPmText); |
| | | |
| | | //PM2.5数据(第3个,listControl【2】) |
| | | var btnPmStatus = new NormalViewControl(109 + 40, 92, true);
|
| | | btnPmStatus.Y = Application.GetRealHeight(181); |
| | | btnPmStatus.Text = "35"; |
| | | btnPmStatus.TextSize = 32; |
| | | btnPmStatus.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnPmStatus.TextAlignment = TextAlignment.CenterRight; |
| | | framePmPic.AddChidren(btnPmStatus); |
| | | this.listControl.Add(btnPmStatus); |
| | | |
| | | //PM2.5单位 |
| | | var btnPmUnit = new NormalViewControl(124 + 15, 43, true);
|
| | | btnPmUnit.Y = Application.GetRealHeight(181 + 46); |
| | | btnPmUnit.X = Application.GetRealWidth(150); |
| | | btnPmUnit.Text = "μg/m³"; |
| | | btnPmUnit.TextSize = 14; |
| | | btnPmUnit.TextColor = ZigbeeColor.Current.XMWhite; |
| | | btnPmUnit.TextAlignment = TextAlignment.CenterLeft; |
| | | framePmPic.AddChidren(btnPmUnit); |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 是否获取网关反馈的结果_____________
|
| | | |
| | | /// <summary>
|
| | | /// 检测网关的反馈结果(属性上报的对象:device.DeviceStatusReport)
|
| | | /// </summary>
|
| | | /// <param name="comandDiv">命令区分</param>
|
| | | /// <param name="report">上报数据</param>
|
| | | /// <returns></returns>
|
| | | public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
|
| | | {
|
| | | if (comandDiv == ReceiveComandDiv.A设备属性上报)
|
| | | {
|
| | | if (report.DeviceStatusReport.CluterID == 1026)
|
| | | {
|
| | | var attriButeList = report.DeviceStatusReport.AttriBute;
|
| | | foreach (var attList in attriButeList)
|
| | | {
|
| | | if (attList.AttributeId == 0)
|
| | | { |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | { |
| | | UpdateStatus(); |
| | | }); |
| | | |
| | | //已经接收到网关的反馈 |
| | | return true;
|
| | | } |
| | | }
|
| | | }
|
| | | if (report.DeviceStatusReport.CluterID == 1029)
|
| | | {
|
| | | var attriButeList = report.DeviceStatusReport.AttriBute;
|
| | | foreach (var attList in attriButeList)
|
| | | {
|
| | | if (attList.AttributeId == 0)
|
| | | { |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | { |
| | | UpdateStatus(); |
| | | }); |
| | | |
| | | //已经接收到网关的反馈 |
| | | return true;
|
| | | } |
| | | }
|
| | | }
|
| | | if (report.DeviceStatusReport.CluterID == 1066)
|
| | | {
|
| | | var attriButeList = report.DeviceStatusReport.AttriBute;
|
| | | foreach (var attList in attriButeList)
|
| | | {
|
| | | if (attList.AttributeId == 0)
|
| | | { |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | { |
| | | UpdateStatus(); |
| | | }); |
| | | |
| | | //已经接收到网关的反馈 |
| | | return true;
|
| | | } |
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 设置方法 |
| | | /// <summary> |
| | | ///命令 |
| | | ///0:Off |
| | | ///1:Low |
| | | ///3:High |
| | | ///4:On |
| | | ///5:Auto |
| | | /// 15:Manual |
| | | /// </summary> |
| | | private void SetFanComand(int command)
|
| | | {
|
| | | //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
|
| | | this.StartCheckResponeResult(this.listControl, (result) =>
|
| | | {
|
| | | //接收到网关回复
|
| | | if (result == true)
|
| | | { |
| | | }
|
| | | }); |
| | | |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 刷新状态_____________ |
| | | /// <summary> |
| | | /// 刷新状态 |
| | | /// </summary> |
| | | private void UpdateStatus() |
| | | { |
| | | //设置状态文字 |
| | | this.listControl[0].Text = pMSensor.currentTemperature.ToString(); |
| | | this.listControl[1].Text = pMSensor.currentHumidity.ToString(); |
| | | this.listControl[2].Text = pMSensor.currentPmData.ToString(); |
| | | //设置状态文字 |
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | }
|
| | |
|
| | | //功能和场景bodyView
|
| | | this.bodyFrameLayout = new FrameLayout()
|
| | | {
|
| | | Y = functionSceneView.Bottom,
|
| | | Height = Application.GetRealHeight(750),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
|
| | | };
|
| | | this.bodyFrameLayout = new FrameLayout();
|
| | | bodyFrameLayout.Y = functionSceneView.Bottom;
|
| | | bodyFrameLayout.Height = this.listBodyContr.frameTable.Height - functionSceneView.Bottom;
|
| | | bodyFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | this.listBodyContr.frameTable.AddChidren(bodyFrameLayout);
|
| | |
|
| | | //选择功能分栏
|
| | |
| | | //当前房间的设备数
|
| | | if (listDevice.Count == 0)
|
| | | {
|
| | | ShowNoFunctionTip();
|
| | | //还没有功能哦
|
| | | this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.NoFunction_Tip));
|
| | | return;
|
| | | }
|
| | | //设备列表容器控件
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示没有功能
|
| | | /// </summary>
|
| | | private void ShowNoFunctionTip()
|
| | | {
|
| | | var noFunction = new Button
|
| | | {
|
| | | Y = Application.GetRealHeight(69),
|
| | | Width = this.GetPictrueRealSize(683),
|
| | | Height = this.GetPictrueRealSize(392),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | UnSelectedImagePath = "Item/NoFunction.png"
|
| | | };
|
| | | bodyFrameLayout.AddChidren(noFunction);
|
| | |
|
| | | var noFunctionTip = new Button()
|
| | | {
|
| | | Y = noFunction.Bottom,
|
| | | Height = Application.GetRealHeight(200),
|
| | | Text = Language.StringByID(R.MyInternationalizationString.NoFunction_Tip).Replace("{\\r\\n}", "\r\n"),
|
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
|
| | | TextAlignment = TextAlignment.Center,
|
| | | IsMoreLines = true
|
| | | };
|
| | | bodyFrameLayout.AddChidren(noFunctionTip);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 重置设备卡片控件坐标_______________
|
| | |
| | |
|
| | | if (listScene.Count == 0)
|
| | | {
|
| | | //显示没场景
|
| | | this.ShowNoSceneTip();
|
| | | //还没有场景哦
|
| | | this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.NoScene_Tip));
|
| | | return;
|
| | | }
|
| | | //列表控件
|
| | |
| | | System.Threading.Thread.Sleep(50);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示没场景
|
| | | /// </summary>
|
| | | private void ShowNoSceneTip()
|
| | | {
|
| | | var picNoFunc = new PicViewControl(683, 392);
|
| | | picNoFunc.Y = Application.GetRealHeight(69);
|
| | | picNoFunc.Gravity = Gravity.CenterHorizontal;
|
| | | picNoFunc.UnSelectedImagePath = "Item/NoFunction.png";
|
| | | bodyFrameLayout.AddChidren(picNoFunc);
|
| | |
|
| | | var btnTip = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(200), false);
|
| | | btnTip.Y = picNoFunc.Bottom;
|
| | | btnTip.Text = Language.StringByID(R.MyInternationalizationString.NoScene_Tip).Replace("{\\r\\n}", "\r\n");
|
| | | btnTip.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | btnTip.TextAlignment = TextAlignment.Center;
|
| | | btnTip.IsMoreLines = true;
|
| | | bodyFrameLayout.AddChidren(btnTip);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | if (oldFloorId != room.FloorId)
|
| | | {
|
| | | //楼层都切换的话,刷新整个主页
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public int CategoryPageSwitchIndex = 0;
|
| | | /// <summary>
|
| | | /// 当前登录的账号是不是之前的账号
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool TheSameLoginAccount = false;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | /// </summary>
|
| | | private bool hadRefresh = false;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | private bool m_isOnline = false;
|
| | | /// <summary>
|
| | | /// 传感器推送中
|
| | | /// </summary>
|
| | | private bool sensorPushing = false;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | public bool isOnline
|
| | | private bool m_isOnline = true;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | public bool IsOnline
|
| | | {
|
| | | get { return m_isOnline; }
|
| | | set
|
| | | {
|
| | | m_isOnline = value;
|
| | | //设置在线状态的特效
|
| | | this.SetOnlineStatu(m_isOnline);
|
| | | if (m_isOnline != value)
|
| | | {
|
| | | m_isOnline = value;
|
| | | //设置在线状态的特效
|
| | | this.SetOnlineStatu(m_isOnline);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | frameTable.AddBottomLine();
|
| | |
|
| | | //设置在线状态的特效
|
| | | this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
|
| | | this.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <summary>
|
| | | /// 设置在线状态的特效
|
| | | /// </summary>
|
| | | /// <param name="isOnline"></param>
|
| | | private void SetOnlineStatu(bool isOnline)
|
| | | /// <param name="i_isOnline"></param>
|
| | | private void SetOnlineStatu(bool i_isOnline)
|
| | | {
|
| | | if (isOnline == false)
|
| | | if (i_isOnline == false)
|
| | | {
|
| | | btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | } |
| | |
| | | btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
|
| | | //设备房间
|
| | | btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
|
| | | //设置在线状态的特效
|
| | | this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | private bool m_isOnline = false;
|
| | | private bool m_isOnline = true;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | public bool isOnline
|
| | | public bool IsOnline
|
| | | {
|
| | | get { return m_isOnline; }
|
| | | set
|
| | | {
|
| | | m_isOnline = value;
|
| | | //设置在线状态的特效
|
| | | this.SetOnlineStatu(m_isOnline);
|
| | | if (m_isOnline != value)
|
| | | {
|
| | | m_isOnline = value;
|
| | | //设置在线状态的特效
|
| | | this.SetOnlineStatu(m_isOnline);
|
| | | }
|
| | | }
|
| | | }
|
| | | /// <summary>
|
| | |
| | | /// <summary>
|
| | | /// 设置在线状态的特效
|
| | | /// </summary>
|
| | | /// <param name="isOnline"></param>
|
| | | private void SetOnlineStatu(bool isOnline)
|
| | | /// <param name="i_isOnline"></param>
|
| | | private void SetOnlineStatu(bool i_isOnline)
|
| | | {
|
| | | if (isOnline == false)
|
| | | if (i_isOnline == false)
|
| | | {
|
| | | btnDevie.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | }
|
| | |
| | | get { return m_IsOnline; }
|
| | | set
|
| | | {
|
| | | m_IsOnline = value;
|
| | | //变更状态
|
| | | this.SetOnlineStatu(m_IsOnline);
|
| | | if (m_IsOnline != value)
|
| | | {
|
| | | m_IsOnline = value;
|
| | | //变更状态
|
| | | this.SetOnlineStatu(m_IsOnline);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
old mode 100755
new mode 100644
| | |
| | | /// </summary>
|
| | | public bool SetCanSelect
|
| | | {
|
| | | set |
| | | set |
| | | {
|
| | | m_SetCanSelect = value;
|
| | | }
|
| | |
| | | strType = Language.StringByID(R.MyInternationalizationString.FreshAir);
|
| | | nowSelectNo = -1;
|
| | | }
|
| | | else if (this.device.Type == DeviceType.PMSensor)
|
| | | {
|
| | | //PM2.5传感器固定为 空气质量
|
| | | strType = Language.StringByID(R.MyInternationalizationString.AirQuality);
|
| | | nowSelectNo = -1;
|
| | | }
|
| | |
|
| | | //显示文本
|
| | | this.txtView.Text = strType;
|
| | |
| | | || this.device.Type == DeviceType.OnOffOutput//继电器
|
| | | || this.device.Type == DeviceType.Thermostat//空调
|
| | | || this.device.Type == DeviceType.FreshAir//新风
|
| | | || this.device.Type == DeviceType.PMSensor //PM2.5
|
| | | || this.device.Type == DeviceType.WindowCoveringDevice)//窗帘
|
| | | {
|
| | | return true;
|
| | |
| | | house.Save(false);
|
| | | Config.Instance.HomeId = house.Id;
|
| | | Config.Instance.Home = House.GetHouseByHouseId(house.Id);
|
| | |
|
| | | //预创建个人中心全部的文件夹
|
| | | UserCenterLogic.CreatAllUserCenterDirectory();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | }
|
| | | //切换网关,保存缓存
|
| | | this.SaveGatewayIdToLocation(gatewayId);
|
| | | //切换网关的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | /// 刷新网关的在线状态(注意,刷新的是缓存,请调用CheckGatewayOnlineByFlag来判断是否在线)
|
| | | /// </summary>
|
| | | /// <param name="listGateway"></param>
|
| | | /// <param name="waitTime">局域网的时候,时候等待3秒延迟</param>
|
| | | /// <returns></returns> |
| | | public void RefreshGatewayOnlineStatu(List<ZbGateway> listGateway, bool waitTime = true)
|
| | | public void RefreshGatewayOnlineStatu(List<ZbGateway> listGateway)
|
| | | {
|
| | | var listRealWay = new List<ZbGateway>();
|
| | | for (int i = 0; i < listGateway.Count; i++)
|
| | |
| | | {
|
| | | //虚拟物理网关
|
| | | listRealWay.Add(listGateway[i]);
|
| | | if (waitTime == false)
|
| | | {
|
| | | //不等待的话,标识指定网关为不在线
|
| | | this.SetGatewayNotOnLineFlag(listRealWay[i]);
|
| | | }
|
| | | }
|
| | | if (waitTime == true)
|
| | | {
|
| | | //只有等待的时候,才标识指定网关为不在线
|
| | | this.SetGatewayNotOnLineFlag(listRealWay[i]);
|
| | | }
|
| | | //标识指定网关为不在线
|
| | | listRealWay[i].GatewayOnlineFlage = false;
|
| | | }
|
| | |
|
| | | if (waitTime == true)
|
| | | //这是第一道坎,强制检查WIFI:等待2秒(因为wifi的时候,它会自动去刷新flage)
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | //检查是否拥有网关存在于WIFi下
|
| | | if (this.CheckHadGatewayInWifi(listRealWay) == false)
|
| | | {
|
| | | //这是第一道坎,强制检查WIFI:等待2秒(因为wifi的时候,它会自动去刷新flage)
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | //检查是否拥有网关存在于WIFi下
|
| | | if (this.CheckHadGatewayInWifi(listRealWay) == false)
|
| | | {
|
| | | //第二道坎:在远程的情况下刷新网关的在线状态
|
| | | this.RefreshGatewayOnlineOnRemode(listRealWay);
|
| | | }
|
| | | //第二道坎:在远程的情况下刷新网关的在线状态
|
| | | this.RefreshGatewayOnlineOnRemode(listRealWay);
|
| | | }
|
| | |
|
| | | //刷新缓存的在线标识
|
| | |
| | | continue;
|
| | | }
|
| | | this.dicGateway[gwID].GatewayOnlineFlage = zbway.GatewayOnlineFlage;
|
| | | this.dicGateway[gwID].ReSave();
|
| | | }
|
| | | } |
| | | |
| | |
| | | continue;
|
| | | }
|
| | | string strId = this.GetGatewayId(way);
|
| | | if (dicDbGateway.ContainsKey(strId) == true //如果云端上面有这个网关
|
| | | && dicDbGateway[strId].MqttOnlineStatus == true //如果云端上面这个网关是在线的
|
| | | )
|
| | | if (dicDbGateway.ContainsKey(strId) == true) //如果云端上面有这个网关
|
| | | {
|
| | | way.GatewayOnlineFlage = true;
|
| | | way.GatewayOnlineFlage = dicDbGateway[strId].MqttOnlineStatus;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 标识指定网关为不在线
|
| | | /// </summary>
|
| | | /// <param name="zbGateway"></param> |
| | | public void SetGatewayNotOnLineFlag(ZbGateway zbGateway)
|
| | | {
|
| | | if (zbGateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | zbGateway.GatewayOnlineFlage = false;
|
| | | } |
| | | |
| | | /// <summary>
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | #endregion |
| | |
|
| | | #region ■ 网关监视___________________________
|
| | |
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 当前的网络连接模式
|
| | | /// </summary>
|
| | | private GatewayConnectMode nowGwConnectMode = GatewayConnectMode.None;
|
| | | /// <summary>
|
| | | /// 是否存在网关正在升级
|
| | | /// </summary>
|
| | | private bool hadGatewayUpdate = false;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 网关连接方式变更___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 当网关的连接方式改变时,检测网关,然后显示特效
|
| | | /// </summary>
|
| | | /// <param name="connectMode">网关变更后的连接方式</param>
|
| | | public void CheckGatewayByConnectChanged(GatewayConnectMode connectMode)
|
| | | {
|
| | | if (this.nowGwConnectMode == connectMode || this.hadGatewayUpdate == true)
|
| | | {
|
| | | //相同的连接模式,或者有网关正在升级,则不需要操作
|
| | | return;
|
| | | }
|
| | |
|
| | | //没有网络
|
| | | if (connectMode == GatewayConnectMode.NoLine)
|
| | | {
|
| | | nowGwConnectMode = GatewayConnectMode.NoLine;
|
| | | //在远程的条件下,检查网关的在线状态(网络变更时触发)
|
| | | }
|
| | | //可以叫4G
|
| | | else if (connectMode == GatewayConnectMode.Remote)
|
| | | {
|
| | | nowGwConnectMode = GatewayConnectMode.Remote;
|
| | | //在远程的条件下,检查网关的在线状态(网络变更时触发)
|
| | | this.CheckGatewayStatuByRemote();
|
| | | }
|
| | | //WIFI
|
| | | else if (connectMode == GatewayConnectMode.WIFI)
|
| | | {
|
| | | nowGwConnectMode = GatewayConnectMode.WIFI;
|
| | | //在WIFI的条件下,检查网关的在线状态(网络变更时触发)
|
| | | this.CheckGatewayStatuByWIFI();
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 检查网关(WIFI)_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 在WIFI的条件下,检查网关的在线状态(网络变更时触发)
|
| | | /// </summary>
|
| | | private void CheckGatewayStatuByWIFI()
|
| | | {
|
| | | if (this.dicGateway.Count == 0)
|
| | | {
|
| | | //如果本地都没有网关的话,不需要处理
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | var dicStatu = this.GetNowOnlineStatuBeforeCheck();
|
| | | //等个3秒,准备一下
|
| | | System.Threading.Thread.Sleep(3000);
|
| | | if (nowGwConnectMode != GatewayConnectMode.WIFI)
|
| | | {
|
| | | //网络临时变更??
|
| | | return;
|
| | | }
|
| | |
|
| | | //从网关获取全部的网关
|
| | | List<ZbGateway> list = this.GetAllGatewayFromGateway();
|
| | | foreach (var way in list)
|
| | | {
|
| | | string gwId = this.GetGatewayId(way);
|
| | | if (this.dicGateway.ContainsKey(gwId) == true)
|
| | | {
|
| | | //刷新一下缓存
|
| | | this.dicGateway[gwId].GatewayOnlineFlage = way.GatewayOnlineFlage;
|
| | | }
|
| | | if (this.CheckGatewayOnlineByFlag(way) == true)
|
| | | {
|
| | | //网关在线
|
| | | dicStatu[gwId] = true;
|
| | | }
|
| | | }
|
| | | //将变化的网关推送到界面上
|
| | | this.PushGatewayOnlineStatuToForm(dicStatu);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 检查网关(4G)_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 在远程的条件下,检查网关的在线状态(网络变更时触发)
|
| | | /// </summary>
|
| | | private void CheckGatewayStatuByRemote()
|
| | | {
|
| | | if (this.dicGateway.Count == 0)
|
| | | {
|
| | | //如果本地都没有网关的话,不需要处理
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //先获取现在全部的网关,初期値设置为不在线
|
| | | var dicStatu = this.GetNowOnlineStatuBeforeCheck();
|
| | |
|
| | | //获取云端上面的网关
|
| | | Dictionary<string, GatewayResult> dicDbGateway = HdlGatewayLogic.Current.GetGateWayListFromDataBase();
|
| | | if (nowGwConnectMode != GatewayConnectMode.Remote || dicDbGateway == null)
|
| | | {
|
| | | //网络临时变更??
|
| | | return;
|
| | | }
|
| | |
|
| | | bool hadOnline = false;
|
| | | lock (dicGateway)
|
| | | {
|
| | | foreach (var way in this.dicGateway.Values)
|
| | | {
|
| | | //循环处理本地全部的网关列表
|
| | | string gwId = this.GetGatewayId(way);
|
| | | if (dicDbGateway.ContainsKey(gwId) == true//如果云端上面有这个网关
|
| | | && dicDbGateway[gwId].MqttOnlineStatus == true//如果云端上面这个网关是在线的
|
| | | )
|
| | | {
|
| | | dicGateway[gwId].GatewayOnlineFlage = true;
|
| | | //它是在线的
|
| | | dicStatu[gwId] = true;
|
| | | hadOnline = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //将变化的网关推送到界面上
|
| | | this.PushGatewayOnlineStatuToForm(dicStatu);
|
| | |
|
| | | //如果没有网关在线
|
| | | if (hadOnline == false)
|
| | | {
|
| | | //远程连接超时,没有网关在线
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRemoteTimeOutAndNotGatewaiOnline);
|
| | | //this.ShowTipMsg(msg);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 检查网关(无网络)___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 在远程的条件下,检查网关的在线状态(网络变更时触发)
|
| | | /// </summary>
|
| | | private void CheckGatewayStatuByNotNet()
|
| | | {
|
| | | //当前无网络连接,请确认网络
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 网关推送___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将变化的网关推送到界面上
|
| | | /// </summary>
|
| | | /// <param name="dicStatu"></param>
|
| | | private void PushGatewayOnlineStatuToForm(Dictionary<string, bool> dicStatu)
|
| | | {
|
| | | List<ZbGateway> listChange = new List<ZbGateway>();
|
| | | List<bool> listChangeStatu = new List<bool>();
|
| | | foreach (string gwid in dicStatu.Keys)
|
| | | {
|
| | | //网关不多,直接推送,不判断是否改变了
|
| | | ZbGateway zbGateway = this.GetLocalGateway(gwid);
|
| | | if (zbGateway != null)
|
| | | {
|
| | | listChange.Add(zbGateway);
|
| | | listChangeStatu.Add(dicStatu[gwid]);
|
| | |
|
| | | zbGateway.GatewayOnlineFlage = dicStatu[gwid];
|
| | | }
|
| | | }
|
| | |
|
| | | if (listChange.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //保存当前激活的界面ID
|
| | | var listId = new List<string>();
|
| | | listId.AddRange(UserCenterResourse.listActionFormId);
|
| | | for (int i = 0; i < listId.Count; i++)
|
| | | {
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(listId[i]) == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //网关在线推送
|
| | | for (int j = 0; j < listChange.Count; j++)
|
| | | {
|
| | | UserCenterResourse.DicActionForm[listId[i]]?.GatewayOnlinePush(listChange[j], listChangeStatu[j]);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置存在网关正在升级的标识
|
| | | /// </summary>
|
| | | /// <param name="update">是否有网关在升级</param>
|
| | | public void SetHadGatewayUpdateFlage(bool update)
|
| | | {
|
| | | this.hadGatewayUpdate = update;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 在网络连接变更之后,网关连接检测之前,设置全部网关为离线状态(以本地网关为标准)
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private Dictionary<string, bool> GetNowOnlineStatuBeforeCheck()
|
| | | {
|
| | | //先获取现在全部的网关
|
| | | List<ZbGateway> listOldGateway = this.GetAllGatewayFromGateway();
|
| | | var dicOldZb = new Dictionary<string, ZbGateway>();
|
| | | foreach (var zb in listOldGateway)
|
| | | {
|
| | | string gwID = this.GetGatewayId(zb);
|
| | | dicOldZb[gwID] = zb;
|
| | | }
|
| | |
|
| | | var dicStatu = new Dictionary<string, bool>();
|
| | | lock (dicGateway)
|
| | | {
|
| | | foreach (string gwId in this.dicGateway.Keys)
|
| | | {
|
| | | if (dicOldZb.ContainsKey(gwId) == true)
|
| | | {
|
| | | //标记为不在线
|
| | | this.SetGatewayNotOnLineFlag(dicOldZb[gwId]);
|
| | | }
|
| | | dicStatu[gwId] = false;
|
| | | }
|
| | | }
|
| | | return dicStatu;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 从云端获取全部网关列表ID___________
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 恢复网关___________________________
|
| | | #region ■ 网关监视___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 恢复网关配置
|
| | | /// 当前的网络连接模式
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="listGatewayFile">网关里面拥有的文件</param>
|
| | | /// <param name="backDirectory">云端下载的备份数据的文件夹名字</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> RecoverGatewaySettion(ZbGateway zbGateway, List<string> listGatewayFile, string backDirectory)
|
| | | private GatewayConnectMode nowGwConnectMode = GatewayConnectMode.None;
|
| | | /// <summary>
|
| | | /// 是否存在网关正在升级
|
| | | /// </summary>
|
| | | private bool hadGatewayUpdate = false;
|
| | |
|
| | | /// <summary>
|
| | | /// 当网关的连接方式改变时,记录当前的连接方式
|
| | | /// </summary>
|
| | | /// <param name="connectMode">网关变更后的连接方式</param>
|
| | | public void CheckGatewayByConnectChanged(GatewayConnectMode connectMode)
|
| | | {
|
| | | //获取从云端那里得来的全部文件
|
| | | var listBackFile = HdlAutoBackupLogic.GetFileFromDirectory(UserCenterLogic.CombinePath(backDirectory));
|
| | | listBackFile.Sort();
|
| | | //添加附加情报:还原设备配置
|
| | | ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uRecoverDeviceSettion));
|
| | | ProgressBar.SetMaxValue(listBackFile.Count);
|
| | | ProgressBar.Show();
|
| | |
|
| | | var listSaveFile = new HashSet<string>();
|
| | | foreach (string fileName in listBackFile)
|
| | | {
|
| | | if (fileName.Length < 10 || fileName.StartsWith("Device_") == false)
|
| | | {
|
| | | //不是设备备份文件
|
| | | continue;
|
| | | }
|
| | | //恢复设备配置
|
| | | var result = await this.RecoverDeviceSettion(backDirectory, fileName);
|
| | | if (result == -1)
|
| | | {
|
| | | ProgressBar.Close();
|
| | | return false;
|
| | | }
|
| | | if (result == 1 || result == 2)
|
| | | {
|
| | | listSaveFile.Add(fileName);
|
| | | }
|
| | |
|
| | | ProgressBar.SetValue(1);
|
| | | listGatewayFile.Remove(fileName);
|
| | | }
|
| | | //添加附加情报:覆盖网关备份中
|
| | | ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uGatewayBackupDataIsCovering));
|
| | | foreach (var file in listSaveFile)
|
| | | {
|
| | | //创建文件对象
|
| | | var result = await zbGateway.CreateFileAsync(file);
|
| | | if (result == null || result.Result != 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //覆盖网关备份失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCoverGatewayBackupDataFail);
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | });
|
| | | ProgressBar.Close();
|
| | | return false;
|
| | | }
|
| | | //发送数据流
|
| | | var byteData = Shared.Common.Global.ReadFileByDirectory(backDirectory, file);
|
| | | var result2 = await zbGateway.SendFileAsync(byteData);
|
| | | if (result2 == null || result2.Result != 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //覆盖网关备份失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCoverGatewayBackupDataFail);
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | });
|
| | | ProgressBar.Close();
|
| | | return false;
|
| | | }
|
| | | }
|
| | | //删除多余的文件
|
| | | foreach (var deleteFile in listGatewayFile)
|
| | | {
|
| | | if (deleteFile.Length > 12)
|
| | | {
|
| | | string deviceFileName = deleteFile.Substring(5);
|
| | | if (deviceFileName.StartsWith("Device_") == false)
|
| | | {
|
| | | //不是设备文件
|
| | | continue;
|
| | | }
|
| | | string[] strArry = deviceFileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | if (strArry.Length < 4 || listSaveFile.Contains(deleteFile) == true)
|
| | | {
|
| | | //我也不知道它是什么文件,或者这个文件是覆盖的
|
| | | continue;
|
| | | }
|
| | | //这个或许可以不理他
|
| | | var result = await zbGateway.DelFileOrDirAsync("/etc/hdlDat/" + deleteFile);
|
| | | }
|
| | | }
|
| | | ProgressBar.Close();
|
| | |
|
| | | return true;
|
| | | this.nowGwConnectMode = connectMode;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 恢复设备配置
|
| | | /// 开启检测网关在线状态的线程(此方法是给设备列表界面用的)
|
| | | /// </summary>
|
| | | /// <param name="backDirectory">云端下载的备份数据的文件夹名字</param>
|
| | | /// <param name="backFileName">网关的设备备份名字</param>
|
| | | /// <returns></returns>
|
| | | private async Task<int> RecoverDeviceSettion(string backDirectory, string backFileName)
|
| | | /// <param name="frameLayout">界面对象</param>
|
| | | public void StartCheckGatewayOnlineThread(EditorCommonForm frameLayout)
|
| | | {
|
| | | string deviceFileName = backFileName.Substring(0, backFileName.Length - 5);
|
| | | string[] strArry = deviceFileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | if (strArry.Length < 4)
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //我也不知道它是什么文件
|
| | | return 0;
|
| | | }
|
| | | var device = Common.LocalDevice.Current.GetDevice(strArry[2], Convert.ToInt32(strArry[3]));
|
| | | if (device == null)
|
| | | {
|
| | | //这个设备不见了
|
| | | return 2;
|
| | | }
|
| | |
|
| | | var byteData = Shared.Common.Global.ReadFileByDirectory(backDirectory, backFileName);
|
| | | var backType = (GatewayBackupEnum)Convert.ToInt32(backFileName.Substring(backFileName.Length - 5, 5));
|
| | |
|
| | | bool result = true;
|
| | | if (backType == GatewayBackupEnum.AMac名称)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await Common.LocalDevice.Current.ReMacName(new List<CommonDevice>() { device }, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A端点名称)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<string>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await Common.LocalDevice.Current.ReName(device, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.APir灯光配置)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.ConfigureParamates>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDevicePirSensorLogic.Current.SetPirSensorSettion((IASZone)device, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A干接点颜色调节)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.KeyColorData>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo((Panel)device, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A干接点亮度调节)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | int directionsLevel = Convert.ToInt32(recoverData["directionsLevel"]);
|
| | | int backlightLevel = Convert.ToInt32(recoverData["backlightLevel"]);
|
| | | result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion((Panel)device, directionsLevel, backlightLevel);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A干接点节能模式)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | bool modeEnable = Convert.ToBoolean(recoverData["modeEnable"]);
|
| | | int modeTime = Convert.ToInt32(recoverData["modeTime"]);
|
| | | int level = Convert.ToInt32(recoverData["level"]);
|
| | | result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode((Panel)device, modeEnable, modeTime, level);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A干接点第三级别私有属性)
|
| | | {
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDevicePanelLogic.Current.EditorDryContactThirdFunction((Panel)device, recoverData);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A窗帘方向)
|
| | | {
|
| | | var statu = Newtonsoft.Json.JsonConvert.DeserializeObject<bool>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection((Rollershade)device, statu);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A窗帘手拉控制)
|
| | | {
|
| | | var statu = Newtonsoft.Json.JsonConvert.DeserializeObject<bool>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDeviceCurtainLogic.Current.SetHandPullControl((Rollershade)device, statu);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A窗帘上下限位)
|
| | | {
|
| | | var curtainDevice = (Rollershade)device;
|
| | | var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | int upLimit = Convert.ToInt32(recoverData["upLimit"]);
|
| | | int downLimit = Convert.ToInt32(recoverData["downLimit"]);
|
| | | //先重置窗帘
|
| | | result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice);
|
| | | if (result == false) { return -1; }
|
| | | await Task.Delay(5000);
|
| | | //重置上限位
|
| | | result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
|
| | | if (result == false) { return -1; }
|
| | | //将窗帘调整到指定百分比
|
| | | curtainDevice.WcdGoToTiltValue(upLimit);
|
| | | await Task.Delay(3000);
|
| | | //执行确认及覆盖窗帘限位点
|
| | | result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, -1, -1);
|
| | | if (result == false) { return -1; }
|
| | |
|
| | | await Task.Delay(2000);
|
| | | //重置下限位
|
| | | result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
|
| | | if (result == false) { return -1; }
|
| | | //将窗帘调整到指定百分比
|
| | | curtainDevice.WcdGoToTiltValue(downLimit);
|
| | | await Task.Delay(3000);
|
| | | //执行确认及覆盖窗帘限位点
|
| | | result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, -1, -1);
|
| | | }
|
| | | else if (backType == GatewayBackupEnum.A空调自定义模式)
|
| | | {
|
| | | var data = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | result = await HdlDeviceAirConditionerLogic.Current.SetAcModeSupport((AC)device, data);
|
| | | if (result == true)
|
| | | int waitCount = 0;
|
| | | //如果住宅ID变更了,则不再处理
|
| | | while (frameLayout.Parent != null)
|
| | | {
|
| | | //转换为二进制
|
| | | var value = Convert.ToString(data, 2).PadLeft(16, '0');
|
| | | //这五个设置是放在后面的
|
| | | var fixValue = value.Substring(0, value.Length - 5);
|
| | | var reportValue = value.Substring(fixValue.Length);
|
| | | //更改缓存
|
| | | for (int i = 0; i < reportValue.Length; i++)
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | if (this.hadGatewayUpdate == true)
|
| | | {
|
| | | ((AC)device).listSupportMode[i] = Convert.ToInt32(reportValue[i]);
|
| | | //网关正在升级,不需要操作
|
| | | continue;
|
| | | }
|
| | | device.ReSave();
|
| | |
|
| | | waitCount++;
|
| | | if (this.nowGwConnectMode == GatewayConnectMode.Remote)
|
| | | {
|
| | | //远程每10秒检测一次
|
| | | if (waitCount < 10) { continue; }
|
| | | }
|
| | | else if (this.nowGwConnectMode == GatewayConnectMode.WIFI)
|
| | | {
|
| | | //局域网每3秒检测一次
|
| | | if (waitCount < 3) { continue; }
|
| | | }
|
| | | waitCount = 0;
|
| | |
|
| | | //获取前回网关的在线状态
|
| | | Dictionary<string, bool> dicOldOnline = this.GetOldGatewayOnlineStatu();
|
| | | if (dicOldOnline == null)
|
| | | {
|
| | | //则不处理
|
| | | continue;
|
| | | }
|
| | | //可以叫4G
|
| | | if (this.nowGwConnectMode == GatewayConnectMode.Remote)
|
| | | {
|
| | | //在远程的条件下,检查网关的在线状态
|
| | | this.CheckGatewayStatuByRemote(dicOldOnline);
|
| | | }
|
| | | //WIFI
|
| | | else if (this.nowGwConnectMode == GatewayConnectMode.WIFI)
|
| | | {
|
| | | //在WIFI的条件下,检查网关的在线状态
|
| | | this.CheckGatewayStatuByWIFI(dicOldOnline);
|
| | | }
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 在WIFI的条件下,检查网关的在线状态
|
| | | /// </summary>
|
| | | private void CheckGatewayStatuByWIFI(Dictionary<string, bool> dicOldOnline)
|
| | | {
|
| | | //从网关获取全部的网关
|
| | | List<ZbGateway> list = this.GetAllGatewayFromGateway();
|
| | | foreach (var way in list)
|
| | | {
|
| | | //将标识置为false
|
| | | way.GatewayOnlineFlage = false;
|
| | | }
|
| | | //等个2秒
|
| | | System.Threading.Thread.Sleep(2000);
|
| | |
|
| | | foreach (var way in list)
|
| | | {
|
| | | string gwId = this.GetGatewayId(way);
|
| | | if (dicOldOnline.ContainsKey(gwId) == true)
|
| | | {
|
| | | //网关也不多,直接推送吧
|
| | | this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage);
|
| | | }
|
| | | else
|
| | | {
|
| | | //没有包含,默认为false
|
| | | this.PushGatewayOnlineStatuToForm(gwId, false);
|
| | | }
|
| | | }
|
| | | return result == true ? 1 : -1;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 在远程的条件下,检查网关的在线状态
|
| | | /// </summary>
|
| | | private void CheckGatewayStatuByRemote(Dictionary<string, bool> dicOldOnline)
|
| | | {
|
| | | //获取云端上面的网关
|
| | | Dictionary<string, GatewayResult> dicDbGateway = HdlGatewayLogic.Current.GetGateWayListFromDataBase();
|
| | | if (dicDbGateway == null)
|
| | | {
|
| | | //如果网络不通,则也往下走
|
| | | dicDbGateway = new Dictionary<string, GatewayResult>();
|
| | | }
|
| | |
|
| | | foreach (var gwId in dicOldOnline.Keys)
|
| | | {
|
| | | //如果云端上面有这个网关
|
| | | if (dicDbGateway.ContainsKey(gwId) == true)
|
| | | {
|
| | | //网关也不多,直接推送
|
| | | this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus);
|
| | | }
|
| | | else
|
| | | {
|
| | | //云端不包含的,当不在线处理
|
| | | this.PushGatewayOnlineStatuToForm(gwId, false);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取前回网关的在线状态
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private Dictionary<string, bool> GetOldGatewayOnlineStatu()
|
| | | {
|
| | | if (this.dicGateway.Count == 0)
|
| | | {
|
| | | //没有网关,则不处理
|
| | | return null;
|
| | | }
|
| | |
|
| | | try
|
| | | {
|
| | | var dicOldOnline = new Dictionary<string, bool>();
|
| | | //如果在循环的过程中,动了里面的东西,报错则不理它,下一回合
|
| | | foreach (var zbway in this.dicGateway.Values)
|
| | | {
|
| | | //获取前回的在线状态
|
| | | string gwId = this.GetGatewayId(zbway);
|
| | | dicOldOnline[gwId] = zbway.GatewayOnlineFlage;
|
| | | }
|
| | | return dicOldOnline;
|
| | | }
|
| | | catch { return null; }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 将变化的网关推送到界面上
|
| | | /// </summary>
|
| | | /// <param name="gwId"></param>
|
| | | /// <param name="online"></param>
|
| | | private void PushGatewayOnlineStatuToForm(string gwId, bool online)
|
| | | {
|
| | | try
|
| | | {
|
| | | for (int i = 0; i < UserCenterResourse.listActionFormId.Count; i++)
|
| | | {
|
| | | string formId = UserCenterResourse.listActionFormId[i];
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //网关在线推送
|
| | | var zbway = this.GetLocalGateway(gwId);
|
| | | zbway.GatewayOnlineFlage = online;
|
| | |
|
| | | UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online);
|
| | | }
|
| | | }
|
| | | catch { }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置存在网关正在升级的标识
|
| | | /// </summary>
|
| | | /// <param name="update">是否有网关在升级</param>
|
| | | public void SetHadGatewayUpdateFlage(bool update)
|
| | | {
|
| | | this.hadGatewayUpdate = update;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________ |
| | |
|
| | | /// <summary>
|
| | | /// 弹出网关不在线的
|
| | | /// </summary> |
| | | private void ShowGatewayNotOnlineMsg()
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //网关连接失败,请确认网络
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGatewayIsNotLinkAndCheckNetwork);
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | });
|
| | | }
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 显示错误信息窗口
|
| | |
| | | tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString());
|
| | |
|
| | | //处理网关上报的数据,然后变更本地缓存
|
| | | var locadevice = Common.LocalDevice.Current.GetDevice(tempDevice.DeviceAddr, tempDevice.DeviceEpoint);
|
| | | if (locadevice != null)
|
| | | var locadevice = Common.LocalDevice.Current.GetDevicesByMac(tempDevice.DeviceAddr);
|
| | | for (int i = 0; i < locadevice.Count; i++)
|
| | | {
|
| | | locadevice.IsOnline = tempDevice.IsOnline;
|
| | | bool onlineChanged = locadevice[i].IsOnline != tempDevice.IsOnline;
|
| | | locadevice[i].IsOnline = tempDevice.IsOnline;
|
| | | //记录回复时间
|
| | | locadevice.LastDateTime = DateTime.Now;
|
| | | locadevice.ReSave();
|
| | | locadevice[i].LastDateTime = DateTime.Now;
|
| | | if (onlineChanged == true)
|
| | | {
|
| | | //在线状态变更了,才保存
|
| | | locadevice[i].ReSave();
|
| | | }
|
| | | }
|
| | |
|
| | | this.DeviceReportPush(tempDevice, ReceiveComandDiv.A设备在线上报);
|
| | |
| | | UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
|
| | |
|
| | | //初始化登陆账号的信息
|
| | | var hadNet = await InitUserAccoutInfo();
|
| | | var hadNet = await InitUserAccoutInfo(true);
|
| | | //如果有网络的话
|
| | | if (hadNet == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 初始化登陆账号的信息
|
| | | /// </summary>
|
| | | /// <param name="reLoad">是否从新从本地加载(重新初始化登陆账号的信息,不需要重新加载)</param>
|
| | | /// <returns></returns>
|
| | | private async static Task<bool> InitUserAccoutInfo()
|
| | | private async static Task<bool> InitUserAccoutInfo(bool reLoad)
|
| | | {
|
| | | //初始化个人信息的标识
|
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | | if (reLoad == true)
|
| | | {
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | | }
|
| | |
|
| | | //获取登录账号的信息
|
| | | var pra = new AccountInfoPra();
|
| | |
| | | private async static Task<bool> ReInitUserAccoutInfo()
|
| | | {
|
| | | //重新初始化账号信息
|
| | | var result = await InitUserAccoutInfo();
|
| | | var result = await InitUserAccoutInfo(false);
|
| | | if (result == false)
|
| | | {
|
| | | return result;
|
| | |
| | | /// <param name="obj">需要序列化的东西</param>
|
| | | public static void SaveFileContent(string fullName, object obj)
|
| | | {
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | var data = JsonConvert.SerializeObject(obj);
|
| | | var byteData = Encoding.UTF8.GetBytes(data);
|
| | | //写入内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
|
| | | System.IO.FileStream fileStream = null;
|
| | | try
|
| | | {
|
| | | fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
|
| | | fileStream.Write(byteData, 0, byteData.Length);
|
| | | fileStream.Flush();
|
| | | }
|
| | | catch { }
|
| | | finally
|
| | | {
|
| | | fileStream?.Close();
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
|
| | | }
|
| | |
|
| | | //添加新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
|
| | |
|
old mode 100755
new mode 100644
| | |
| | | //初始化桌布
|
| | | this.tableContr = new InformationEditorControl();
|
| | |
|
| | | if (this.deviceObj.Type == DeviceType.FreshAir)
|
| | | if (this.deviceObj.Type == DeviceType.FreshAir || this.deviceObj.Type == DeviceType.PMSensor)
|
| | | {
|
| | | this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1028);
|
| | | }
|
| | |
| | | frameBack.Height = this.GetPictrueRealSize(354);
|
| | | frameBack.Y = Application.GetRealHeight(153);
|
| | | frameBack.Gravity = Gravity.Center;
|
| | | } |
| | | |
| | | //如果是PM2.5 |
| | | if (deviceObj.Type == DeviceType.PMSensor)
|
| | | {
|
| | | frame.RemoveFromParent();
|
| | | frameBorder.Y = Application.GetRealHeight(0);
|
| | | frameBorder.Height = Application.GetRealHeight(708);
|
| | | frameBack.BackgroundImagePath = "RealDevice/SensorPMTwoPointFive.png";
|
| | | frameBack.Width = this.GetPictrueRealSize(418);
|
| | | frameBack.Height = this.GetPictrueRealSize(403);
|
| | | frameBack.Y = Application.GetRealHeight(153);
|
| | | frameBack.Gravity = Gravity.Center;
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | | //计算真实高度
|
| | | int realHeight = this.GetPictrueRealSize(58 + 58);//上下间距
|
| | | realHeight += frameBack.ChildrenCount * this.GetPictrueRealSize(124);//圆圈高度
|
| | | realHeight += (frameBack.ChildrenCount-1) * this.GetPictrueRealSize(60);//圆圈间距
|
| | | realHeight += (frameBack.ChildrenCount - 1) * this.GetPictrueRealSize(60);//圆圈间距
|
| | | if (realHeight > frameBack.Height)
|
| | | {
|
| | | //变更高度
|
| | |
| | | /// </summary>
|
| | | private Dictionary<string, DeviceObjRowInfo> dicRowInfo = new Dictionary<string, DeviceObjRowInfo>();
|
| | | /// <summary>
|
| | | /// 重新获取设备的在线状态
|
| | | /// </summary>
|
| | | private bool reGetDeviceOnlineStatu = false;
|
| | | /// <summary>
|
| | | /// 当前正在操作的设备对象Mac地址(设备信息编辑界面用)
|
| | | /// </summary>
|
| | | private string nowActionDeviceMac = null;
|
| | |
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | |
|
| | | //开启传感器报警监视
|
| | | this.StartCheckDeviceAlarm();
|
| | | //添加接收设备在线上报的监听
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //接受设备状态
|
| | | this.ReceiveDeviceStatu(report);
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | //开启检测网关在线状态的线程
|
| | | HdlGatewayLogic.Current.StartCheckGatewayOnlineThread(this);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件(外部可以调用)
|
| | | /// </summary>
|
| | | /// <param name="i_reGetDeviceOnlineStatu">重新获取设备的在线状态</param>
|
| | | public void InitMiddleFrame(bool i_reGetDeviceOnlineStatu = true)
|
| | | public void InitMiddleFrame()
|
| | | {
|
| | | this.reGetDeviceOnlineStatu = i_reGetDeviceOnlineStatu;
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | |
| | | frame.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //刷新设备的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //下拉刷新
|
| | |
| | | //右箭头
|
| | | rowDevice.frameTable.AddRightArrow();
|
| | | //在线状态
|
| | | rowDevice.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
|
| | |
|
| | | rowDevice.IsOnline = rowInfo.MenuRow.IsOnline;
|
| | | //保存控件
|
| | | string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | rowInfo.dicDetailRow[maikey] = rowDevice;
|
| | |
| | | if (result != -1)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
|
| | | {
|
| | | bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbGateway);
|
| | | this.gatewayViewRow.RefreshControl();
|
| | | //开启设备在线线程
|
| | | this.StartDeviceListControlThread(online);
|
| | | //刷新控件在线状态
|
| | | this.gatewayViewRow?.RefreshOnlineStatu();
|
| | | //根据网关在线状态刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatuByGatewayOnline(online);
|
| | | }
|
| | | });
|
| | | });
|
| | |
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | this.gatewayViewRow?.RefreshControl();
|
| | | //相同的状态,不需要再次刷新
|
| | | if (this.gatewayViewRow.isOnline != online)
|
| | | {
|
| | | //根据网关在线状态刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatuByGatewayOnline(online);
|
| | | }
|
| | | //刷新控件在线状态
|
| | | this.gatewayViewRow?.RefreshOnlineStatu();
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | #region ■ 设备在线检测_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启设备在线线程
|
| | | /// 根据网关在线状态刷新设备在线状态
|
| | | /// </summary>
|
| | | /// <param name="gatewayOnline">网关的在线状态</param>
|
| | | private void StartDeviceListControlThread(bool gatewayOnline)
|
| | | private void RefreshDeviceOnlineStatuByGatewayOnline(bool gatewayOnline)
|
| | | {
|
| | | if (gatewayOnline == false)
|
| | | {
|
| | | //设置全部设备离线
|
| | | this.SetAllDeviceOffLine();
|
| | | return;
|
| | | }
|
| | | //开启传感器报警监视
|
| | | this.StartCheckDeviceAlarm();
|
| | | //开启设备在线监测
|
| | | this.StartCheckDeviceOnline();
|
| | | else
|
| | | {
|
| | | //刷新设备在线状态
|
| | | this.RefreshDeviceOnlineStatu();
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 开启设备在线监测
|
| | | /// 刷新设备在线状态
|
| | | /// </summary>
|
| | | private void StartCheckDeviceOnline()
|
| | | private void RefreshDeviceOnlineStatu()
|
| | | {
|
| | | //外部调用的话,不再重新获取设备状态
|
| | | if (this.reGetDeviceOnlineStatu == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //添加接收设备在线上报的监听
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceListFormReceivePushOnline", ReceiveComandDiv.A设备在线上报, this.ReceiveDeviceStatu);
|
| | |
|
| | | string gwId = GatewayResourse.NowSelectGatewayId;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | int statu = 0;
|
| | | var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | var list = LocalDevice.Current.GetDeviceOnlineList(gwId);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(list[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | localDevice.ReSave();
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | rowInfo.MenuRow.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | if (rowInfo != null)
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | rowInfo.MenuRow.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | detailRow.isOnline = rowInfo.MenuRow.isOnline;
|
| | | }
|
| | | }
|
| | | detailRow.IsOnline = rowInfo.MenuRow.IsOnline;
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | private void SetAllDeviceOffLine()
|
| | | {
|
| | | lock (dicRowInfo)
|
| | | foreach (var rowInfo in this.dicRowInfo.Values)
|
| | | {
|
| | | foreach (var rowInfo in this.dicRowInfo.Values)
|
| | | //菜单
|
| | | if (rowInfo.MenuRow != null)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | rowInfo.MenuRow.IsOnline = false;
|
| | | }
|
| | | //明细
|
| | | if (rowInfo.dicDetailRow != null)
|
| | | {
|
| | | foreach (var detailRow in rowInfo.dicDetailRow.Values)
|
| | | {
|
| | | if (rowInfo.MenuRow != null)
|
| | | {
|
| | | rowInfo.MenuRow.isOnline = false;
|
| | | }
|
| | | });
|
| | | detailRow.IsOnline = false;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /// 网关名字控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnName = null;
|
| | | /// <summary>
|
| | | /// 在线状态
|
| | | /// </summary>
|
| | | public bool isOnline = false;
|
| | |
|
| | | /// <summary>
|
| | | /// 自定义网关控件
|
| | |
| | | if (zbway != null)
|
| | | {
|
| | | btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false)
|
| | | //在线状态
|
| | | this.isOnline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
|
| | | if (this.isOnline == false)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | | btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false)
|
| | | //刷新控件在线状态
|
| | | this.RefreshOnlineStatu();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 刷新控件在线状态
|
| | | /// </summary>
|
| | | public void RefreshOnlineStatu()
|
| | | {
|
| | | //获取本地网关对象
|
| | | ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId);
|
| | | if (zbway == null)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | return;
|
| | | }
|
| | | else
|
| | | //在线状态
|
| | | bool statu = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
|
| | | if (this.isOnline != statu)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextColor1;
|
| | | this.isOnline = statu;
|
| | | if (this.isOnline == false)
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnName.TextColor = UserCenterColor.Current.TextColor1;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
old mode 100755
new mode 100644
| | |
| | | if (this.CheckCanShowFunctionSettionRow() == true)
|
| | | {
|
| | | //添加【功能设置】行
|
| | | this.AddFunctionSettionRow();
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Sensor_PMTwoPointFive) |
| | | { |
| | | //PM传感器 |
| | | this.AddFunctionSettionRowPM(); |
| | | } |
| | | else |
| | | { |
| | | this.AddFunctionSettionRow(); |
| | | } |
| | | |
| | | }
|
| | |
|
| | | //添加【干接点设置】行
|
| | |
| | | //只有回路数大于1才能有这个菜单
|
| | | if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1)
|
| | | {
|
| | | //要求新风小模块的新风有功能设置
|
| | | //新风小模块只有一个回路,但要求新风小模块的新风有功能设置
|
| | | if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul)
|
| | | {
|
| | | return;
|
| | |
| | | };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加传感器【功能设置】行
|
| | | /// </summary>
|
| | | private void AddFunctionSettionRowPM()
|
| | | { |
| | | //功能设置 |
| | | string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp);
|
| | | var btnFunction = new FrameRowControl(listview.rowSpace / 2);
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //向右图标
|
| | | btnFunction.AddRightArrow();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | { |
| | | var form = new DeviceFunctionSettionForm(); |
| | | form.AddForm(listNewDevice[0], false);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion;
|
| | |
|
| | | #region ■ 方向与限位(窗帘)___________________
|
old mode 100755
new mode 100644
old mode 100644
new mode 100755
| | |
| | | |
| | | var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); |
| | | msg3.Y = msg2.Bottom; |
| | | if (msgArry.Length > 1) |
| | | if (msgArry.Length > 2) |
| | | { |
| | | msg3.Text = msgArry[2]; |
| | | } |
| | |
| | | /// 其他消息的主键,它存在另外的一张数据库表中
|
| | | /// </summary>
|
| | | private List<string> listOtherMsgId = new List<string>();
|
| | | /// <summary>
|
| | | /// 无法识别的开锁记录的用户ID(因为那个密码有可能没有分配给成员)
|
| | | /// </summary>
|
| | | private List<string> listOtherUserId = new List<string>();
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | //设置头部信息 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryLog)); |
| | | |
| | | //删除 |
| | | var btnDelete = new MostRightIconControl(69, 69); |
| | | btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png"; |
| | | topFrameLayout.AddChidren(btnDelete); |
| | | btnDelete.InitControl(); |
| | | btnDelete.ButtonClickEvent += (sender, e) =>
|
| | | //成员不允许清空记录 |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | {
|
| | | var form = new TopRightMenuControl(1, 2);
|
| | | //清空记录
|
| | | form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () =>
|
| | | //删除
|
| | | var btnDelete = new MostRightIconControl(69, 69);
|
| | | btnDelete.UnSelectedImagePath = "Item/DeleteIcon2Selected.png";
|
| | | topFrameLayout.AddChidren(btnDelete);
|
| | | btnDelete.InitControl();
|
| | | btnDelete.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.listView.frameTable.ChildrenCount == 0)
|
| | | var form = new TopRightMenuControl(1, 2);
|
| | | //清空记录
|
| | | form.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uClearLog), "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () =>
|
| | | {
|
| | | //无数据可删
|
| | | return;
|
| | | }
|
| | | //确认清空当前记录?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | if (this.listView.frameTable.ChildrenCount == 0)
|
| | | {
|
| | | //清空所有记录
|
| | | this.ClearAllHistoryLog();
|
| | | //无数据可删
|
| | | return;
|
| | | }
|
| | | //确认清空当前记录?
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uConfirmClearNowLog), () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //清空所有记录
|
| | | this.ClearAllHistoryLog();
|
| | | });
|
| | | });
|
| | | });
|
| | | });
|
| | | }; |
| | | };
|
| | | } |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | |
| | | //历史记录太麻烦了,存在不同的数据库表里,并且数据还不一样,只能这样一个个判断了
|
| | | var listScreeningData = new List<HistoryInfo>();
|
| | | //清除掉之前的记录
|
| | | this.listOtherUserId = new List<string>();
|
| | | this.listOtherMsgId = new List<string>();
|
| | |
|
| | | //是否选择全选用户
|
| | |
| | | //其他消息的主键,它存在另外的一张数据库表中
|
| | | this.listOtherMsgId.Add(info.MsgKeyId);
|
| | | }
|
| | | }
|
| | | if (info.CloudAccountId != string.Empty && dicMemberName.ContainsKey(info.CloudAccountId) == false
|
| | | && this.listOtherUserId.Contains(info.CloudAccountId) == false)
|
| | | {
|
| | | //无法识别的开锁记录的用户ID(因为那个密码有可能没有分配给成员)
|
| | | this.listOtherUserId.Add(info.CloudAccountId);
|
| | | }
|
| | |
|
| | | return true;
|
| | |
| | | /// </summary>
|
| | | private async void ClearAllHistoryLog()
|
| | | {
|
| | | //获取访问云端接口的启动参数
|
| | | //获取访问云端接口的启动参数(2020.05.08:全部清空)
|
| | | var pra = this.GetDeleteDataPra();
|
| | |
|
| | | //打开进度条
|
| | |
| | |
|
| | | //清空
|
| | | this.listOtherMsgId = new List<string>();
|
| | | this.listOtherUserId = new List<string>();
|
| | | this.listHistoryInfo = null;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | DateTime dateFrom = new DateTime(dateFromControl.Year, dateFromControl.Month, dateFromControl.Day, 0, 0, 0);
|
| | | DateTime dateTo = new DateTime(dateToControl.Year, dateToControl.Month, dateToControl.Day, 23, 59, 59);
|
| | |
|
| | | List<string> listUser = null;
|
| | | //指定用户
|
| | | if (listSearchUserId.Contains("-1") == false)
|
| | | {
|
| | | listUser = new List<string>();
|
| | | listUser.AddRange(listSearchUserId);
|
| | | //如果指定有其他
|
| | | if (listSearchUserId.Contains("-9999") == true)
|
| | | {
|
| | | listUser.AddRange(this.listOtherUserId);
|
| | | }
|
| | | }
|
| | |
|
| | | //全选则为null
|
| | | List<int> listLock = null;
|
| | | if (listSearchLockId.Contains(-1) == false)
|
| | | {
|
| | | listLock = new List<int>();
|
| | | listLock.AddRange(listSearchLockId);
|
| | | }
|
| | |
|
| | | var pra = new DeleteHistoryDataPra();
|
| | | pra.UnlockTimeBegin = dateFrom.ToUniversalTime().ToString();
|
| | | pra.UnlockTimeEnd = dateTo.ToUniversalTime().ToString();
|
| | | pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | | pra.DoorLockId = this.DeviceDoor.DeviceAddr + "_" + this.DeviceDoor.DeviceEpoint;
|
| | | pra.CloudAccountIds = listUser;
|
| | | pra.OpenLockModes = listLock;
|
| | |
|
| | | return pra;
|
| | | }
|
old mode 100755
new mode 100644
| | |
| | |
|
| | | listview = new VerticalScrolViewLayout();
|
| | | listview.Height = Application.GetRealHeight(1981 - 184);
|
| | | bodyFrameLayout.AddChidren(listview);
|
| | | bodyFrameLayout.AddChidren(listview); |
| | | listview.ScrollEnabled = false;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | //添加屏幕亮度级别控件
|
| | | this.AddScreenBrightnesLevelControl();
|
| | |
|
| | | //添加背光灯亮度控件【暂时不需要,可能后期新风面板的这个颜色要补回来】
|
| | | this.AddBackLightControl();
|
| | | //【暂时不需要,可能后期新风面板的这个颜色要补回来】
|
| | | //this.FinishInitControl(listview, energyModeInfo.enable);
|
| | | //添加新风面板的颜色
|
| | | this.AddColorControl();
|
| | |
|
| | | //保存
|
| | | var btnSave = new BottomClickButton();
|
| | |
| | | /// <summary>
|
| | | /// 添加背光颜色控件
|
| | | /// </summary>
|
| | | private void AddBackLightControl()
|
| | | private void AddColorControl()
|
| | | {
|
| | | var btnEspace = new NormalViewControl(600, 58, true);
|
| | | btnEspace.X = ControlCommonResourse.XXLeft;
|
| | |
| | | frameColor.Height = this.GetPictrueRealSize(79);
|
| | | frameColor.Gravity = Gravity.CenterVertical;
|
| | | frameColor.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
|
| | | frameBack.AddChidren(frameColor);
|
| | |
|
| | | //颜色
|
| | | frameBack.AddChidren(frameColor); |
| | | |
| | | //颜色 |
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false);
|
| | | btnColorView.Gravity = Gravity.CenterVertical;
|
| | | btnColorView.TextAlignment = TextAlignment.CenterRight;
|
| | |
| | | btnRight.Y = Application.GetRealHeight(5);
|
| | | btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
|
| | | frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
|
| | | btnRight.Y += this.GetPictrueRealSize(8);
|
| | |
|
| | | btnRight.Y += this.GetPictrueRealSize(8); |
| | | |
| | | frameColor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new PanelColorSelectForm();
|
| | | form.AddForm(R1, G1, B1);
|
| | | form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
|
| | | {
|
| | | R1 = Rcolor;
|
| | | G1 = Gcolor;
|
| | | B1 = Bcolor;
|
| | |
|
| | | this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16);
|
| | | this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16);
|
| | | this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16);
|
| | |
|
| | | btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
|
| | | };
|
| | | PanelColor(btnColor, R1, G1, B1);
|
| | | }; |
| | | btnColorView.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | PanelColor(btnColor, R1, G1, B1);
|
| | | }; |
| | | btnColor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | PanelColor(btnColor, R1, G1, B1);
|
| | | }; |
| | | btnColorLine.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | PanelColor(btnColor, R1, G1, B1);
|
| | | }; |
| | | btnRight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | PanelColor(btnColor, R1, G1, B1);
|
| | | };
|
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// PanelColorSelectForm |
| | | /// </summary>
|
| | | private void PanelColor(NormalViewControl btnColor, int R1, int G1, int B1) |
| | | { |
| | | var form = new PanelColorSelectForm(); |
| | | form.AddForm(R1, G1, B1); |
| | | form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) => |
| | | { |
| | | R1 = Rcolor; |
| | | G1 = Gcolor; |
| | | B1 = Bcolor; |
| | | |
| | | this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16); |
| | | this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16); |
| | | this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16); |
| | | |
| | | btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor); |
| | | }; |
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | else
|
| | | {
|
| | | frameBack.Height -= value;
|
| | | }
|
| | | //容器补充
|
| | | this.FinishInitControl(listview, energyModeInfo.enable);
|
| | | } |
| | | };
|
| | | if (energyModeInfo.enable == true)
|
| | | {
|
old mode 100644
new mode 100755
| | |
| | | /// PM绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionPMTarget = null; |
| | | /// <summary> |
| | | /// 是否能点击保存按钮 |
| | | /// </summary> |
| | | private bool canSave = true; |
| | | #endregion |
| | | |
| | | #region UI设计 |
| | |
| | | /// <param name="curControlDev"></param> |
| | | void SaveTarget() |
| | | { |
| | | btnFinifh.Enable = false; |
| | | if (targetList.Count == 0) |
| | | { |
| | | //空目标 |
| | |
| | | catch (Exception ex) |
| | | { |
| | | var mess = ex.Message; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | btnFinifh.Enable = true; |
| | | var mess = ex.Message; |
| | | } |
| | | }); |
| | |
| | | foreach (var de in room.ListDevice) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(de); |
| | | |
| | | if (device != null) |
| | | { |
| | | //获取设备类型的 |
| | |
| | | foreach (var de in room.ListDevice) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(de); |
| | | //电池设备不支持绑定 |
| | | if (device.ZigbeeType != 1) |
| | | { |
| | | continue; |
| | | } |
| | | if (device != null) |
| | | { |
| | | if (device.Type == DeviceType.TemperatureSensor) |
| | |
| | | foreach (var de in room.ListDevice) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(de); |
| | | //电池设备不支持绑定 |
| | | if (device.ZigbeeType != 1) |
| | | { |
| | | continue; |
| | | } |
| | | if (device != null) |
| | | { |
| | | if (device.Type == DeviceType.TemperatureSensor) |
| | |
| | | { |
| | | //上报“常开模式”已被取消,app默认了“常开模式”被取消 |
| | | DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); |
| | | if (haveLogic) |
| | | { |
| | | //此处删除温居城的常开模式特殊逻辑 |
| | | var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | //上报“常开模式”已被取消 |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | |
| | | //温居城方法??? |
| | | //此处是否要删除温居城的特殊逻辑 |
| | | if (haveLogic) |
| | | { |
| | | //此处删除温居城的常开模式特殊逻辑 |
| | | var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); |
| | | } |
| | | |
| | | //app重新开启“常开模式” |
| | | var result = await doorLock.SetNormallyOpenModeFuncAsync(true); |
| | |
| | | NormallyOpenModeValue(doorLock, false); |
| | | if (haveLogic) |
| | | { |
| | | //温居城方法??? |
| | | //此处是否要删除温居城的特殊逻辑 |
| | | //此处删除温居城的常开模式特殊逻辑 |
| | | var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); |
| | | } |
| | | } |
| | | else |
| | |
| | | //删除设置常开模式创建的逻辑 |
| | | if (haveLogic) |
| | | { |
| | | var resTemp1 = await Shared.Phone.Device.Logic.SkipView.Exist(3); |
| | | //温居城方法??? |
| | | //此处是否要删除温居城的特殊逻辑 |
| | | //此处删除温居城的常开模式特殊逻辑 |
| | | var resTemp1 = await Shared.Phone.Device.Logic.SkipView.GetLogicAll(); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
old mode 100644
new mode 100755
old mode 100644
new mode 100755
old mode 100644
new mode 100755
| | |
| | | /// 逻辑中是否有常开模式
|
| | | /// </summary> |
| | | private bool haveLogicNormallyOpenMode = false;
|
| | |
|
| | | |
| | | /// <summary> |
| | | /// 门锁深度控制上报窗口是否弹出
|
| | | /// 门锁深度控制上报窗口是否弹出 |
| | | /// </summary> |
| | | public static bool canShowDialog = true;
|
| | |
|
| | | public static bool canShowDialog = true; |
| | | |
| | | /// <summary> |
| | | /// 当前电量 |
| | | /// </summary> |
| | |
| | | if (doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | if (canOpenNormallyMode)
|
| | | { |
| | | {
|
| | | Application.RunOnMainThread(() => |
| | | { |
| | | Action<bool> action = (obj) => |
| | | { |
| | | UpdateNomallyOpenStatus(); |
| | | UpdateNomallyOpenStatus();
|
| | | }; |
| | | DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action); |
| | | }); |
| | |
| | | }; |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | #endregion |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 常开模式失效处理 |
| | | /// </summary> |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 常开模式失效处理
|
| | | /// </summary>
|
| | | public void NomallyOpenModeInvalidDialog(bool IsFromReport = false) |
| | | { |
| | | if (!canShowDialog) |
| | |
| | | else
|
| | | {
|
| | | //刷新主画面(不重新获取设备状态)
|
| | | this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false);
|
| | | this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame");
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | //关闭界面
|
| | | this.CloseForm();
|
| | | //刷新主画面(不重新获取设备状态)
|
| | | this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false);
|
| | | this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame");
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | string gwid = HdlGatewayLogic.Current.GetGatewayId(gateWay);
|
| | | if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null)
|
| | | {
|
| | | this.dicRowContr[gwid].RefreshControl(gateWay);
|
| | | this.dicRowContr[gwid].IsOnline = online;
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == false)
|
| | | {
|
| | | //刷新主页
|
| | | UserView.UserPage.Instance.Fresh();
|
| | | UserView.UserPage.Instance.ReFreshControl();
|
| | | }
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
| | | //关闭所有界面
|
| | | UserCenterLogic.CloseAllOpenForm();
|
| | | //切换到主页
|
| | | UserView.UserPage.Instance.Fresh();
|
| | | UserView.UserPage.Instance.ReFreshControl();
|
| | | });
|
| | |
|
| | | //文件恢复成功
|
| | |
| | |
|
| | | this.AddNormalRowControl("WIFI变量", 400, Shared.Application.IsWifi == true ? "true" : "false", 400);
|
| | |
|
| | | if (ZigBee.Common.Application.FindGateWaySocket.busSocket == null)
|
| | | {
|
| | | this.AddNormalRowControl("Socket链接", 400, "未初始化", 400);
|
| | | }
|
| | | else
|
| | | {
|
| | | this.AddNormalRowControl("Socket链接", 400, ZigBee.Common.Application.FindGateWaySocket.busSocket.Connected == true ? "true" : "false", 400);
|
| | | }
|
| | |
|
| | | int count = HdlGatewayLogic.Current.GetAllLocalGateway().Count;
|
| | | var row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | |
| | | #endif
|
| | | row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | | row1.AddLeftCaption("设备缓存变量", 500);
|
| | | row1.AddRightArrow();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
|
| | | };
|
| | |
|
| | |
|
| | | row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | | row1.AddLeftCaption("上传Log", 500);
|
| | | row1.AddRightArrow();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | |
| | | UserCenter.HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | CommonPage.Instance.RemoveViewByTag("Login");
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | CommonPage.Loading.Hide();
|
| | | });
|
| | | }
|
| | |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
|
| | | var revertData = responseDataObj;
|
| | | //标记上一次是不是同一个账号登陆
|
| | | UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
|
| | | Config.Instance.Account = revertData.Account;
|
| | | Config.Instance.Password = password;
|
| | | Config.Instance.MD5PWD = revertData.MD5PWD;
|
| | |
| | | using System.Collections.Generic; |
| | | using Shared.Common; |
| | | using System.Text; |
| | | |
| | | using Shared.Phone.UserCenter;
|
| | |
|
| | | namespace Shared.Phone.UserView |
| | | { |
| | | /// <summary> |
| | | /// User page. |
| | | /// </summary> |
| | | public class UserPage : FrameLayout |
| | | { |
| | | #region ◆ 变量_______________________ |
| | | /// <summary> |
| | | /// The user menu page. |
| | | /// </summary> |
| | | static UserPage userMenuPage; |
| | | /// <summary> |
| | | /// 底部单独菜单的宽度-360 |
| | | /// </summary> |
| | | private static readonly int tabBarEnum_Width = CommonPage.AppRealWidth / 3; |
| | | /// <summary> |
| | | /// 底部按钮图片的高度 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumIMG_Height = 98; |
| | | /// <summary> |
| | | /// 底部按钮图片的宽度 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumIMG_Width = 138; |
| | | /// <summary> |
| | | /// 底部按钮图片的Y值 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumIMG_Y = 3; |
| | | /// <summary> |
| | | /// 底部按钮文字的高度 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumName_Height = 40; |
| | | /// <summary> |
| | | /// 底部按钮文字的Y值 |
| | | /// </summary> |
| | | private static readonly int tabBarEnumName_Y = 98; |
| | | #endregion |
| | | {
|
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary>
|
| | | /// 当前选择的菜单
|
| | | /// </summary> |
| | | private MenuSelectEnum nowSelectMenu = MenuSelectEnum.A未选择;
|
| | | /// <summary> |
| | | /// 用户界面 |
| | | /// </summary> |
| | | private static UserPage userMenuPage = null;
|
| | | /// <summary> |
| | | /// 用户界面 |
| | | /// </summary> |
| | |
| | | } |
| | | return userMenuPage; |
| | | } |
| | | } |
| | | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 用户主体界面(中间部分)
|
| | | /// </summary>
|
| | | private FrameLayout bodyFrameView = null;
|
| | | /// <summary>
|
| | | /// 界面缓存(2020.05.07:切换时不移除界面,直接隐藏)
|
| | | /// </summary>
|
| | | private List<EditorCommonForm> listForm = new List<EditorCommonForm>() { null, null, null };
|
| | | /// <summary>
|
| | | /// 控件缓存(看不懂的话,不要动它)
|
| | | /// </summary>
|
| | | private List<ButtonBase> listButton = new List<ButtonBase>();
|
| | | /// <summary>
|
| | | /// 如果设置此变量为true,则在单击底部菜单时,强制无条件全部刷新
|
| | | /// </summary>
|
| | | public bool RefreshForm = false;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="T:Shared.Phone.UserView.UserPage"/> class. |
| | | /// 初始化 |
| | | /// </summary> |
| | | public UserPage() |
| | | { |
| | |
| | | { |
| | | Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); |
| | | }; |
| | | } |
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 初始化 |
| | | /// </summary> |
| | | public void InitPage() |
| | | { |
| | | if (this.ChildrenCount > 0) |
| | | { |
| | | return; |
| | | }
|
| | | #if iOS
|
| | | if (Shared.Application.PhoneType >= 10)
|
| | | {
|
| | | //高版本的苹果机型,屏幕底部会有一个黑色的杠
|
| | | ControlCommonResourse.BottomFrameHeight = Application.GetRealHeight(242);
|
| | | }
|
| | | #endif
|
| | | //用户主体界面(中间部分)
|
| | | this.bodyFrameView = new FrameLayout();
|
| | | bodyFrameView.Height = this.Height - UserCenter.ControlCommonResourse.BottomFrameHeight;
|
| | | bodyFrameView.BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor;
|
| | | this.AddChidren(bodyFrameView);
|
| | |
|
| | | //用户菜单界面(底部部分) |
| | | var bottomMenuFrame = new FrameLayout();
|
| | | bottomMenuFrame.Gravity = Gravity.BottomCenter; |
| | | bottomMenuFrame.Height = ControlCommonResourse.BottomFrameHeight;
|
| | | bottomMenuFrame.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor;
|
| | | this.AddChidren(bottomMenuFrame); |
| | | //底部菜单的头部线 |
| | | var bottomLine = new NormalViewControl(bottomMenuFrame.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | bottomLine.BackgroundColor = 0xffc8c8c9;
|
| | | bottomMenuFrame.AddChidren(bottomLine);
|
| | |
|
| | | //主页容器 |
| | | var frameHomePage = new FrameLayout();
|
| | | frameHomePage.Width = bottomMenuFrame.Width / 3;
|
| | | frameHomePage.Height = bottomMenuFrame.Height;
|
| | | bottomMenuFrame.AddChidren(frameHomePage);
|
| | | //主页图标 |
| | | var btnHomeIcon = new PicViewControl(138, 98);
|
| | | btnHomeIcon.Y = Application.GetRealHeight(3);
|
| | | btnHomeIcon.UnSelectedImagePath = "Navigation/Home.png";
|
| | | btnHomeIcon.SelectedImagePath = "Navigation/HomeSelected.png";
|
| | | btnHomeIcon.Gravity = Gravity.CenterHorizontal;
|
| | | frameHomePage.AddChidren(btnHomeIcon);
|
| | | this.listButton.Add(btnHomeIcon);
|
| | | btnHomeIcon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A主页, true);
|
| | | };
|
| | | //主页 |
| | | var btnHomeName = new NormalViewControl(btnHomeIcon.Width, Application.GetRealHeight(40), false);
|
| | | btnHomeName.Y = btnHomeIcon.Bottom; |
| | | btnHomeName.TextID = R.MyInternationalizationString.HomePage; |
| | | btnHomeName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor; |
| | | btnHomeName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2; |
| | | btnHomeName.TextSize = 10;
|
| | | btnHomeName.Gravity = Gravity.CenterHorizontal;
|
| | | btnHomeName.TextAlignment = TextAlignment.Center;
|
| | | frameHomePage.AddChidren(btnHomeName);
|
| | | this.listButton.Add(btnHomeName);
|
| | | btnHomeName.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A主页, true);
|
| | | }; |
| | | |
| | | //分类容器 |
| | | var frameCategory = new FrameLayout();
|
| | | frameCategory.X = frameHomePage.Right;
|
| | | frameCategory.Width = bottomMenuFrame.Width / 3;
|
| | | frameCategory.Height = bottomMenuFrame.Height;
|
| | | bottomMenuFrame.AddChidren(frameCategory);
|
| | | //分类图标 |
| | | var btnCategoryIcon = new PicViewControl(138, 98);
|
| | | btnCategoryIcon.Y = Application.GetRealHeight(3);
|
| | | btnCategoryIcon.UnSelectedImagePath = "Navigation/Category.png"; |
| | | btnCategoryIcon.SelectedImagePath = "Navigation/CategorySelected.png";
|
| | | btnCategoryIcon.Gravity = Gravity.CenterHorizontal;
|
| | | frameCategory.AddChidren(btnCategoryIcon);
|
| | | this.listButton.Add(btnCategoryIcon);
|
| | | btnCategoryIcon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A分类, true);
|
| | | };
|
| | | //分类 |
| | | var btnCategoryName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
|
| | | btnCategoryName.Y = btnCategoryIcon.Bottom; |
| | | btnCategoryName.TextID = R.MyInternationalizationString.Category; |
| | | btnCategoryName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor; |
| | | btnCategoryName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2; |
| | | btnCategoryName.TextSize = 10;
|
| | | btnCategoryName.Gravity = Gravity.CenterHorizontal;
|
| | | btnCategoryName.TextAlignment = TextAlignment.Center;
|
| | | frameCategory.AddChidren(btnCategoryName);
|
| | | this.listButton.Add(btnCategoryName);
|
| | | btnCategoryName.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A分类, true);
|
| | | };
|
| | |
|
| | |
|
| | | //我的容器
|
| | | var frameSetting = new FrameLayout();
|
| | | frameSetting.X = frameCategory.Right;
|
| | | frameSetting.Width = bottomMenuFrame.Width / 3;
|
| | | frameSetting.Height = bottomMenuFrame.Height;
|
| | | bottomMenuFrame.AddChidren(frameSetting);
|
| | | //我的图标 |
| | | var btnSettingIcon = new PicViewControl(138, 98);
|
| | | btnSettingIcon.Y = Application.GetRealHeight(3);
|
| | | btnSettingIcon.UnSelectedImagePath = "Navigation/Setting.png"; |
| | | btnSettingIcon.SelectedImagePath = "Navigation/SettingSelected.png";
|
| | | btnSettingIcon.Gravity = Gravity.CenterHorizontal;
|
| | | frameSetting.AddChidren(btnSettingIcon);
|
| | | this.listButton.Add(btnSettingIcon);
|
| | | btnSettingIcon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A个人中心, true);
|
| | | };
|
| | | //我的 |
| | | var btnSettingName = new NormalViewControl(btnCategoryIcon.Width, Application.GetRealHeight(40), false);
|
| | | btnSettingName.Y = btnSettingIcon.Bottom; |
| | | btnSettingName.TextID = R.MyInternationalizationString.Me; |
| | | btnSettingName.TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor; |
| | | btnSettingName.SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2; |
| | | btnSettingName.TextSize = 10;
|
| | | btnSettingName.Gravity = Gravity.CenterHorizontal;
|
| | | btnSettingName.TextAlignment = TextAlignment.Center;
|
| | | frameSetting.AddChidren(btnSettingName);
|
| | | this.listButton.Add(btnSettingName);
|
| | | btnSettingName.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.BottomMenuClickEvent(MenuSelectEnum.A个人中心, true);
|
| | | }; |
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 用户主体界面(中间部分) |
| | | /// 刷新控件 |
| | | /// </summary> |
| | | public FrameLayout BodyView = new FrameLayout |
| | | public void ReFreshControl() |
| | | { |
| | | Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor, |
| | | }; |
| | | /// <summary> |
| | | /// 用户菜单界面(底部部分) |
| | | /// </summary> |
| | | public FrameLayout BottomMenuView = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight), |
| | | Height = Application.GetRealHeight(CommonPage.TabbarHeight), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBottomColor, |
| | | }; |
| | | //这里做全刷新处理 |
| | | this.listForm = new List<EditorCommonForm>() { null, null, null }; |
| | | this.bodyFrameView.RemoveAll(); |
| | | |
| | | #region 分割线 |
| | | |
| | | private Button bottomLine = new Button |
| | | { |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCBottomLineColor |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | #region 底部-主页按钮 |
| | | /// <summary> |
| | | /// 底部-主页按钮 |
| | | /// </summary> |
| | | public FrameLayout homePageFL = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(tabBarEnum_Width), |
| | | Height = Application.GetRealHeight(CommonPage.TabbarHeight), |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// The home page image. |
| | | /// </summary> |
| | | public Button homePageIMG = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumIMG_Y), |
| | | Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), |
| | | Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), |
| | | UnSelectedImagePath = "Navigation/Home.png", |
| | | SelectedImagePath = "Navigation/HomeSelected.png", |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | /// <summary> |
| | | /// The name of the home page. |
| | | /// </summary> |
| | | public Button homePageName = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumName_Y), |
| | | Height = Application.GetRealHeight(tabBarEnumName_Height), |
| | | TextID = R.MyInternationalizationString.HomePage, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, |
| | | SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 10 |
| | | }; |
| | | #endregion |
| | | |
| | | #region 分类-底部按钮 |
| | | /// <summary> |
| | | /// 分类-底部按钮 |
| | | /// </summary> |
| | | public FrameLayout categoryFL = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(tabBarEnum_Width), |
| | | Width = Application.GetRealWidth(tabBarEnum_Width), |
| | | Height = Application.GetRealHeight(CommonPage.TabbarHeight) |
| | | }; |
| | | /// <summary> |
| | | /// The category image. |
| | | /// </summary> |
| | | public Button categoryIMG = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumIMG_Y), |
| | | Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), |
| | | Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), |
| | | UnSelectedImagePath = "Navigation/Category.png", |
| | | SelectedImagePath = "Navigation/CategorySelected.png", |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | /// <summary> |
| | | /// The name of the category. |
| | | /// </summary> |
| | | public Button categoryName = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumName_Y), |
| | | Height = Application.GetRealHeight(tabBarEnumName_Height), |
| | | TextID = R.MyInternationalizationString.Category, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, |
| | | SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 10 |
| | | }; |
| | | #endregion |
| | | |
| | | #region 个人中心-底部按钮 |
| | | /// <summary> |
| | | /// 个人中心-底部按钮 |
| | | /// </summary> |
| | | public FrameLayout settingFL = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(tabBarEnum_Width * 2), |
| | | Width = Application.GetRealWidth(tabBarEnum_Width), |
| | | Height = Application.GetRealHeight(CommonPage.TabbarHeight) |
| | | }; |
| | | /// <summary> |
| | | /// The setting image. |
| | | /// </summary> |
| | | public Button settingIMG = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumIMG_Y), |
| | | Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Height), |
| | | Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(tabBarEnumIMG_Width), |
| | | UnSelectedImagePath = "Navigation/Setting.png", |
| | | SelectedImagePath = "Navigation/SettingSelected.png", |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | /// <summary> |
| | | /// 个人中心 |
| | | /// </summary> |
| | | public Button settingName = new Button |
| | | { |
| | | Y = Application.GetRealHeight(tabBarEnumName_Y), |
| | | Height = Application.GetRealHeight(tabBarEnumName_Height), |
| | | TextID = R.MyInternationalizationString.Me, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, |
| | | SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 10 |
| | | }; |
| | | #endregion |
| | | |
| | | #region 强制显示自动化界面 |
| | | |
| | | this.BottomMenuClickEvent(MenuSelectEnum.A主页, false); |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________ |
| | |
|
| | | /// <summary>
|
| | | /// 底部菜单的点击事件
|
| | | /// </summary>
|
| | | /// <param name="selectEnum">菜单选择枚举</param>
|
| | | /// <param name="handClick">是否是手动点击</param> |
| | | private void BottomMenuClickEvent(MenuSelectEnum selectEnum, bool handClick)
|
| | | {
|
| | | if (this.RefreshForm == false && selectEnum == this.nowSelectMenu && handClick == true)
|
| | | {
|
| | | //手动点击同一个菜单,则不做处理
|
| | | return;
|
| | | }
|
| | |
|
| | | //如果强制指定刷新界面的话
|
| | | if (this.RefreshForm == true)
|
| | | {
|
| | | //全部刷新
|
| | | this.listForm = new List<EditorCommonForm>() { null, null, null };
|
| | | this.bodyFrameView.RemoveAll();
|
| | |
|
| | | this.RefreshForm = false;
|
| | | }
|
| | |
|
| | | this.nowSelectMenu = selectEnum;
|
| | |
|
| | | //主页
|
| | | if (selectEnum == MenuSelectEnum.A主页) |
| | | {
|
| | | //左滑菜单可
|
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | | if (listForm[0] == null)
|
| | | {
|
| | | var form = new MainPage.HomeMainPageForm();
|
| | | this.bodyFrameView.AddChidren(form);
|
| | | form.ShowForm();
|
| | | //加缓存
|
| | | listForm[0] = form;
|
| | | } |
| | | } |
| | | else if (selectEnum == MenuSelectEnum.A分类) |
| | | {
|
| | | //左滑菜单不可
|
| | | CommonPage.Instance.IsDrawerLockMode = true;
|
| | | if (listForm[1] == null)
|
| | | {
|
| | | var form = new Category.CategoryMainForm();
|
| | | this.bodyFrameView.AddChidren(form);
|
| | | form.ShowForm();
|
| | | //加缓存
|
| | | listForm[1] = form;
|
| | | } |
| | | } |
| | | else if (selectEnum == MenuSelectEnum.A个人中心) |
| | | {
|
| | | //左滑菜单不可
|
| | | CommonPage.Instance.IsDrawerLockMode = true;
|
| | | if (listForm[2] == null)
|
| | | {
|
| | | var form = new UserCenter.UserMain.UserMainForm();
|
| | | this.bodyFrameView.AddChidren(form);
|
| | | form.ShowForm();
|
| | | //加缓存
|
| | | listForm[2] = form;
|
| | | } |
| | | }
|
| | | //设置全部控件的各种状态状态
|
| | | this.SetAllControlStatu();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置全部控件的各种状态状态
|
| | | /// </summary>
|
| | | private void SetAllControlStatu()
|
| | | {
|
| | | int index = (int)this.nowSelectMenu - 1;
|
| | | for (int i = 0; i < listForm.Count; i++)
|
| | | {
|
| | | if (i == index)
|
| | | {
|
| | | //当前选择的菜单的话,则全部可视
|
| | | listForm[i].Visible = true;
|
| | | //控件图片和颜色变更
|
| | | this.listButton[i * 2].IsSelected = true;
|
| | | this.listButton[i * 2 + 1].IsSelected = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | //不是当前选择的菜单的话,全部不可视
|
| | | if (listForm[i] != null)
|
| | | {
|
| | | listForm[i].Visible = false;
|
| | | }
|
| | | //控件图片和颜色变更
|
| | | this.listButton[i * 2].IsSelected = false;
|
| | | this.listButton[i * 2 + 1].IsSelected = false;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 强制显示自动化列表界面 |
| | | /// </summary> |
| | | public void ShowCategoryAutoListForm() |
| | | { |
| | | //关闭全部界面,直到主页为止 |
| | | UserCenter.UserCenterLogic.CloseAllOpenForm(); |
| | | UserCenterLogic.CloseAllOpenForm(); |
| | | //强制显示自动化列表界面 |
| | | UserCenter.UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2; |
| | | BottomEventHandler(Instance.categoryIMG, null); |
| | | } |
| | | UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 2; |
| | | |
| | | this.BottomMenuClickEvent(MenuSelectEnum.A分类, false); |
| | | }
|
| | |
|
| | | #endregion |
| | | |
| | | EventHandler<MouseEventArgs> BottomEventHandler = (sender, e) => |
| | | { |
| | | if (sender == Instance.homePageIMG || sender == Instance.homePageName) |
| | | { |
| | | if (Instance.homePageName.IsSelected == true && e != null) |
| | | { |
| | | //只有是手动点击的时候才处理 |
| | | return; |
| | | } |
| | | Instance.BodyView.RemoveAll(); |
| | | //主页 |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | | Instance.homePageName.IsSelected = true; |
| | | Instance.homePageIMG.IsSelected = true; |
| | | |
| | | Instance.categoryName.IsSelected = false; |
| | | Instance.categoryIMG.IsSelected = false; |
| | | |
| | | Instance.settingName.IsSelected = false; |
| | | Instance.settingIMG.IsSelected = false; |
| | | |
| | | var home = new MainPage.HomeMainPageForm(); |
| | | Instance.BodyView.AddChidren(home); |
| | | home.ShowForm(); |
| | | |
| | | } |
| | | else if (sender == Instance.categoryIMG || sender == Instance.categoryName) |
| | | { |
| | | if (Instance.categoryName.IsSelected == true && e != null) |
| | | { |
| | | //只有是手动点击的时候才处理 |
| | | return; |
| | | } |
| | | |
| | | Instance.BodyView.RemoveAll(); |
| | | //分类 |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | Instance.categoryName.IsSelected = true; |
| | | Instance.categoryIMG.IsSelected = true; |
| | | |
| | | Instance.homePageName.IsSelected = false; |
| | | Instance.homePageIMG.IsSelected = false; |
| | | |
| | | Instance.settingName.IsSelected = false; |
| | | Instance.settingIMG.IsSelected = false; |
| | | |
| | | var category = new Category.CategoryMainForm { }; |
| | | Instance.BodyView.AddChidren(category); |
| | | category.ShowForm(); |
| | | } |
| | | else if (sender == Instance.settingIMG || sender == Instance.settingName) |
| | | { |
| | | if (Instance.settingName.IsSelected == true && e != null) |
| | | { |
| | | return; |
| | | } |
| | | Instance.BodyView.RemoveAll(); |
| | | //个人中心 |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | Instance.settingName.IsSelected = true; |
| | | Instance.settingIMG.IsSelected = true; |
| | | |
| | | Instance.homePageName.IsSelected = false; |
| | | Instance.homePageIMG.IsSelected = false; |
| | | |
| | | Instance.categoryName.IsSelected = false; |
| | | Instance.categoryIMG.IsSelected = false; |
| | | |
| | | var form = new UserCenter.UserMain.UserMainForm(); |
| | | Instance.BodyView.AddChidren(form); |
| | | form.ShowForm(); |
| | | } |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// Fresh this instance. |
| | |
|
| | | #region ■ 结构体_____________________________ |
| | |
|
| | | /// <summary>
|
| | | /// 菜单选择的枚举
|
| | | /// </summary> |
| | | public void Fresh() |
| | | { |
| | | BottomEventHandler(Instance.homePageIMG, null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Inits the page. |
| | | /// </summary> |
| | | public void InitPage() |
| | | { |
| | | if (0 < ChildrenCount) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | AddChidren(BodyView); |
| | | AddChidren(BottomMenuView); |
| | | |
| | | BottomMenuView.AddChidren(Instance.bottomLine); |
| | | |
| | | Instance.homePageFL.AddChidren(Instance.homePageIMG); |
| | | Instance.homePageFL.AddChidren(Instance.homePageName); |
| | | BottomMenuView.AddChidren(Instance.homePageFL); |
| | | |
| | | Instance.categoryFL.AddChidren(Instance.categoryIMG); |
| | | Instance.categoryFL.AddChidren(Instance.categoryName); |
| | | BottomMenuView.AddChidren(Instance.categoryFL); |
| | | |
| | | Instance.settingFL.AddChidren(Instance.settingIMG); |
| | | Instance.settingFL.AddChidren(Instance.settingName); |
| | | BottomMenuView.AddChidren(Instance.settingFL); |
| | | |
| | | homePageIMG.MouseUpEventHandler += BottomEventHandler; |
| | | homePageName.MouseUpEventHandler += BottomEventHandler; |
| | | |
| | | categoryIMG.MouseUpEventHandler += BottomEventHandler; |
| | | categoryName.MouseUpEventHandler += BottomEventHandler; |
| | | |
| | | settingIMG.MouseUpEventHandler += BottomEventHandler; |
| | | settingName.MouseUpEventHandler += BottomEventHandler; |
| | | } |
| | | private enum MenuSelectEnum
|
| | | {
|
| | | A未选择 = 0,
|
| | | A主页 = 1,
|
| | | A分类 = 2,
|
| | | A个人中心 = 3
|
| | | }
|
| | |
|
| | | #endregion |
| | | } |
| | | } |
| | |
| | | {
|
| | | searchCount = 6;
|
| | | ZbGateway.IsRemote = false;
|
| | | //当网关的连接方式改变时,记录当前的连接方式
|
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.WIFI);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (searchCount < 0)
|
| | | {
|
| | | ZbGateway.IsRemote = true;
|
| | | //当网关的连接方式改变时,记录当前的连接方式
|
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ZbGateway.IsRemote = true;
|
| | | //当网关的连接方式改变时,记录当前的连接方式
|
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
|
| | |
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++) |
| | | {
|
| | | ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1"); |
| | |
| | | try |
| | | { |
| | | //定时检测远程连接情况 |
| | | await ZbGateway.StartRemoteMqtt();
|
| | | if (!ZbGateway.IsRemote) |
| | | { |
| | | System.Threading.Thread.Sleep(500); |
| | | continue; |
| | | } |
| | | var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); |
| | | |
| | | if (gateWayList.Count == 1) |
| | | { |
| | | gateWayList[0].getGatewayBaseInfo.IsMainGateWay = true; |
| | | } |
| | | else |
| | | { |
| | | if (gateWayList.Find((obj) => obj.getGatewayBaseInfo.IsMainGateWay) == null) |
| | | { |
| | | for (int i = 0; i < gateWayList.Count; i++) |
| | | { |
| | | var gateWay = gateWayList[i]; |
| | | var info = await gateWay.GetZbGwInfoAsync(); |
| | | if (info == null || info.getGwData == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (info.getGwData.IsDominant == 1) |
| | | {
|
| | | for (int j = 0; j < gateWayList.Count; j++)
|
| | | {
|
| | | if (gateWayList[i].getGatewayBaseInfo.gwID == info.getGwData.GwId)
|
| | | {
|
| | | gateWayList[i].getGatewayBaseInfo.IsMainGateWay = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | gateWayList[i].getGatewayBaseInfo.IsMainGateWay = false;
|
| | | }
|
| | | }
|
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | await ZbGateway.StartRemoteMqtt(); |
| | | } |
| | | catch { } |
| | | System.Threading.Thread.Sleep(2000); |
| | |
| | | /// 远程连接的Mqtt的客户端ID
|
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public string ConnEmqClientId = string.Empty; |
| | | public string ConnEmqClientId = string.Empty;
|
| | | /// <summary>
|
| | | /// 当前登录的账号是不是之前的账号
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public bool TheSameLoginAccount = false; |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | /// <summary> |
| | |
| | | //新风 |
| | | IconPath = "Device/FreshAirEpoint.png"; |
| | | } |
| | | else if (this.Type == DeviceType.FreshAir) |
| | | else if (this.Type == DeviceType.PMSensor) |
| | | { |
| | | //PM2.5空气质量传感器 |
| | | IconPath = "Device/FreshAirEpoint.png"; |
| | | IconPath = "Device/AirQualitySensorEpoint.png"; |
| | | } |
| | | else if (this.Type == DeviceType.FreshAirHumiditySensor) |
| | | { |
| | |
| | | /// </summary> |
| | | public int IsOnline; |
| | | /// <summary> |
| | | /// 1:路由设备 |
| | | /// <para>2:终端设备,电池设备</para> |
| | | /// </summary> |
| | | public int ZigbeeType; |
| | | /// <summary> |
| | | /// 当前运行程序版本信息。 最大64字节 |
| | | /// </summary> |
| | | public int ImgVersion; |
old mode 100644
new mode 100755
| | |
| | | /// <para>定义对象:TemperatureSensor</para>
|
| | | /// </summary> |
| | | TemperatureSensor = 770, |
| | | /// <summary>
|
| | | /// <para>PM2.5传感器</para>
|
| | | /// <para>设备ID为777</para>
|
| | | /// <para>定义对象:PMSensor</para>
|
| | | /// <summary> |
| | | /// <para>PM2.5传感器</para> |
| | | /// <para>设备ID为777</para> |
| | | /// <para>定义对象:PMSensor</para> |
| | | /// </summary> |
| | | PMSensor = 777, |
| | | }
|
| | |
| | | { |
| | | this.Type = DeviceType.PMSensor; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前温度 |
| | | /// </summary> |
| | | public int currentTemperature = 0; |
| | | /// <summary> |
| | | /// 当前湿度 |
| | | /// </summary> |
| | | public int currentHumidity = 0; |
| | | /// <summary> |
| | | /// 当前PM2.5值 |
| | | /// </summary> |
| | | public int currentPmData = 0; |
| | | } |
| | | } |
| | |
| | | {
|
| | | DebugPrintLog($" 本地连接成功_网关IP:{brokerName}_网关是否加:{IsEncry}_当前密码:{Password}");
|
| | | IsRemote = false;
|
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.WIFI);
|
| | | }); |
| | | }
|
| | |
|
| | |
| | | await RemoteMqttClient.SubscribeAsync("/ZigbeeGateWayToClient/" + Config.Instance.ConnEmqClientId + "/Push/NotifySqueeze");
|
| | |
|
| | | await initGateWayBaseInfomation(); |
| | | Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
|
| | |
|
| | | //没有主网关时主动读取,获取主网关信息
|
| | | var gateWayList = GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
|
| | | if (gateWayList.Find(obj => obj.getGatewayBaseInfo.IsMainGateWay == true) == null)
|
| | |
| | | /// 自动模式不支持操作 |
| | | /// </summary> |
| | | public const int AutoModeForbiddenOperate = 314; |
| | | /// <summary> |
| | | /// 空气质量 |
| | | /// </summary> |
| | | public const int AirQuality = 315; |
| | | /// <summary> |
| | | /// 空气质量传感器 |
| | | /// </summary> |
| | | public const int AirQualitySensor = 316; |
| | | |
| | | public readonly static int cancel = 5097; |
| | | public readonly static int confrim = 5098; |
| | |
| | | public readonly static int or = 5396; |
| | | public readonly static int timeNull = 5397; |
| | | public readonly static int numberInput = 5398; |
| | | public readonly static int closeFailed = 5399; |
| | | public readonly static int openFailed = 5400; |
| | | public readonly static int addFailed = 5401; |
| | | public readonly static int timeSensitive = 5402; |
| | | public readonly static int executeSone = 5403; |
| | | |
| | | |
| | | |
| | | #region 登录注册 |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public const int Cancel = 11023; |
| | | /// <summary> |
| | | /// 没有场景 {\r\n} 请点击右上角添加 |
| | | /// 没有场景{0}请点击右上角添加 |
| | | /// </summary> |
| | | public const int NoScene = 11024; |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 镜像ID为1306的设备的默认名字:Zigbee吸顶燃气传感器 |
| | | /// </summary> |
| | | public const int uDeviceModelId1306 = 30039; |
| | | public const int uDeviceModelId1306 = 30039;
|
| | | /// <summary> |
| | | /// 镜像ID为1307的设备的默认名字:PM2.5空气质量传感器 |
| | | /// </summary> |
| | | public const int uDeviceModelId1307 = 30040;
|
| | | public const int uDeviceModelId1307 = 30040; |
| | |
|
| | | //★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★
|
| | | /// <summary>
|
| | |
| | | /// 自定义设备所属ID为2310的翻译名字:新风 |
| | | /// </summary> |
| | | public const int uDeviceBelongId2310 = 40018; |
| | | /// <summary> |
| | | /// 自定义设备所属ID为1307的翻译名字:PM2.5空气质量传感器 |
| | | /// </summary> |
| | | public const int uDeviceBelongId1307 = 40019; |
| | |
|
| | | //★★★★模块ID的设备默认备注名字,从50000开始,这里不需要定义,只写在Language.ini文件里面★★★★
|
| | | //★★★★模块ID的设备类型名字,从60000开始,这里不需要定义,只写在Language.ini文件里面★★★★
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\DoorLock.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\FreshAir.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\HumiditySensor.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\PMSensor.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\Repeater.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\ThirdPartyModuleUpgrade.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\Transverter.cs" />
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\IO\LocalFileUtils.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlSafeguardLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlAlarmsLogic.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\Device\PMSensor.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Category\Controls\DeviceRow\DevicePmSensorRowControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DevicePmSensorDetailCardForm.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Phone\CommonForm\" />
|