From 587c36e27131f2d028fcabc13b296a8de7470034 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 08 一月 2020 08:59:19 +0800 Subject: [PATCH] 2019.1.8 --- ZigbeeApp/Shared/Phone/Device/Category/SelectDevice.cs | 12 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 239 +++++++---------- ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionRow.cs | 4 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml | 34 - ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 27 - ZigbeeApp/Shared/Phone/Device/CommonForm/SelectDeviceWithSeekBarRow.cs | 26 + ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 330 ++++++------------------ ZigbeeApp/Shared/Common/ZigbeeColor.cs | 8 ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll | 0 ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll | 0 ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs | 51 ++- ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide | 0 ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs | 8 ZigbeeApp/Shared/Phone/Device/CommonForm/SelectSceneRow.cs | 2 ZigbeeApp/Shared/Common/Room.cs | 5 ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs | 2 ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs | 6 17 files changed, 289 insertions(+), 465 deletions(-) diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml index a78585f..686a202 100644 --- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml +++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml @@ -2,31 +2,25 @@ <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.M7BBB18B19152766" /> <MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.8c0bdb303f25d82c2a42fb8bfca449bfaca00260" /> <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" /> - <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Light/DimmableLightControl.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/UserView/UserHomeView.cs"> <Files> <File FileName="Shared/R.cs" Line="988" Column="13" /> <File FileName="GateWay.Droid/Assets/Language.ini" /> - <File FileName="Shared/Phone/UserView/UserHomeView.cs" /> + <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1020" Column="90" /> <File FileName="Shared/Phone/Device/Category/Category.cs" /> <File FileName="Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs" /> - <File FileName="Shared/Phone/Device/CommonForm/SelectZone.cs" /> - <File FileName="Shared/Phone/Device/Room/UnallocatedRoom.cs" /> - <File FileName="Shared/Phone/Device/Category/CategoryAddScene.cs" /> <File FileName="Shared/Common/Room.cs" /> - <File FileName="Shared/Common/DeviceUI.cs" /> - <File FileName="Shared/Phone/Device/CommonForm/SceneCategoryView.cs" /> - <File FileName="Shared/Phone/Device/Room/EditRoom.cs" /> - <File FileName="Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs" /> - <File FileName="Shared/Phone/UserCenter/UserMain/UserInformationForm.cs" /> - <File FileName="Shared/Phone/Device/Light/DimmableLightControl.cs" Line="530" Column="31" /> - <File FileName="Shared/Phone/Device/Curtain/RollerShadeControl.cs" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="GateWay" expanded="True"> <Node name="GateWay.Droid" expanded="True"> - <Node name="Assets" expanded="True" /> + <Node name="Assets" expanded="True"> + <Node name="Phone" expanded="True"> + <Node name="Item" expanded="True" /> + </Node> + </Node> </Node> <Node name="Home.IOS" expanded="True" /> <Node name="Shared" expanded="True"> @@ -37,18 +31,10 @@ <Node name="Category" expanded="True" /> <Node name="CommonForm" expanded="True" /> <Node name="Curtain" expanded="True" /> - <Node name="Light" expanded="True"> - <Node name="DimmableLightControl.cs" selected="True" /> - </Node> - <Node name="Room" expanded="True" /> + <Node name="Light" expanded="True" /> </Node> - <Node name="UserCenter" expanded="True"> - <Node name="Residence" expanded="True" /> - <Node name="UserMain" expanded="True" /> - </Node> - <Node name="UserView" expanded="True" /> - <Node name="ZigBee" expanded="True"> - <Node name="Device" expanded="True" /> + <Node name="UserView" expanded="True"> + <Node name="UserHomeView.cs" selected="True" /> </Node> </Node> </Node> diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide index 25b9e9f..1d6b88b 100644 --- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide +++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide Binary files differ diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index 7e74cae..58819f9 100644 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -1125,7 +1125,7 @@ /// <param name="iconPathType">I鍦烘櫙鑳屾櫙鍥剧墖鏉ユ簮绫诲瀷 鍥剧墖鏉ユ簮 0--鏈湴鍥惧簱 1--鎷嶇収 2--绯荤粺鍥惧簱 榛樿0</param> public async System.Threading.Tasks.Task<int> AddScene(string sceneName, string sceneIconPath, List<ZigBee.Device.Scene.AddSceneMemberData> commons, int iconPathType) { - var scenes = GetSceneUIsByFloorId(FloorId); + //var scenes = GetSceneUIsByFloorId(FloorId); //if(scenes!=null && scenes.Count>0) //{ // if (scenes.Find(s => s.Name == sceneName) != null) @@ -1180,11 +1180,10 @@ IconPathType = iconPathType, AddSceneMemberDataList= commons }; + sceneUI.Save(); SceneUIList.Add(sceneUI); SceneUIFilePathList.Add(sceneUI.FileName); - sceneUI.Save(); Save(); - HdlAutoBackupLogic.AddOrEditorFile(sceneUI.FileName); return 1; } return 0; diff --git a/ZigbeeApp/Shared/Common/ZigbeeColor.cs b/ZigbeeApp/Shared/Common/ZigbeeColor.cs index 794cfd8..79b9ea8 100644 --- a/ZigbeeApp/Shared/Common/ZigbeeColor.cs +++ b/ZigbeeApp/Shared/Common/ZigbeeColor.cs @@ -251,9 +251,13 @@ /// </summary> public uint GXCWaveSeekBarUnSelectedColor = 0xFFEBEBED; /// <summary> - /// GXCWaveSeekBarColor 0xFFFE4F35 + /// GXCWaveSeekBarColor_Start 0xFFFF6C2C /// </summary> - public uint GXCWaveSeekBarColor = 0xFFFE4F35; + public uint GXCWaveSeekBarColor_Start = 0xFFFF6C2C; + /// <summary> + /// GXCWaveSeekBarColor_End 0xFFFD3040 + /// </summary> + public uint GXCWaveSeekBarColor_End = 0xFFFD3040; /// <summary> /// 0xFFFDB500 /// </summary> diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll index 4f9b2cd..7f2b3f4 100644 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll index 449a4c2..381435e 100644 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll Binary files differ diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs index 598f6d8..a834293 100644 --- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs @@ -520,18 +520,27 @@ }; itemView.AddChidren(indoorTemperatureBtn); - mArcScaleSeekBar = new ArcScaleSeekBar + var mArcScaleSeekBarFL = new FrameLayout { Y = Application.GetRealHeight(412), - Width = Application.GetRealWidth(671), - Height = Application.GetRealHeight(671), + Width = Application.GetMinRealAverage(671), + Height = Application.GetMinRealAverage(671), + Gravity = Gravity.CenterHorizontal + }; + itemView.AddChidren(mArcScaleSeekBarFL); + + mArcScaleSeekBar = new ArcScaleSeekBar + { + Width = Application.GetMinRealAverage(671), + Height = Application.GetMinRealAverage(671), Gravity = Gravity.CenterHorizontal, MinValue = ACControlBase.Temperature_Low, MaxValue = ACControlBase.Temperature_High, Progress = ACControlBase.GetCurrentModeTemperature(ac), - IsClickable = ACControlBase.IsOpen(ac) + IsClickable = ACControlBase.IsOpen(ac), + ProgressBarUnitSring = string.Empty }; - itemView.AddChidren(mArcScaleSeekBar); + mArcScaleSeekBarFL.AddChidren(mArcScaleSeekBar); if(ACControlBase.IsOpen(ac)) { mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor); @@ -561,35 +570,47 @@ currentModeBtn = new Button() { - Y = Application.GetRealHeight(565), - Height = Application.GetRealHeight(80), + Y = Application.GetMinRealAverage(187), + Height = Application.GetRealHeight(50), Width = Application.GetRealWidth(200), TextColor = ZigbeeColor.Current.GXCTextBlackColor, Gravity = Gravity.CenterHorizontal, Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode), - TextSize=12 + TextSize = 12 }; - itemView.AddChidren(currentModeBtn); + mArcScaleSeekBarFL.AddChidren(currentModeBtn); reduceTemperatureBtn = new Button() { - X = Application.GetRealWidth(268), - Y = Application.GetRealHeight(650), + X = Application.GetMinRealAverage(132), + Y = Application.GetMinRealAverage(268), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Reduce.png" }; - itemView.AddChidren(reduceTemperatureBtn); + mArcScaleSeekBarFL.AddChidren(reduceTemperatureBtn); addTemperatureBtn = new Button() { - X = Application.GetRealWidth(610), - Y = Application.GetRealHeight(650), + X = Application.GetMinRealAverage(452), + Y = Application.GetMinRealAverage(268), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Add.png" }; - itemView.AddChidren(addTemperatureBtn); + mArcScaleSeekBarFL.AddChidren(addTemperatureBtn); + + var uintBtn = new Button + { + Y = Application.GetMinRealAverage(369), + Height = Application.GetRealHeight(60), + Width = Application.GetRealWidth(100), + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + Gravity = Gravity.CenterHorizontal, + Text = "鈩�", + TextSize = 18 + }; + mArcScaleSeekBarFL.AddChidren(uintBtn); FanSwingModeBtn = new Button() { diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index ba82d19..36aa8a7 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -1142,21 +1142,7 @@ 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); }; } else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇) @@ -1167,21 +1153,7 @@ 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); }; } else @@ -1192,21 +1164,7 @@ 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); }; } }; @@ -1219,21 +1177,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() @@ -1319,21 +1263,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 +1277,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() @@ -1447,21 +1366,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 +1379,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() @@ -1578,21 +1469,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 +1482,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() @@ -1693,21 +1558,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 +1570,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() @@ -1771,21 +1608,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() @@ -1816,21 +1639,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() @@ -1898,21 +1707,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() @@ -1943,21 +1738,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() @@ -2018,6 +1799,75 @@ } /// <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 (curRoom.Id != Common.Room.CurrentRoom.Id) + { + if(Common.Room.CurrentRoom.IsLove) + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + } + else + { + 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(deviceUI.CommonDevice.DeviceEpointName); + } + } + + /// <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 (curRoom.Id != Common.Room.CurrentRoom.Id) + { + if (Common.Room.CurrentRoom.IsLove) + { + deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); + deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); + } + else + { + 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(deviceUI.CommonDevice.DeviceEpointName); + } + } + + + /// <summary> /// AddRoomView /// </summary> private void AddRoomView() diff --git a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs index aef04cf..728d0ea 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/CategoryAddScene.cs @@ -1453,7 +1453,7 @@ dialog.RemoveFromParent(); }; - open.SeekBar.ProgressChanged += (sender, e) => + open.SeekBar.OnProgressChangedEvent += (sender, e) => { open.IsSelected = true; shut.IsSelected = false; @@ -1471,7 +1471,7 @@ { open.IsSelected = true; shut.IsSelected = false; - open.SetProgress(sceneTarget.TaskList[0].Data2); + open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2); } } @@ -1619,7 +1619,7 @@ dialog.RemoveFromParent(); }; - open.SeekBar.ProgressChanged += (sender, e) => + open.SeekBar.OnProgressChangedEvent += (sender, e) => { open.IsSelected = true; shut.IsSelected = false; @@ -1637,7 +1637,7 @@ { open.IsSelected = true; shut.IsSelected = false; - open.SetProgress(sceneTarget.TaskList[0].Data1); + open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1); } } diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectDevice.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectDevice.cs index 7bfc751..84f36f4 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/SelectDevice.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/SelectDevice.cs @@ -448,11 +448,13 @@ deviceListScrolView.AddChidren(deviceTypeRowLayout); var deviceRow = new FunctionRow(0, 35); - deviceTypeRowLayout.AddChidren(deviceRow); deviceRow.Init(device.IconPath, device.OnlineIconPath, true); deviceRow.SetTitle(device.CommonDevice.DeviceEpointName); deviceRow.IsSelected = true; deviceRow.HideSwitchBtn(false); + deviceRow.NameBtn.BackgroundColor = ZigbeeColor.Current.GXCRedColor; + deviceTypeRowLayout.AddChidren(deviceRow); + deviceRow.ClickBtn.MouseUpEventHandler += (sender, e) => { @@ -794,7 +796,7 @@ dialog.RemoveFromParent(); }; - open.SeekBar.ProgressChanged += (sender, e) => + open.SeekBar.OnProgressChangedEvent += (sender, e) => { open.IsSelected = true; shut.IsSelected = false; @@ -812,7 +814,7 @@ { open.IsSelected = true; shut.IsSelected = false; - open.SetProgress(sceneTarget.TaskList[0].Data2); + open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2); } } @@ -960,7 +962,7 @@ dialog.RemoveFromParent(); }; - open.SeekBar.ProgressChanged += (sender, e) => + open.SeekBar.OnProgressChangedEvent += (sender, e) => { open.IsSelected = true; shut.IsSelected = false; @@ -978,7 +980,7 @@ { open.IsSelected = true; shut.IsSelected = false; - open.SetProgress(sceneTarget.TaskList[0].Data1); + open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1); } } diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs index 16caf21..ccee116 100644 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs @@ -332,7 +332,7 @@ CommonPage.Loading.Start(); if (device.CommonDevice == null) { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain); + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); return; } if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput) diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionRow.cs index 64d5392..651140b 100644 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionRow.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/FunctionRow.cs @@ -99,14 +99,14 @@ NameBtn = new Button() { X = Application.GetRealWidth(200), - Width = Application.GetRealWidth(500), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(80), Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.GXCTextBlackColor, SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, TextAlignment = TextAlignment.CenterLeft, Tag = Tag, - TextSize=14 + TextSize = 14 }; AddChidren(NameBtn); diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs index 70aa1dd..7fe0130 100644 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs @@ -237,7 +237,7 @@ //0 绉婚櫎澶辫触 else if (removeSceneAllData.removeSceneData.Result == 0) { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain); + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); return; } //2 娌℃湁璇ュ満鏅� @@ -246,7 +246,7 @@ room.RemoveScene(scene); //RefreshBodyView(); RemoveFromParent(); - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneIsNull); + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneIsNull)); return; } }; @@ -417,7 +417,7 @@ { return; } - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ControlSceneFail); + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.ControlSceneFail)); } scene.RemainTime = scene.SceneDelayTime; diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectDeviceWithSeekBarRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectDeviceWithSeekBarRow.cs index 0d6a763..c6c8597 100644 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectDeviceWithSeekBarRow.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectDeviceWithSeekBarRow.cs @@ -27,7 +27,7 @@ /// <summary> /// SeekBar /// </summary> - public HorizontalSeekBar SeekBar; + public DiyImageSeekBar SeekBar; /// <summary> /// SeekBarTitle /// </summary> @@ -104,17 +104,20 @@ }; AddChidren(ClickButton); - SeekBar = new HorizontalSeekBar() + SeekBar = new DiyImageSeekBar() { X = Application.GetRealWidth(81), Y = Application.GetRealHeight(200), Width = Application.GetRealWidth(919), Height = Application.GetRealHeight(127), - BackgroundColor = ZigbeeColor.Current.GXCSeekBarBackground, - ProgressColor = ZigbeeColor.Current.GXCProgressColor, - ThumbColor = ZigbeeColor.Current.GXCBackgroundColor, - Max = MaxLevel, - Progress = MaxLevel + ProgressBarColor = ZigbeeColor.Current.GXCProgressColor, + MaxValue = MaxLevel, + Progress = MaxLevel, + IsProgressTextShow = false, + IsClickable = true, + ThumbImageHeight=Application.GetMinRealAverage(80), + SeekBarViewHeight=Application.GetRealHeight(6), + ThumbImagePath="Item/SeekBarIcon.png" }; AddChidren(SeekBar); @@ -126,7 +129,8 @@ Gravity = Gravity.CenterHorizontal, Text = $"{(int)(SeekBar.Progress * 1.0 / MaxLevel * 100)} %", TextColor = ZigbeeColor.Current.GXCTextGrayColor, - TextSize=12 + TextSize = 12, + IsBold = true }; AddChidren(SeekBarTitle); @@ -166,11 +170,11 @@ SelectBtn.Visible = statu; if(statu) { - SetProgress(100); + SetSeekBarProgress(SeekBar.Progress == 0 ? MaxLevel : SeekBar.Progress); } else { - SetProgress(0); + SetSeekBarProgress(0); } } @@ -195,7 +199,7 @@ /// SetProgress /// </summary> /// <param name="progress"></param> - public void SetProgress(int progress) + public void SetSeekBarProgress(int progress) { SeekBar.Progress = progress; SetSeekBarTitle(); diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectSceneRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectSceneRow.cs index 0c2f880..320d16e 100644 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectSceneRow.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectSceneRow.cs @@ -83,7 +83,7 @@ NameBtn = new Button() { X = Application.GetRealWidth(173), - Width = Application.GetRealWidth(500), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(80), Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.GXCTextBlackColor, diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs index 2a86275..5464f85 100644 --- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs @@ -139,7 +139,6 @@ { dimmableLight = deviceUI.CommonDevice as DimmableLight; dimmableLight.DeviceStatusReport = common.DeviceStatusReport; - //璁板綍銆佹洿鏂扮姸鎬� if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) { return; @@ -151,16 +150,13 @@ if (switchBtn.IsSelected == true) { levelSeekBar.IsClickable = true; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; - //levelSeekBar.Progress = 100; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); } else { levelSeekBar.IsClickable = false; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; - //levelSeekBar.Progress = 0; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); } - //change color dimmableLight.LastDateTime = DateTime.Now; } //浜害 @@ -181,7 +177,6 @@ dimmableLight.LastDateTime = DateTime.Now; levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100); StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { device.GetDeviceStatu()}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; - break; } } @@ -405,7 +400,7 @@ WavePadding = Application.GetRealWidth(8), MaxValue=100, Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), - WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor, + CornerRadius= Application.GetRealHeight(58) }; @@ -414,12 +409,12 @@ if (dimmableLight.OnOffStatus == 1) { levelSeekBar.IsClickable = true; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); } else { levelSeekBar.IsClickable = false; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); } levelSeekBar.OnStartTrackingTouchEvent += (sender, e) => @@ -433,6 +428,7 @@ { ProgressBtn.Visible = false; levelSeekBar.IsProgressTextShow = true; + dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); }; levelSeekBar.OnProgressChangedEvent += (send2, e2) => @@ -441,13 +437,10 @@ OnProgressButtonMove(e2); //鍒ゆ柇鏄惁300ms灞忚斀 - if (levelSeekBar.IsProgressChangeDelay()) return; - - dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); + //if (levelSeekBar.IsProgressChangeDelay()) return; + //dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); }; - InitProgressBtn(itemView); - InitProgressBtn(itemView); switchBtn = new Button() @@ -562,13 +555,13 @@ { dimmableLight.SwitchControl(1); levelSeekBar.IsClickable = true; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); } else { dimmableLight.SwitchControl(0); levelSeekBar.IsClickable = false; - levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; + levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); } } diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 82e94d9..4be7cd0 100644 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -1,13 +1,13 @@ 锘縰sing System; using System.Collections.Generic; +using System.Timers; using Shared.Common; using Shared.Phone.Device.AC; -using ZigBee.Device; using Shared.Phone.Device.CommonForm; -using Shared.Phone.UserCenter.DoorLock; -using System.Timers; using Shared.Phone.Device.DeviceLogic; using Shared.Phone.UserCenter; +using Shared.Phone.UserCenter.DoorLock; +using ZigBee.Device; namespace Shared.Phone.UserView { @@ -1012,17 +1012,17 @@ }) { IsBackground = true }.Start(); - var lightView = new FunctionMainView(xx, yy); - lightView.Tag = device; - itemView.AddChidren(lightView); - lightView.Init(); - lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); - lightView.SetStatuText(device.GetDeviceStatu()); - lightView.SetDeviceName(rollerShade.DeviceEpointName); - lightView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100; - lightView.SetCollect(true); + var functionView = new FunctionMainView(xx, yy); + functionView.Tag = device; + itemView.AddChidren(functionView); + functionView.Init(); + functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + functionView.SetStatuText(device.GetDeviceStatu()); + functionView.SetDeviceName(rollerShade.DeviceEpointName); + functionView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100; + functionView.SetCollect(true); - lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + functionView.SwitchButton.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; if ((sender as Button).IsSelected) @@ -1079,7 +1079,7 @@ } }; - lightView.CardBG.MouseUpEventHandler += (sender, e) => + functionView.CardBG.MouseUpEventHandler += (sender, e) => { CommonPage.Instance.IsDrawerLockMode = true; var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl(); @@ -1089,20 +1089,11 @@ rollerShadeControl.Show(device, Room.CurrentRoom); rollerShadeControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; }; - lightView.CollectButton.MouseUpEventHandler += collectionEvent; + functionView.CollectButton.MouseUpEventHandler += collectionEvent; } } else if (device.CommonDevice.Type == DeviceType.OnOffOutput) @@ -1131,27 +1122,27 @@ }) { IsBackground = true }.Start(); - var lightView = new FunctionMainView(xx, yy); - itemView.AddChidren(lightView); - lightView.Init(); - lightView.Tag = device; - lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); - lightView.SetStatuText(device.GetDeviceStatu()); - lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); - lightView.IsSelected = light.OnOffStatus == 1; - lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); + var functionView = new FunctionMainView(xx, yy); + itemView.AddChidren(functionView); + functionView.Init(); + functionView.Tag = device; + functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + functionView.SetStatuText(device.GetDeviceStatu()); + functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); + functionView.IsSelected = light.OnOffStatus == 1; + functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); if (dev == null) { - lightView.CollectButton.IsSelected = false; + functionView.CollectButton.IsSelected = false; } else { - lightView.CollectButton.IsSelected = true; + functionView.CollectButton.IsSelected = true; } - lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + functionView.SwitchButton.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; if ((sender as Button).IsSelected) @@ -1208,7 +1199,7 @@ } }; - lightView.CardBG.MouseUpEventHandler += (sender, e) => + functionView.CardBG.MouseUpEventHandler += (sender, e) => { CommonPage.Instance.IsDrawerLockMode = true; if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�) @@ -1219,16 +1210,7 @@ lightControl.Show(device, Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; } else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇) @@ -1239,16 +1221,7 @@ lightControl.Show(device, Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; } else @@ -1259,21 +1232,12 @@ lightControl.Show(device, Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; } }; - lightView.CollectButton.MouseUpEventHandler += collectionEvent; + functionView.CollectButton.MouseUpEventHandler += collectionEvent; } } else if (device.CommonDevice.Type == DeviceType.AirSwitch) @@ -1302,17 +1266,17 @@ }) { IsBackground = true }.Start(); - var lightView = new FunctionMainView(xx, yy); - itemView.AddChidren(lightView); - lightView.Init(); - lightView.Tag = device; - lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); - lightView.SetStatuText(device.GetDeviceStatu()); - lightView.SetDeviceName(airSwitch.DeviceEpointName); - lightView.IsSelected = airSwitch.OnOffStatus == 1; - lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); + var functionView = new FunctionMainView(xx, yy); + itemView.AddChidren(functionView); + functionView.Init(); + functionView.Tag = device; + functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + functionView.SetStatuText(device.GetDeviceStatu()); + functionView.SetDeviceName(airSwitch.DeviceEpointName); + functionView.IsSelected = airSwitch.OnOffStatus == 1; + functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); - lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + functionView.SwitchButton.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; if ((sender as Button).IsSelected) @@ -1369,7 +1333,7 @@ } }; - lightView.CardBG.MouseUpEventHandler += (sender, e) => + functionView.CardBG.MouseUpEventHandler += (sender, e) => { CommonPage.Instance.IsDrawerLockMode = true; var lightControl = new Phone.Device.Light.AirSwitchControl(); @@ -1378,21 +1342,12 @@ lightControl.Show(device, Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; }; - lightView.CollectButton.MouseUpEventHandler += collectionEvent; + functionView.CollectButton.MouseUpEventHandler += collectionEvent; } } else if (device.CommonDevice.Type == DeviceType.Thermostat) @@ -1421,17 +1376,17 @@ }) { IsBackground = true }.Start(); - var lightView = new FunctionMainView(xx, yy); - itemView.AddChidren(lightView); - lightView.Init(); - lightView.Tag = device; - lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); - lightView.SetStatuText(device.GetDeviceStatu()); - lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); - lightView.IsSelected = ac.currentSystemMode != 0; - lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); + var functionView = new FunctionMainView(xx, yy); + itemView.AddChidren(functionView); + functionView.Init(); + functionView.Tag = device; + functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + functionView.SetStatuText(device.GetDeviceStatu()); + functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); + functionView.IsSelected = ac.currentSystemMode != 0; + functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); - lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + functionView.SwitchButton.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; if ((sender as Button).IsSelected) @@ -1488,7 +1443,7 @@ } }; - lightView.CardBG.MouseUpEventHandler += (sender, e) => + functionView.CardBG.MouseUpEventHandler += (sender, e) => { CommonPage.Instance.IsDrawerLockMode = true; var lightControl = new Phone.Device.AC.ACControl(); @@ -1497,20 +1452,11 @@ lightControl.Show(device, Room.CurrentRoom); lightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; }; - lightView.CollectButton.MouseUpEventHandler += collectionEvent; + functionView.CollectButton.MouseUpEventHandler += collectionEvent; } } else if (device.CommonDevice.Type == DeviceType.DimmableLight) @@ -1541,27 +1487,27 @@ }) { IsBackground = true }.Start(); - var lightView = new FunctionMainView(xx, yy); - itemView.AddChidren(lightView); - lightView.Init(); - lightView.Tag = device; - lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); - lightView.SetStatuText(device.GetDeviceStatu()); - lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); - lightView.IsSelected = dimmableLight.OnOffStatus == 1; - lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); + var functionView = new FunctionMainView(xx, yy); + itemView.AddChidren(functionView); + functionView.Init(); + functionView.Tag = device; + functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); + functionView.SetStatuText(device.GetDeviceStatu()); + functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); + functionView.IsSelected = dimmableLight.OnOffStatus == 1; + functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); if (dev == null) { - lightView.CollectButton.IsSelected = false; + functionView.CollectButton.IsSelected = false; } else { - lightView.CollectButton.IsSelected = true; + functionView.CollectButton.IsSelected = true; } - lightView.SwitchButton.MouseUpEventHandler += (sender, e) => + functionView.SwitchButton.MouseUpEventHandler += (sender, e) => { (sender as Button).IsSelected = !(sender as Button).IsSelected; if ((sender as Button).IsSelected) @@ -1618,7 +1564,7 @@ } }; - lightView.CardBG.MouseUpEventHandler += (sender, e) => + functionView.CardBG.MouseUpEventHandler += (sender, e) => { CommonPage.Instance.IsDrawerLockMode = true; var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); @@ -1627,19 +1573,10 @@ dimmableLightControl.Show(device, Room.CurrentRoom); dimmableLightControl.action += (curDev, curRoom) => { - if (curRoom.Id != Common.Room.CurrentRoom.Id) - { - Common.Room.CurrentRoom.DeleteDevice(device.FileName); - ShowFunction(); - } - else - { - lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); - lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); - } + ReFreshEditDeviceAction(device, curRoom, functionView); }; }; - lightView.CollectButton.MouseUpEventHandler += collectionEvent; + functionView.CollectButton.MouseUpEventHandler += collectionEvent; } } else if (device.CommonDevice.Type == DeviceType.IASZone) @@ -1801,6 +1738,34 @@ } } + /// <summary> + /// ReFreshEditDeviceAction + /// </summary> + /// <param name="device"></param> + /// <param name="curRoom"></param> + /// <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) + { + 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); + } + } + #endregion #region 鈼� 鍦烘櫙_____________________________ -- Gitblit v1.8.0