| | |
| | | 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;
|
| | |
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = Application.GetMinRealAverage(757),
|
| | | Height = Application.GetMinRealAverage(435),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | |
| | | for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
|
| | | {
|
| | | 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 if (device.Type == DeviceType.Thermostat)
|
| | | {
|
| | | cardContr = new Controls.DeviceAcRowControl(listView.rowSpace / 2);
|
| | | }
|
| | | // 新风
|
| | | else if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | cardContr = new Controls.DeviceFreshAirRowControl(listView.rowSpace / 2);
|
| | | }
|
| | | //彩灯(调光器)
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | |
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | //开启场景延时特效
|
| | | 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(sceneContr.scene);
|
| | | while (remainTime > 0 && this.Parent != null)
|
| | | {
|
| | | //开启内部延时时间线程(旨在全部地方的同一场景时间同步)
|
| | | HdlSceneLogic.Current.StartDelayTimeThread(seceneContr.scene);
|
| | | while (remainTime > 0 && this.Parent != null)
|
| | | {
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | seceneContr.SetTimeText(this.GetTimeString(remainTime, hourText, minuText, secondText));
|
| | | });
|
| | | remainTime--;
|
| | | }
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (listview.Parent != null)
|
| | | {
|
| | | seceneContr.SetTimeImage();
|
| | | //开启Loading特效
|
| | | seceneContr.StartLoadingApreal();
|
| | | }
|
| | | sceneContr.SetTimeText(this.GetTimeString(remainTime, hourText, minuText, secondText));
|
| | | });
|
| | | remainTime--;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (listview.Parent != null)
|
| | | {
|
| | | sceneContr.SetTimeImage();
|
| | | //开启Loading特效
|
| | | sceneContr.StartLoadingApreal();
|
| | | }
|
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = Application.GetMinRealAverage(757),
|
| | | Height = Application.GetMinRealAverage(435),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | |
| | | if (report.DeviceStatusReport.CluterID == 513 && report.DeviceStatusReport.AttriBute[0].AttributeId == 28)
|
| | | {
|
| | | //空调是特殊的,它的开关是属性上报来着.已经接收到网关的反馈
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | }
|
| | | if (report.DeviceStatusReport.CluterID == 514 && report.DeviceStatusReport.AttriBute[0].AttributeId == 0)
|
| | | {
|
| | | //新风是特殊的,它的开关是属性上报来着.已经接收到网关的反馈
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | }
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice);
|
| | |
| | | LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneTextId].IconPath = path1;
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = path2;
|
| | | 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;
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | #endregion
|