old mode 100644
new mode 100755
| | |
| | | if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0) |
| | | { |
| | | //添加场景 |
| | | Add_Scene(); |
| | | var form = new AddOrEditorSceneForm();
|
| | | form.AddForm(new object[] { null });
|
| | | form.SceneChangedEvent += (scene, roomId) =>
|
| | | {
|
| | | //刷新bodyView
|
| | | this.RefreshBodyView();
|
| | | };
|
| | | } |
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2) |
| | | { |
| | | //添加自动化 |
| | | Add_Automation(); |
| | | Device.Logic.SkipView.SkipAddLogic(0);
|
| | | } |
| | | }; |
| | | } |
| | |
| | | frameSwitchBack.AddChidren(btnFloorName); |
| | | btnFloorName.ButtonClickEvent += (sender, e) => |
| | | { |
| | | var floors = new Device.Category.SelectFloor(); |
| | | var floors = new SelectFloorForm();
|
| | | AddChidren(floors); |
| | | floors.Init(580, 330, Direction.Right); |
| | | floors.changeFloor = true; |
| | |
| | | //楼层图标 |
| | | this.btnFloorIcon = new IconViewControl(69); |
| | | btnFloorIcon.X = Application.GetRealWidth(950); |
| | | btnFloorIcon.Y = btnFloorName.Y; |
| | | btnFloorIcon.Y = Application.GetRealHeight(17);
|
| | | btnFloorIcon.UnSelectedImagePath = "Item/Drop_Down.png"; |
| | | frameSwitchBack.AddChidren(btnFloorIcon); |
| | | btnFloorIcon.ButtonClickEvent += (sender, e) => |
| | |
| | | //选择事件 |
| | | switchContr.SelectTabEvent += (selectIndex) => |
| | | { |
| | | |
| | | UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = selectIndex; |
| | | if (selectIndex == 2) |
| | | { |
| | |
| | | //自动化 |
| | | else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2) |
| | | { |
| | | |
| | | this.ShowAutotion(); |
| | | //隐藏楼层 |
| | | floorVisible = false; |
| | |
| | | HdlThreadLogic.Current.RunMainInThread(() => |
| | | { |
| | | //初始化设备列表控件 |
| | | this.InitListDeviceControls(listDeviceView, rowInfo); |
| | | this.InitListDeviceControls(listDeviceView, rowInfo, room);
|
| | | }); |
| | | } |
| | | }; |
| | |
| | | if (nowSelectDeviceInfo != null) |
| | | { |
| | | //初始化默认的设备列表控件 |
| | | this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo); |
| | | this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo, room);
|
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="listView"></param> |
| | | /// <param name="rowInfo"></param> |
| | | private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo) |
| | | private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo, Room i_room)
|
| | | { |
| | | //先清空 |
| | | listView.RemoveAll(); |
| | | |
| | | var listDevice = new List<CommonDevice>(); |
| | | foreach (var mainkeys in rowInfo.listDeviceKeys) |
| | | for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
|
| | | { |
| | | var device = LocalDevice.Current.GetDevice(mainkeys); |
| | | var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]);
|
| | |
|
| | | //获取设备类型的
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | //新风面板下的回路不显示,(如新风、温/湿度传感器则不显示)
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (device != null) |
| | | { |
| | | listDevice.Add(device); |
| | | }
|
| | | else
|
| | | {
|
| | | rowInfo.listDeviceKeys.RemoveAt(i);
|
| | | i--;
|
| | | } |
| | | } |
| | | |
| | |
| | | this.dicDeviceRowControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr; |
| | | //加缓存,然后发命令 |
| | | listContr.Add(cardContr); |
| | | //控件被移除的回调函数
|
| | | cardContr.RowNeedRemoveEvent += () =>
|
| | | {
|
| | | string myKeys = LocalDevice.Current.GetDeviceMainKeys(cardContr.device);
|
| | | rowInfo.listDeviceKeys.Remove(myKeys);
|
| | | this.dicDeviceRowControl.Remove(myKeys);
|
| | |
|
| | | if (rowInfo.listDeviceKeys.Count == 0)
|
| | | {
|
| | | //在外面清空(特效的问题)
|
| | | this.functionSceneBodyView.RemoveAll();
|
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | {
|
| | | //刷新设备分支控件
|
| | | this.RefreshFunctionView(i_room);
|
| | | });
|
| | | }
|
| | | };
|
| | | } |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | System.Threading.Thread.Sleep(20); |
| | | System.Threading.Thread.Sleep(200);
|
| | | //发送获取状态的命令 |
| | | listContr[i].SendStatuComand(); |
| | | } |
| | |
| | | } |
| | | |
| | | var dicSceneContr = new Dictionary<int, SceneCategoryView>(); |
| | | var listview = new VerticalListControl(); |
| | | functionSceneBodyView.AddChidren(listview); |
| | | //主人,管理员专用刷新控件
|
| | | VerticalListRefreshControl listview1 = null;
|
| | | //成员专用不能刷新的控件
|
| | | VerticalListControl listview2 = null;
|
| | | //if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | //{
|
| | | // listview1 = new VerticalListRefreshControl();
|
| | | // functionSceneBodyView.AddChidren(listview1);
|
| | | //}
|
| | | //else
|
| | | {
|
| | | listview2 = new VerticalListControl();
|
| | | functionSceneBodyView.AddChidren(listview2);
|
| | | }
|
| | | |
| | | foreach (var scene in listScene) |
| | | { |
| | | //场景卡片控件 |
| | | var sceneView = new SceneCategoryView(); |
| | | listview.AddChidren(sceneView); |
| | | listview1?.AddChidren(sceneView);
|
| | | listview2?.AddChidren(sceneView);
|
| | | sceneView.InitControl(scene, room); |
| | | |
| | | dicSceneContr[scene.Id] = sceneView; |
| | | } |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //获取全部场景的延时时间 |
| | | this.GetAllDelayScene(dicSceneContr, listview); |
| | | if (listview1 != null)
|
| | | {
|
| | | //打开全部场景的延时时间
|
| | | this.StartAllDelayScene(dicSceneContr, listview1);
|
| | | }
|
| | | else
|
| | | {
|
| | | //打开全部场景的延时时间
|
| | | this.StartAllDelayScene(dicSceneContr, listview2);
|
| | | }
|
| | | }, ShowErrorMode.NO); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取全部场景的延时时间 |
| | | /// 打开全部场景的延时时间
|
| | | /// </summary> |
| | | /// <param name="dicSceneContr"></param> |
| | | private async void GetAllDelayScene(Dictionary<int, SceneCategoryView> dicSceneContr, VerticalListControl listview) |
| | | private async void StartAllDelayScene(Dictionary<int, SceneCategoryView> dicSceneContr, ViewGroup listview)
|
| | | { |
| | | string hourText = Language.StringByID(R.MyInternationalizationString.Hour);
|
| | | string minuText = Language.StringByID(R.MyInternationalizationString.Minute);
|
| | | string secondText = Language.StringByID(R.MyInternationalizationString.Second);
|
| | |
|
| | | //如果当前住宅是虚拟住宅
|
| | | if (Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //开启延时特效
|
| | | foreach (var myContr in dicSceneContr.Values)
|
| | | {
|
| | | if (myContr.scene.RemainTime > 0)
|
| | | {
|
| | | //开启场景延时特效
|
| | | this.StartSceneDelayApeal(myContr, listview, myContr.scene.RemainTime, hourText, minuText, secondText);
|
| | | }
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | return;
|
| | | }
|
| | |
|
| | | //读取全部的延时时间 |
| | | var result = await Scene.CatDelaySceneAsync(); |
| | | if (result == null || result.catDelaySceneResponseData == null || |
| | |
| | | //出错不鸟它 |
| | | return; |
| | | } |
| | | |
| | | string hourText = Language.StringByID(R.MyInternationalizationString.Hour); |
| | | string minuText = Language.StringByID(R.MyInternationalizationString.Minute); |
| | | string secondText = Language.StringByID(R.MyInternationalizationString.Second); |
| | | |
| | | foreach (var data in result.catDelaySceneResponseData.DelayScenesList) |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //开启场景延时特效
|
| | | this.StartSceneDelayApeal(seceneContr, listview, remainTime, hourText, minuText, secondText);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 开启场景延时特效
|
| | | /// </summary>
|
| | | /// <param name="sceneContr"></param>
|
| | | /// <param name="remainTime"></param>
|
| | | /// <param name="hourText"></param>
|
| | | /// <param name="minuText"></param>
|
| | | /// <param name="secondText"></param>
|
| | | private void StartSceneDelayApeal(SceneCategoryView sceneContr, ViewGroup listview, int remainTime,
|
| | | string hourText, string minuText, string secondText)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | //开启内部延时时间线程(旨在全部地方的同一场景时间同步) |
| | | HdlSceneLogic.Current.StartDelayTimeThread(seceneContr.scene); |
| | | HdlSceneLogic.Current.StartDelayTimeThread(sceneContr.scene);
|
| | | while (remainTime > 0 && this.Parent != null) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | seceneContr.SetTimeText(this.GetTimeString(remainTime, hourText, minuText, secondText)); |
| | | sceneContr.SetTimeText(this.GetTimeString(remainTime, hourText, minuText, secondText));
|
| | | }); |
| | | remainTime--; |
| | | } |
| | |
| | | { |
| | | if (listview.Parent != null) |
| | | { |
| | | seceneContr.SetTimeImage(); |
| | | sceneContr.SetTimeImage();
|
| | | //开启Loading特效 |
| | | seceneContr.StartLoadingApreal(); |
| | | sceneContr.StartLoadingApreal();
|
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | //刷新卡片信息 |
| | | var locadevice = LocalDevice.Current.GetDevice(mainKeys); |
| | | if (report.DeviceStatusReport.CluterID == 513 && report.DeviceStatusReport.AttriBute[0].AttributeId == 28)
|
| | | {
|
| | | //空调是特殊的,它的开关是属性上报来着.已经接收到网关的反馈
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | }
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice); |
| | | } |
| | | }, ShowErrorMode.NO); |
| | |
| | | private Dictionary<int, DeviceRowInfo> GetAllGroupDevice(Common.Room room) |
| | | { |
| | | //全部的设备 |
| | | var listDevice = HdlRoomLogic.Current.GetRoomListDevice(room); |
| | | var listDeviceTemp = HdlRoomLogic.Current.GetRoomListDevice(room);
|
| | | var listDevice = new List<CommonDevice>();
|
| | | foreach (var device in listDeviceTemp)
|
| | | {
|
| | | //判断该设备能否显示在分类
|
| | | if (LocalDevice.Current.CanShowInHomeHomeMainPage(device) == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | listDevice.Add(device);
|
| | | }
|
| | |
|
| | | //根据设备所属类型排序 |
| | | listDevice = LocalDevice.Current.SortDeviceByBelongType(listDevice); |
| | | var dic = new Dictionary<int, DeviceRowInfo>(); |
| | |
| | | timeStr += sec + secondText; |
| | | } |
| | | return timeStr; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加场景(郭雪城的代码) |
| | | /// </summary> |
| | | private void Add_Scene() |
| | | { |
| | | var scene = new Device.Category.CategoryAddScene(); |
| | | UserView.HomePage.Instance.AddChidren(scene); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | scene.Show(); |
| | | scene.AddAction = () => |
| | | { |
| | | //刷新bodyView |
| | | this.RefreshBodyView(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加自动化(郭雪城的代码) |
| | | /// </summary> |
| | | private void Add_Automation() |
| | | { |
| | | Shared.Phone.Device.Logic.SkipView.SkipAddLogic(0); |
| | | ////new一个新逻辑对象; |
| | | //Common.Logic.CurrentLogic = new Common.Logic(); |
| | | //Common.Logic.CurrentLogic.IsEnable = 1;//默认为开 |
| | | //Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1); |
| | | //var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage(); |
| | | //UserView.HomePage.Instance.AddChidren(addLogicPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //addLogicPage.Show(); |
| | | } |
| | | |
| | | #endregion |