gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -255,14 +255,6 @@
                                                        ac.currentSystemMode = attList.AttriButeData;
                                                        ac.LastDateTime = DateTime.Now;
                                                        break;
                                                    case 4099:
                                                        var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0');
                                                        var modeStr = value.Substring(value.Length - 5, 5);
                                                        for (int k = 0; k < modeStr.Length; k++)
                                                        {
                                                            ac.listSupportMode[k] = Convert.ToInt32(modeStr[k]) == 49 ? 1 : 0;
                                                        }
                                                        break;
                                                }
                                            }
                                            (rowFL.GetChildren(j) as FunctionMainView).IsSelected = ac.currentSystemMode != 0;
@@ -936,7 +928,7 @@
                var dList = new List<DeviceUI> { };
                foreach(var device in deviceList)
                {
                    var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice });
                    var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice);
                    if (info.BeloneType == DeviceBeloneType.A干接点 || info.BeloneType == DeviceBeloneType.A中继器)
                    {
                        continue;
@@ -1018,7 +1010,7 @@
                                        functionView.Init();
                                        functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        functionView.SetStatuText(device.GetDeviceStatu());
                                        functionView.SetDeviceName(rollerShade.DeviceEpointName);
                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(rollerShade));
                                        functionView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100;
                                        functionView.SetCollect(true);
@@ -1086,6 +1078,7 @@
                                            UserView.HomePage.Instance.AddChidren(rollerShadeControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            UserView.HomePage.Instance.ScrollEnabled = false;
                                            rollerShadeControl.IsDrawerLockMode = true;
                                            rollerShadeControl.Show(device, Room.CurrentRoom);
                                            rollerShadeControl.action += (curDev, curRoom) =>
                                            {
@@ -1128,12 +1121,11 @@
                                        functionView.Tag = device;
                                        functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        functionView.SetStatuText(device.GetDeviceStatu());
                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                        functionView.IsSelected = light.OnOffStatus == 1;
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                        if (dev == null)
                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                        {
                                            functionView.CollectButton.IsSelected = false;
                                        }
@@ -1202,39 +1194,16 @@
                                        functionView.CardBG.MouseUpEventHandler += (sender, e) =>
                                        {
                                            CommonPage.Instance.IsDrawerLockMode = true;
                                            if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关)
                                            var lightControl = new Phone.Device.Light.OnOffControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            lightControl.IsDrawerLockMode = true;
                                            lightControl.Show(device, Room.CurrentRoom);
                                            lightControl.action += (curDev, curRoom) =>
                                            {
                                                var lightControl = new Phone.Device.Light.OnOffControl();
                                                UserView.HomePage.Instance.AddChidren(lightControl);
                                                UserView.HomePage.Instance.PageIndex += 1;
                                                lightControl.Show(device, Room.CurrentRoom);
                                                lightControl.action += (curDev, curRoom) =>
                                                {
                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
                                                };
                                            }
                                            else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座)
                                            {
                                                var lightControl = new Phone.Device.Light.PlugControl();
                                                UserView.HomePage.Instance.AddChidren(lightControl);
                                                UserView.HomePage.Instance.PageIndex += 1;
                                                lightControl.Show(device, Room.CurrentRoom);
                                                lightControl.action += (curDev, curRoom) =>
                                                {
                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
                                                };
                                            }
                                            else
                                            {
                                                var lightControl = new Phone.Device.Light.LightControl();
                                                UserView.HomePage.Instance.AddChidren(lightControl);
                                                UserView.HomePage.Instance.PageIndex += 1;
                                                lightControl.Show(device, Room.CurrentRoom);
                                                lightControl.action += (curDev, curRoom) =>
                                                {
                                                    ReFreshEditDeviceAction(device, curRoom, functionView);
                                                };
                                            }
                                                ReFreshEditDeviceAction(device, curRoom, functionView);
                                            };
                                        };
                                        functionView.CollectButton.MouseUpEventHandler += collectionEvent;
