From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 417 ++++++++++++++++++----------------------------------------- 1 files changed, 127 insertions(+), 290 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index ba82d19..867f080 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -284,14 +284,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 j = 0; j < modeStr.Length; j++) - { - ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; - } - break; case 4097: //杩囪檻缃戞竻娲楁爣蹇�:42 ac.CleanStatu = attList.AttriButeData == 42; @@ -885,7 +877,7 @@ typeIdDic.Clear(); foreach (var device in devList) { - 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; @@ -1093,10 +1085,10 @@ } }) { IsBackground = true }.Start(); - + var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = light.OnOffStatus == 1; deviceTypeRowLayout.AddChidren(deviceRow); @@ -1134,81 +1126,14 @@ }; deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => { - if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�) + var lightControl = new Phone.Device.Light.OnOffControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.Show(deviceUI, Common.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(deviceUI, Common.Room.CurrentRoom); - lightControl.action += (curDev, curRoom) => - { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } - }; - } - else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - var lightControl = new Phone.Device.Light.PlugControl(); - UserView.HomePage.Instance.AddChidren(lightControl); - UserView.HomePage.Instance.PageIndex += 1; - lightControl.Show(deviceUI, Common.Room.CurrentRoom); - lightControl.action += (curDev, curRoom) => - { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } - }; - } - else - { - var lightControl = new Phone.Device.Light.LightControl(); - UserView.HomePage.Instance.AddChidren(lightControl); - UserView.HomePage.Instance.PageIndex += 1; - lightControl.Show(deviceUI, Common.Room.CurrentRoom); - lightControl.action += (curDev, curRoom) => - { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } - }; - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); + }; }; EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => @@ -1219,21 +1144,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1275,7 +1186,7 @@ var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.IsSelected = airSwitch.OnOffStatus == 1; deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceTypeRowLayout.AddChidren(deviceRow); @@ -1319,21 +1230,9 @@ lightControl.Show(deviceUI, Common.Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); + }; }; @@ -1345,21 +1244,8 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); + }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1401,7 +1287,7 @@ var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = dimmableLight.OnOffStatus == 1; deviceTypeRowLayout.AddChidren(deviceRow); @@ -1447,21 +1333,7 @@ dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom); dimmableLightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; @@ -1474,21 +1346,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1532,7 +1390,7 @@ var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = ac.currentSystemMode != 1; deviceTypeRowLayout.AddChidren(deviceRow); @@ -1578,21 +1436,8 @@ acControl.Show(deviceUI, Common.Room.CurrentRoom); acControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); + }; }; @@ -1604,21 +1449,8 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); + }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1661,7 +1493,7 @@ var deviceRow = new CategoryFunctionForWinRow(0, 35); deviceRow.Init(deviceUI); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage != 0; deviceRow.SetRollerShadeIcon(rollerShade.WcdType); @@ -1693,21 +1525,7 @@ rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom); rollerShadeControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; @@ -1719,21 +1537,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1751,7 +1555,7 @@ { var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.HideSwitchBtn(true); deviceTypeRowLayout.AddChidren(deviceRow); @@ -1771,21 +1575,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1802,7 +1592,7 @@ { var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = (deviceUI.CommonDevice as IASZone).iASInfo?.Alarm1 == 1; deviceRow.HideSwitchBtn(true); @@ -1816,21 +1606,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1884,7 +1660,7 @@ var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.IsSelected = false; deviceRow.HideSwitchBtn(true); @@ -1898,21 +1674,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1930,7 +1692,7 @@ { var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); deviceRow.HideSwitchBtn(true); deviceTypeRowLayout.AddChidren(deviceRow); @@ -1943,21 +1705,7 @@ detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); detailInfo.EditAction += (curDevice, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); - deviceListScrolView.RemoveViewByTag(deviceUI); - sameTypeList.Remove(deviceUI); - if (sameTypeList.Count == 0) - { - RefreshFunction(Common.Room.CurrentRoom); - } - } - else - { - deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); - } + ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); }; }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -2016,6 +1764,93 @@ { IsBackground = true }.Start(); } } + + /// <summary> + /// ReFreshDeviceAction + /// </summary> + /// <param name="curRoom"></param> + /// <param name="sameTypeList"></param> + /// <param name="devListScrolView"></param> + /// <param name="deviceRow"></param> + private void ReFreshDeviceAction(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionRow deviceRow) + { + if (Common.Room.CurrentRoom.IsLove) + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); + if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) + { + devListScrolView.RemoveViewByTag(deviceUI); + sameTypeList.Remove(deviceUI); + if (sameTypeList.Count == 0) + { + RefreshFunction(Common.Room.CurrentRoom); + } + } + } + else + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); + devListScrolView.RemoveViewByTag(deviceUI); + sameTypeList.Remove(deviceUI); + if (sameTypeList.Count == 0) + { + RefreshFunction(Common.Room.CurrentRoom); + } + } + else + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); + } + } + } + + /// <summary> + /// ReFreshDeviceAction + /// </summary> + /// <param name="curRoom"></param> + /// <param name="sameTypeList"></param> + /// <param name="devListScrolView"></param> + /// <param name="deviceRow"></param> + private void ReFreshDeviceActionForWin(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow) + { + if (Common.Room.CurrentRoom.IsLove) + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); + if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) + { + devListScrolView.RemoveViewByTag(deviceUI); + sameTypeList.Remove(deviceUI); + if (sameTypeList.Count == 0) + { + RefreshFunction(Common.Room.CurrentRoom); + } + } + } + else + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); + devListScrolView.RemoveViewByTag(deviceUI); + sameTypeList.Remove(deviceUI); + if (sameTypeList.Count == 0) + { + RefreshFunction(Common.Room.CurrentRoom); + } + } + else + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); + } + } + } + /// <summary> /// AddRoomView @@ -2363,7 +2198,8 @@ Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑 if (logiciocnBtn.Tag.ToString() == "3") { - Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text;// Language.StringByID(MyInternationalizationString.automation1); + Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text; + Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext); var addLogicPage = new Logic.AddLogicPage(); HomePage.Instance.AddChidren(addLogicPage); HomePage.Instance.PageIndex += 1; @@ -2373,6 +2209,7 @@ { Common.Logic.CurrentLogic.LogicName = logicnameBtn.Text; + Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext); Logic.TemplatePage templatePage = new Logic.TemplatePage(); Logic.TemplatePage.s = logiciocnBtn.Tag.ToString(); HomePage.Instance.AddChidren(templatePage); @@ -3027,4 +2864,4 @@ } -} \ No newline at end of file +} -- Gitblit v1.8.0