From b78a4d0ca90416d37fcbaf5e54b00f7eaab53919 Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期一, 14 十月 2019 17:03:58 +0800 Subject: [PATCH] 2019-10-14-2 --- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 2 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml | 27 ++- ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml | 4 ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs | 57 +++++++-- ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 2 /dev/null | 0 ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs | 64 ++++++++-- ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 7 + ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs | 56 +++++++-- ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide | 0 .DS_Store | 0 ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs | 61 +++++++-- ZigbeeApp/Shared/Common/House.cs | 28 ++- ZigbeeApp/Shared/Common/Room.cs | 15 -- ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs | 2 16 files changed, 227 insertions(+), 100 deletions(-) diff --git a/.DS_Store b/.DS_Store index 7944d79..61390a7 100644 --- a/.DS_Store +++ b/.DS_Store Binary files differ diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml index 3f03eb1..04e7370 100644 --- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml +++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml @@ -1,11 +1,17 @@ -锘�<Properties StartupConfiguration="{28EDE1FF-20EF-476B-8AF8-24A3EEB69F45}|Default"> - <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.822QECU5228FU" /> +锘�<Properties StartupConfiguration="{7D463846-A275-4A2E-930F-B5EA7200CEAA}|Default"> + <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.28D65668-1785-4D5D-8282-1EAD504036BE" /> <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" /> - <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/AddLogicPage.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/TemplateDeviceCondition.cs"> <Files> - <File FileName="Shared/Phone/Device/Logic/AddLogicPage.cs" Line="977" Column="47" /> - <File FileName="GateWay.Droid/Properties/AndroidManifest.xml" Line="168" Column="105" /> + <File FileName="Shared/Phone/Device/Logic/AddLogicPage.cs" Line="375" Column="36" /> + <File FileName="Shared/Phone/Device/Logic/DeviceStateCondition.cs" Line="326" Column="62" /> + <File FileName="Shared/Phone/Device/Category/Category.cs" Line="680" Column="1" /> + <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="688" Column="41" /> + <File FileName="Shared/Phone/Device/Logic/LogicDevicePage.cs" Line="327" Column="44" /> + <File FileName="Shared/Phone/Device/Logic/TemplateDeviceAction.cs" Line="328" Column="26" /> + <File FileName="Shared/Common/Room.cs" Line="676" Column="1" /> + <File FileName="Shared/Phone/Device/Logic/TemplateDeviceCondition.cs" Line="20" Column="48" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -19,18 +25,19 @@ </Node> <Node name="GateWay.Ios" expanded="True" /> <Node name="Shared" expanded="True"> + <Node name="Common" expanded="True" /> <Node name="Phone" expanded="True"> <Node name="Device" expanded="True"> + <Node name="Category" expanded="True" /> <Node name="Logic" expanded="True"> - <Node name="AddLogicPage.cs" selected="True" /> + <Node name="TemplateDeviceCondition.cs" selected="True" /> </Node> + <Node name="Room" expanded="True" /> </Node> <Node name="UserCenter" expanded="True"> - <Node name="CommonBase" expanded="True" /> - </Node> - <Node name="ZigBee" expanded="True"> <Node name="Device" expanded="True" /> </Node> + <Node name="UserView" expanded="True" /> </Node> </Node> </Node> @@ -39,7 +46,7 @@ </Pads> </MonoDevelop.Ide.Workbench> <MonoDevelop.Ide.DebuggingService.PinnedWatches /> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhoneSimulator" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide index 2ef3d48..d66ba56 100644 --- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide +++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide Binary files differ diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-shm b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-shm deleted file mode 100644 index 5eaff02..0000000 --- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-shm +++ /dev/null Binary files differ diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-wal b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-wal deleted file mode 100644 index 410001b..0000000 --- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide-wal +++ /dev/null Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml index 4893bc7..3161b5d 100644 --- a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml +++ b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml @@ -164,7 +164,7 @@ <meta-data android:name="JPUSH_APPKEY" android:value="f4a3322fbc45e58d04c85191" /> <!-- </>鍊兼潵鑷紑鍙戣�呭钩鍙板彇寰楃殑AppKey--> <!-- 鏋佸厜鎺ㄩ�佺粨鏉� --> - <!-- 璁剧疆楂樺痉鍦板浘key --> - <meta-data android:name="com.amap.api.v2.apikey" android:value="8be10ffb3e302c9a42dfa58110c5c6fb" /> + <!-- 璁剧疆楂樺痉鍦板浘key --> + <meta-data android:name="com.amap.api.v2.apikey" android:value="8be10ffb3e302c9a42dfa58110c5c6fb" /> </application> </manifest> \ No newline at end of file diff --git a/ZigbeeApp/Shared/Common/House.cs b/ZigbeeApp/Shared/Common/House.cs old mode 100755 new mode 100644 index 1d6815e..a634591 --- a/ZigbeeApp/Shared/Common/House.cs +++ b/ZigbeeApp/Shared/Common/House.cs @@ -402,29 +402,35 @@ /// GetCurrentFloorName /// </summary> /// <returns></returns> - public string GetCurrentFloorName() + public string GetCurrentFloorName { - return GetFloorName(CurrentFloorId); + get + { + return GetFloorNameById(CurrentFloorId); + } } /// <summary> - /// GetFloorName + /// 鑾峰彇妤煎眰鍚嶇О /// </summary> /// <param name="floorId"></param> /// <returns></returns> - public string GetFloorName(string floorId) + public string GetFloorNameById(string floorId) { - if (string.IsNullOrEmpty(floorId)) + if (Config.Instance.Home.FloorDics.Count == 0) { return null; } - if (Config.Instance.Home.FloorDics.Count == 0 || Config.Instance.Home.FloorDics.ContainsKey(floorId) == false) - { - return null; - } - return Config.Instance.Home.FloorDics[floorId]; - } + foreach (var floor in Config.Instance.Home.FloorDics) + { + if (floorId == floor.Key) + { + return floor.Value; + } + } + return null; + } #endregion diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs old mode 100755 new mode 100644 index 282f05b..69d46f4 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -383,20 +383,7 @@ beforeRoom.DeviceUIList.Clear(); foreach (var deviceFilePath in beforeRoom.DeviceUIFilePathList) { - var jsonInfo = Encoding.UTF8.GetString(Global.ReadFileByHomeId(deviceFilePath)); - var tempDeviceUI = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceUI>(jsonInfo); - if (tempDeviceUI != null) - { - var delCommon = tempDeviceUIList.Find((obj) => obj.CommonDevice != null && tempDeviceUI.CommonDevice != null && obj.CommonDevice.Type == tempDeviceUI.CommonDevice.Type && obj.CommonDevice.CommonDeviceAddrEpoint == tempDeviceUI.CommonDevice.CommonDeviceAddrEpoint); - if (delCommon != null) - { - beforeRoom.DeviceUIList.Add(delCommon); - } - else - { - beforeRoom.AddDevice(deviceFilePath); - } - } + beforeRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(deviceFilePath)); } //鍦烘櫙(SceneUI) beforeRoom.SceneUIList.Clear(); diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index 7f6e7af..8fb7f65 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -657,7 +657,7 @@ if (Config.Instance.Home.FloorDics.Count > 0) { - floorBtn.Text = Config.Instance.Home.GetCurrentFloorName(); + floorBtn.Text = Config.Instance.Home.GetCurrentFloorName; functionSceneAutoBG.AddChidren(floorBtn); functionSceneAutoBG.AddChidren(selectFloorBtn); } diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs old mode 100755 new mode 100644 index 53cd5e5..2c1541c --- a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs @@ -105,7 +105,7 @@ { ((sender as Button).Parent as CommonForm.LeftIconButtonRow).IsSelected = true; Config.Instance.Home.CurrentFloorId = (sender as Button).Tag.ToString(); - FloorAction?.Invoke(Config.Instance.Home.GetCurrentFloorName()); + FloorAction?.Invoke(Config.Instance.Home.GetCurrentFloorName); RemoveFromParent(); } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs index b61b296..72ab9f6 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs @@ -88,7 +88,8 @@ Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.customroom, + //TextID = MyInternationalizationString.customroom, + Text = Config.Instance.Home.GetCurrentFloorName, }; topRowLayout.AddChidren(foolrname); var dropdown = new Button @@ -102,6 +103,7 @@ UnSelectedImagePath = "ZigeeLogic/drop-down.png", }; topRowLayout.AddChidren(dropdown); + #endregion ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 @@ -158,7 +160,7 @@ }; ///妤煎眰鐐瑰嚮浜嬩欢 - foolrname.MouseUpEventHandler += (sender, e) => + EventHandler<MouseEventArgs> foorlclick = (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -178,10 +180,9 @@ Radius = (uint)Application.GetRealHeight(30), }; flMain.AddChidren(foolrbj); - ///榛樿璋冭瘯 - List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" }; - foreach (var foolr in foolrlist) + foreach (var foolr in Config.Instance.Home.FloorDics) { + var foolrRowLayout = new FrameLayout { Height = Application.GetRealHeight(150), @@ -192,32 +193,55 @@ { Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(160), - Text = foolr, + Text = foolr.Value, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTextBlackColor, //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, }; foolrRowLayout.AddChidren(btnfoolrname); - EventHandler<MouseEventArgs> foolrclick = (sender13, e13) => + EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => { roomhorizontalScrol.RemoveAll(); foolrname.Text = btnfoolrname.Text; flMain.RemoveFromParent(); - ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); }; - foolrRowLayout.MouseUpEventHandler += foolrclick; - btnfoolrname.MouseUpEventHandler += foolrclick; + foolrRowLayout.MouseUpEventHandler += foolrnameclick; + btnfoolrname.MouseUpEventHandler += foolrnameclick; } }; + foolrname.MouseUpEventHandler += foorlclick; + dropdown.MouseUpEventHandler += foorlclick; ///绗竴娆¤繘鏉� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + var roomlists = new List<Common.Room>(); + roomlists.Clear(); + if (Config.Instance.Home.FloorDics.Count < 1) + { + foolrname.Visible = false; + dropdown.Visible = false; + if (Config.Instance.Home.FloorDics.Count == 0) + { + roomlists.AddRange(Common.Room.Lists); + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + } + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + + } + + AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); } /// <summary> /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 @@ -272,6 +296,9 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice==null) { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; @@ -298,6 +325,9 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice==null) { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs index 67c2a14..710c0fd 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs @@ -87,7 +87,8 @@ Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.customroom, + //TextID = MyInternationalizationString.customroom, + Text = Config.Instance.Home.GetCurrentFloorName, }; topRowLayout.AddChidren(foolrname); var dropdown = new Button @@ -162,7 +163,7 @@ ///妤煎眰鐐瑰嚮浜嬩欢 - foolrname.MouseUpEventHandler += (sender, e) => + EventHandler<MouseEventArgs> foorlclick = (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -173,6 +174,7 @@ }; var foolrbj = new VerticalScrolViewLayout { + Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(600), X = Application.GetRealWidth(1080 - 400 - 60), @@ -181,11 +183,9 @@ Radius = (uint)Application.GetRealHeight(30), }; flMain.AddChidren(foolrbj); - ///榛樿璋冭瘯 - List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" }; - - foreach (var foolr in foolrlist) + foreach (var foolr in Config.Instance.Home.FloorDics) { + var foolrRowLayout = new FrameLayout { Height = Application.GetRealHeight(150), @@ -196,34 +196,58 @@ { Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(160), - Text = foolr, + Text = foolr.Value, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTextBlackColor, //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, }; foolrRowLayout.AddChidren(btnfoolrname); - EventHandler<MouseEventArgs> foolrclick = (sender13, e13) => + EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => { roomhorizontalScrol.RemoveAll(); foolrname.Text = btnfoolrname.Text; flMain.RemoveFromParent(); - ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); }; - foolrRowLayout.MouseUpEventHandler += foolrclick; - btnfoolrname.MouseUpEventHandler += foolrclick; + foolrRowLayout.MouseUpEventHandler += foolrnameclick; + btnfoolrname.MouseUpEventHandler += foolrnameclick; } - - }; + foolrname.MouseUpEventHandler += foorlclick; + dropdown.MouseUpEventHandler += foorlclick; ///绗竴娆¤繘鏉� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + var roomlists = new List<Common.Room>(); + roomlists.Clear(); + if (Config.Instance.Home.FloorDics.Count < 1) + { + foolrname.Visible = false; + dropdown.Visible = false; + if (Config.Instance.Home.FloorDics.Count == 0) + { + roomlists.AddRange(Common.Room.Lists); + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + } + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + + } + + + AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + + } /// <summary> /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 @@ -275,6 +299,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; @@ -298,6 +326,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs index 8e28b4d..1915625 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs @@ -454,7 +454,7 @@ switch (Type) { case 1: { - /// + /// } break; case 7: { @@ -685,6 +685,11 @@ btnregionname.Text = room.GetRoomNameByDevice(device); } + public static List<Common.Room> GetRoomList(string floorId) + { + return Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); + + } #region ----鑾峰彇闂ㄩ攣 public static List<DoorLock> ReadDoorLockIfon(string doorlockMac) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs index 2e96ac6..663d15a 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs @@ -86,7 +86,8 @@ Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.customroom, + //TextID = MyInternationalizationString.customroom, + Text = Config.Instance.Home.GetCurrentFloorName, }; topRowLayout.AddChidren(foolrname); var dropdown = new Button @@ -161,7 +162,7 @@ ///妤煎眰鐐瑰嚮浜嬩欢 - foolrname.MouseUpEventHandler += (sender, e) => + EventHandler<MouseEventArgs> foorlclick = (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -172,6 +173,7 @@ }; var foolrbj = new VerticalScrolViewLayout { + Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(600), X = Application.GetRealWidth(1080 - 400 - 60), @@ -180,11 +182,9 @@ Radius = (uint)Application.GetRealHeight(30), }; flMain.AddChidren(foolrbj); - ///榛樿璋冭瘯 - List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" }; - - foreach (var foolr in foolrlist) + foreach (var foolr in Config.Instance.Home.FloorDics) { + var foolrRowLayout = new FrameLayout { Height = Application.GetRealHeight(150), @@ -195,34 +195,55 @@ { Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(160), - Text = foolr, + Text = foolr.Value, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTextBlackColor, //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, }; foolrRowLayout.AddChidren(btnfoolrname); - EventHandler<MouseEventArgs> foolrclick = (sender13, e13) => + EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => { roomhorizontalScrol.RemoveAll(); foolrname.Text = btnfoolrname.Text; flMain.RemoveFromParent(); - ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); }; - foolrRowLayout.MouseUpEventHandler += foolrclick; - btnfoolrname.MouseUpEventHandler += foolrclick; + foolrRowLayout.MouseUpEventHandler += foolrnameclick; + btnfoolrname.MouseUpEventHandler += foolrnameclick; } - - }; + foolrname.MouseUpEventHandler += foorlclick; + dropdown.MouseUpEventHandler += foorlclick; + ///绗竴娆¤繘鏉� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + var roomlists = new List<Common.Room>(); + roomlists.Clear(); + if (Config.Instance.Home.FloorDics.Count < 1) + { + foolrname.Visible = false; + dropdown.Visible = false; + if (Config.Instance.Home.FloorDics.Count == 0) + { + roomlists.AddRange(Common.Room.Lists); + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + } + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + + } + AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); } /// <summary> /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 @@ -274,6 +295,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; @@ -297,6 +322,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs index 06624b8..c23bbf5 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs @@ -87,7 +87,8 @@ Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.customroom, + // TextID = MyInternationalizationString.customroom, + Text = Config.Instance.Home.GetCurrentFloorName, }; topRowLayout.AddChidren(foolrname); var dropdown = new Button @@ -157,7 +158,7 @@ }; ///妤煎眰鐐瑰嚮浜嬩欢 - foolrname.MouseUpEventHandler += (sender, e) => + EventHandler<MouseEventArgs> foorlclick=(sender,e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -178,8 +179,7 @@ }; flMain.AddChidren(foolrbj); ///榛樿璋冭瘯 - List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" }; - foreach (var foolr in foolrlist) + foreach (var foolr in Config.Instance.Home.FloorDics) { var foolrRowLayout = new FrameLayout { @@ -191,32 +191,55 @@ { Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(160), - Text = foolr, + Text = foolr.Value, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, }; foolrRowLayout.AddChidren(btnfoolrname); - EventHandler<MouseEventArgs> foolrclick = (sender13, e13) => + EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => { roomhorizontalScrol.RemoveAll(); foolrname.Text = btnfoolrname.Text; flMain.RemoveFromParent(); - ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); }; - foolrRowLayout.MouseUpEventHandler += foolrclick; - btnfoolrname.MouseUpEventHandler += foolrclick; + foolrRowLayout.MouseUpEventHandler += foolrnameclick; + btnfoolrname.MouseUpEventHandler += foolrnameclick; } }; - ///绗竴娆¤繘鏉� - AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + foolrname.MouseUpEventHandler += foorlclick; + dropdown.MouseUpEventHandler += foorlclick; + + var roomlists = new List<Common.Room>(); + roomlists.Clear(); + if (Config.Instance.Home.FloorDics.Count < 1) + { + foolrname.Visible = false; + dropdown.Visible = false; + if (Config.Instance.Home.FloorDics.Count == 0) + { + roomlists.AddRange(Common.Room.Lists); + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + } + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + + } + + AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); } /// <summary> /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 @@ -271,6 +294,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; @@ -297,6 +324,10 @@ var list = new List<DeviceUI>(); foreach (var device in room.DeviceUIList) { + if (device.CommonDevice == null) + { + continue; + } if (!deviceTypeList.Contains(device.CommonDevice.Type)) { continue; diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs old mode 100755 new mode 100644 index 0cbb7ae..3680c36 --- a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs @@ -76,7 +76,7 @@ UnSelectedImagePath = "Item/Drop_Down.png" }; - floorBtn.Text = Config.Instance.Home.GetCurrentFloorName(); + floorBtn.Text = Config.Instance.Home.GetCurrentFloorName; top.topView.AddChidren(floorBtn); top.topView.AddChidren(selectFloorBtn); selectFloorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler; diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs old mode 100755 new mode 100644 index 8c5ef3f..93e67a8 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -460,7 +460,7 @@ Gravity = Gravity.CenterVertical, TextAlignment =TextAlignment.CenterLeft, TextColor=ZigbeeColor.Current.GXCTextColor, - Text=Config.Instance.Home.GetCurrentFloorName() + Text=Config.Instance.Home.GetCurrentFloorName }; topFrameLayout.AddChidren(floorBtn); -- Gitblit v1.8.0