| | |
| | | this.AddChidren(topFrameLayout);
|
| | | //标题分类
|
| | | var btnTitle = new NormalViewControl(400, 95, true);
|
| | | btnTitle.X = ControlCommonResourse.XXLeft;
|
| | | btnTitle.X = HdlControlResourse.XXLeft;
|
| | | btnTitle.Gravity = Gravity.CenterVertical;
|
| | | btnTitle.TextID = R.MyInternationalizationString.Category;
|
| | | btnTitle.TextSize = 24;
|
| | |
| | | topFrameLayout.AddChidren(btnTopRightAdd);
|
| | | btnTopRightAdd.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | {
|
| | | //添加场景
|
| | | var form = new AddOrEditorSceneForm();
|
| | |
| | | this.RefreshBodyView();
|
| | | };
|
| | | }
|
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
|
| | | else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
|
| | | {
|
| | | //添加自动化
|
| | | Device.Logic.SkipView.SkipAddLogic(0);
|
| | |
| | | var listTitle = new List<string>();
|
| | | listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence));
|
| | | listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction));
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //成员没有自动化
|
| | | listTitle.Add(Language.StringByID(R.MyInternationalizationString.Automation));
|
| | | }
|
| | | //设置初始值
|
| | | switchContr.SetDefultIndex(UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex);
|
| | | switchContr.SetDefultIndex(HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex);
|
| | | //选择事件
|
| | | switchContr.SelectTabEvent += (selectIndex) =>
|
| | | {
|
| | | UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = selectIndex;
|
| | | HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = selectIndex;
|
| | | if (selectIndex == 2)
|
| | | {
|
| | | Common.Logic.LogicDviceList.Clear();
|
| | | if (Common.Logic.LogicDviceList.Count == 0)
|
| | | {
|
| | | Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
|
| | | Common.Logic.LogicDviceList.AddRange(HdlDeviceCommonLogic.Current.listAllDevice.ToArray());
|
| | | }
|
| | | }
|
| | | //刷新bodyView
|
| | |
| | | {
|
| | | bool floorVisible = true;
|
| | | //场景
|
| | | if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | {
|
| | | //初始化房间菜单
|
| | | this.InitRoomMenuControl();
|
| | |
| | | this.btnTopRightAdd.Visible = true;
|
| | | }
|
| | | //功能
|
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
|
| | | else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
|
| | | {
|
| | | //初始化房间菜单
|
| | | this.InitRoomMenuControl();
|
| | |
| | | this.btnTopRightAdd.Visible = false;
|
| | | }
|
| | | //自动化
|
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
|
| | | else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
|
| | | {
|
| | | //自动化功能代码入口
|
| | | Device.Logic.SkipView.ShowAutotionView(functionSceneAutoBodyView);
|
| | |
| | | {
|
| | | HdlRoomLogic.Current.NowCategoryRoom = selectRoom;
|
| | | //场景
|
| | | if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | {
|
| | | //在外面清空(特效的问题)
|
| | | this.functionSceneBodyView.RemoveAll();
|
| | |
| | | });
|
| | | }
|
| | | //功能
|
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
|
| | | else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
|
| | | {
|
| | | //在外面清空(特效的问题)
|
| | | this.functionSceneBodyView.RemoveAll();
|
| | |
| | |
|
| | | //设备菜单的白色背景
|
| | | var functionBack1 = new FrameLayout();
|
| | | functionBack1.X = ControlCommonResourse.XXLeft;
|
| | | functionBack1.X = HdlControlResourse.XXLeft;
|
| | | functionBack1.Height = Application.GetRealHeight(160);
|
| | | functionBack1.Width = Application.GetRealWidth(1028);
|
| | | functionBack1.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
| | | functionSceneBodyView.AddChidren(functionBack1);
|
| | | functionBack1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft);
|
| | | var functionBack2 = new FrameLayout();
|
| | | functionBack2.X = ControlCommonResourse.XXLeft;
|
| | | functionBack2.X = HdlControlResourse.XXLeft;
|
| | | functionBack2.Y = functionBack1.Bottom - Application.GetRealHeight(50);
|
| | | functionBack2.Height = Application.GetRealHeight(279 - 160 + 50);
|
| | | functionBack2.Width = Application.GetRealWidth(1028);
|
| | |
| | |
|
| | | //设备菜单的左右滑动的控件
|
| | | var HorizontalView = new HorizontalScrolViewLayout();
|
| | | HorizontalView.X = Application.GetRealWidth(CommonFormResouce.X_Left);
|
| | | HorizontalView.X = HdlControlResourse.XXLeft;
|
| | | HorizontalView.Height = Application.GetRealHeight(279);
|
| | | HorizontalView.Width = Application.GetRealWidth(1028);
|
| | | functionSceneBodyView.AddChidren(HorizontalView);
|
| | |
|
| | | //设备的背景容器
|
| | | var frameDeviceBack = new FrameLayout();
|
| | | frameDeviceBack.X = ControlCommonResourse.XXLeft;
|
| | | frameDeviceBack.X = HdlControlResourse.XXLeft;
|
| | | frameDeviceBack.Y = HorizontalView.Bottom + Application.GetRealHeight(35);
|
| | | frameDeviceBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameDeviceBack.Width = bodyFrameLayout.Width;
|
| | |
| | | var listDevice = new List<CommonDevice>();
|
| | | for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
|
| | | {
|
| | | var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]);
|
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(rowInfo.listDeviceKeys[i]);
|
| | |
|
| | | //获取设备类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | //新风面板下的回路不显示,(如新风、温/湿度传感器则不显示)
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
| | | if (device.Type == DeviceType.WindowCoveringDevice)
|
| | | {
|
| | | cardContr = new Controls.DeviceCurtainRowControl();
|
| | | }
|
| | | //晾衣架 Airer
|
| | | if (device.Type == DeviceType.Airer)
|
| | | {
|
| | | cardContr = new Controls.DeviceAirerRowControl();
|
| | | }
|
| | | //继电器
|
| | | else if (device.Type == DeviceType.OnOffOutput)
|
| | |
| | | listView.AddChidren(cardContr);
|
| | | cardContr.InitControl(device, HdlRoomLogic.Current.NowCategoryRoom);
|
| | | //控件记录到缓存中
|
| | | this.dicDeviceRowControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr;
|
| | | this.dicDeviceRowControl[HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device)] = cardContr;
|
| | | //加缓存,然后发命令
|
| | | listContr.Add(cardContr);
|
| | | //控件被移除的回调函数
|
| | | cardContr.RowNeedRemoveEvent += () =>
|
| | | {
|
| | | string myKeys = LocalDevice.Current.GetDeviceMainKeys(cardContr.device);
|
| | | string myKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(cardContr.device);
|
| | | rowInfo.listDeviceKeys.Remove(myKeys);
|
| | | this.dicDeviceRowControl.Remove(myKeys);
|
| | |
|
| | |
| | | }
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | int sendCount = 0;
|
| | | while (listView.Parent != null)
|
| | | {
|
| | | bool hadSend = false;
|
| | |
| | | //发送获取状态的命令
|
| | | listContr[i].SendStatuComand();
|
| | | hadSend = true;
|
| | | System.Threading.Thread.Sleep(300);
|
| | | System.Threading.Thread.Sleep(200);
|
| | | }
|
| | | }
|
| | | if (hadSend == false)
|
| | |
| | | //如果已经全部回路都接收了网关回复,则不再二次发送
|
| | | break;
|
| | | }
|
| | | sendCount++;
|
| | | if (sendCount == 2)
|
| | | {
|
| | | //就发2次
|
| | | break;
|
| | | }
|
| | | System.Threading.Thread.Sleep(5000);
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | |
| | | VerticalListRefreshControl listview1 = null;
|
| | | //成员专用不能刷新的控件
|
| | | VerticalListControl listview2 = null;
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
|
| | | {
|
| | | //主人,管理员专用刷新控件
|
| | | listview1 = new VerticalListRefreshControl();
|
| | |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //处理一般设备的上报数据
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | //晾衣架上报需要特殊处理,其他上报的回路统一转为端点1
|
| | | var tempList = LocalDevice.Current.GetDevicesByMac(report.DeviceAddr);
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | }
|
| | | string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //刷新卡片信息
|
| | | var locadevice = LocalDevice.Current.GetDevice(mainKeys);
|
| | | var locadevice = HdlDeviceCommonLogic.Current.GetDevice(mainKeys);
|
| | | //已经接收到网关的反馈 2020.05.09:删除Ack主题
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | //刷新控件
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //刷新卡片状态
|
| | | bool bolOnline = LocalDevice.Current.CheckDeviceIsOnline(report);
|
| | | bool bolOnline = HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(report);
|
| | | this.dicDeviceRowControl[mainKeys].SetRowOnlineStatu(bolOnline);
|
| | | return;
|
| | | }
|
| | |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //处理传感器上报数据
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //开启行闪烁特效
|
| | |
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //设备状态必须刷新
|
| | | string statuText = HdlDeviceOtherLogic.Current.GetDeviceStatu(contr.device);
|
| | | string statuText = HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(contr.device);
|
| | | contr.SetDeviceStatuText(statuText);
|
| | | //传感器切换为灰色状态
|
| | | contr.SwitchRowStatuAppeal(false);
|
| | |
| | | foreach (var device in listDeviceTemp)
|
| | | {
|
| | | //判断该设备能否显示在分类
|
| | | if (LocalDevice.Current.CanShowInHomeHomeMainPage(device) == false)
|
| | | if (HdlDeviceCommonLogic.Current.CanShowInHomeHomeMainPage(device) == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | //根据设备所属类型排序
|
| | | listDevice = LocalDevice.Current.SortDeviceByBelongType(listDevice);
|
| | | listDevice = HdlDeviceCommonLogic.Current.SortDeviceByBelongType(listDevice);
|
| | | var dic = new Dictionary<string, DeviceRowInfo>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | var typeInfo = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
|
| | | var typeInfo = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device);
|
| | | //按所属ID分组
|
| | | if (dic.ContainsKey(typeInfo.BeloneText) == false)
|
| | | {
|
| | |
| | | string path1 = string.Empty;
|
| | | string path2 = string.Empty;
|
| | | //获取图片
|
| | | LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo, ref path1, ref path2);
|
| | | HdlDeviceCommonLogic.Current.GetDeviceFunctionTypeMenuIcon(typeInfo, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneText].IconPath = path1;
|
| | | dic[typeInfo.BeloneText].IconPathSelected = path2;
|
| | | dic[typeInfo.BeloneText].Text = typeInfo.BeloneText;
|
| | | }
|
| | | dic[typeInfo.BeloneText].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | | dic[typeInfo.BeloneText].listDeviceKeys.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device));
|
| | | }
|
| | | return dic;
|
| | | }
|