@@ -1272,9 +1241,9 @@
                                        functionView.Tag = device;
                                        functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        functionView.SetStatuText(device.GetDeviceStatu());
                                        functionView.SetDeviceName(airSwitch.DeviceEpointName);
                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(airSwitch));
                                        functionView.IsSelected = airSwitch.OnOffStatus == 1;
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom( device.FileName));
                                        functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                        {
@@ -1339,6 +1308,7 @@
                                            var lightControl = new Phone.Device.Light.AirSwitchControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            lightControl.IsDrawerLockMode = true;
                                            lightControl.Show(device, Room.CurrentRoom);
                                            lightControl.action += (curDev, curRoom) =>
                                            {
@@ -1382,9 +1352,9 @@
                                        functionView.Tag = device;
                                        functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        functionView.SetStatuText(device.GetDeviceStatu());
                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                        functionView.IsSelected = ac.currentSystemMode != 0;
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                        functionView.SwitchButton.MouseUpEventHandler += (sender, e) =>
                                        {
@@ -1449,6 +1419,7 @@
                                            var lightControl = new Phone.Device.AC.ACControl();
                                            UserView.HomePage.Instance.AddChidren(lightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            lightControl.IsDrawerLockMode = true;
                                            lightControl.Show(device, Room.CurrentRoom);
                                            lightControl.action += (curDev, curRoom) =>
                                            {
@@ -1493,12 +1464,11 @@
                                        functionView.Tag = device;
                                        functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        functionView.SetStatuText(device.GetDeviceStatu());
                                        functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                        functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                        functionView.IsSelected = dimmableLight.OnOffStatus == 1;
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                        functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                        if (dev == null)
                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                        {
                                            functionView.CollectButton.IsSelected = false;
                                        }
@@ -1570,6 +1540,7 @@
                                            var dimmableLightControl = new Phone.Device.Light.DimmableLightControl();
                                            UserView.HomePage.Instance.AddChidren(dimmableLightControl);
                                            UserView.HomePage.Instance.PageIndex += 1;
                                            dimmableLightControl.IsDrawerLockMode = true;
                                            dimmableLightControl.Show(device, Room.CurrentRoom);
                                            dimmableLightControl.action += (curDev, curRoom) =>
                                            {
@@ -1590,12 +1561,11 @@
                                    lightView.Tag = device;
                                    lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                    lightView.SetStatuText(device.GetDeviceStatu());
                                    lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                    lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                    lightView.IsSelected = ias.iASInfo?.Alarm1 == 1;
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                    lightView.CanControl(false);
                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                    if (dev == null)
                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                    {
                                        lightView.CollectButton.IsSelected = false;
                                    }
@@ -1651,12 +1621,11 @@
                                        lightView.Tag = device;
                                        lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                        lightView.SetStatuText(device.GetDeviceStatu());
                                        lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                        lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                        lightView.IsSelected = false;
                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                        lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                        lightView.CanControl(false);
                                        var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                        if (dev == null)
                                        if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                        {
                                            lightView.CollectButton.IsSelected = false;
                                        }
@@ -1678,12 +1647,11 @@
                                    lightView.Tag = device;
                                    lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                    lightView.SetStatuText(device.GetDeviceStatu());
                                    lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                    lightView.IsSelected = dimmableLight.IsOnline == 1;
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                    lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                    lightView.IsSelected = false;
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                    lightView.CanControl(false);
                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                    if (dev == null)
                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                    {
                                        lightView.CollectButton.IsSelected = false;
                                    }
@@ -1710,13 +1678,11 @@
                                    lightView.Tag = device;
                                    lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                                    lightView.SetStatuText(device.GetDeviceStatu());
                                    lightView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                                    lightView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                                    lightView.CanControl(false);
                                    //lightView.IsSelected = device.CommonDevice.IsOnline == 1;
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName));
                                    lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                                    var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
                                    if (dev == null)
                                    if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                                    {
                                        lightView.CollectButton.IsSelected = false;
                                    }
@@ -1746,23 +1712,29 @@
        /// <param name="functionView"></param>
        private void ReFreshEditDeviceAction(DeviceUI device, Common.Room curRoom, FunctionMainView functionView)
        {
            if (curRoom.Id != Common.Room.CurrentRoom.Id)
            if (Common.Room.CurrentRoom.IsLove)
            {
                if (Common.Room.CurrentRoom.IsLove)
                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                if (Room.CurrentRoom.IsCollectInRoom(device.FileName) == false)
                {
                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                    functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                }
                else
                {
                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
                    ShowFunction();
                }
            }
            else
            {
                functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                functionView.SetDeviceName(device.CommonDevice.DeviceEpointName);
                if (curRoom.Id != Common.Room.CurrentRoom.Id)
                {
                    Common.Room.CurrentRoom.DeleteDevice(device.FileName);
                    ShowFunction();
                }
                else
                {
                    functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath);
                    functionView.SetDeviceName(Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice));
                    functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName));
                }
            }
        }
@@ -1837,8 +1809,9 @@
                    }
                    var sceneView = new SceneMainView(xx, yy);
                    itemView.AddChidren(sceneView);
                    sceneView.Init(scene);
                    itemView.AddChidren(sceneView);
                    sceneView.CollectionAction += ShowScene;
                }
                GetDelayScene(sceneScrolView);
            }