From 1f5636d69332170ea3a41c76c9519f6ff6f0a8d9 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 28 十月 2019 15:40:30 +0800 Subject: [PATCH] 合并了代码 --- /dev/null | 743 ----------------------------------------- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 2 ZigbeeApp/Shared/Phone/Device/CommonForm/CategoryFunctionRow.cs | 202 +++++++++++ ZigbeeApp/Shared/Common/DeviceUI.cs | 2 ZigbeeApp/Shared/Common/Room.cs | 8 ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 69 ++- ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 1 ZigbeeApp/Shared/Shared.projitems | 1 8 files changed, 260 insertions(+), 768 deletions(-) diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs index 043cc69..01b042b 100755 --- a/ZigbeeApp/Shared/Common/DeviceUI.cs +++ b/ZigbeeApp/Shared/Common/DeviceUI.cs @@ -313,7 +313,7 @@ #endregion - #region 鈼� 閫氳繃id鑾峰彇鍦烘櫙鍖哄煙_____________ + #region 鈼� 閫氳繃id鑾峰彇璁惧鍖哄煙_____________ /// <summary> /// GetZone diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index 50956db..c7a830e 100755 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -216,8 +216,9 @@ get { List<DeviceUI> deviceList = new List<DeviceUI>(); - foreach (var room in Lists) - { + for (int i = 0; i < Lists.Count; i++) + { + var room = Lists[i]; if (room.IsSharedRoom) { continue; @@ -226,8 +227,9 @@ { continue; } - foreach (var device in room.DeviceUIList) + for (int j = 0; j < room.DeviceUIList.Count; j++) { + var device = room.DeviceUIList[j]; if (device == null || device.CommonDevice == null) { continue; diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index 9ed8a71..3aed5d9 100755 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -585,7 +585,7 @@ var midFL = new FrameLayout { Y = topView.Bottom, - Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.TabbarHeight) - topView.Bottom, + Height = Application.GetRealHeight(1549), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; AddChidren(midFL); @@ -596,18 +596,17 @@ BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; midFL.AddChidren(functionSceneAutoBG); - //鍔熻兘 - functionBtn = new ButtonLineForm(CommonFormResouce.X_Left, 34, 150, 68); - functionSceneAutoBG.AddChidren(functionBtn); - functionBtn.Init(); - functionBtn.SetTitle(R.MyInternationalizationString.Function); //鍦烘櫙 - sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 34, 150, 68); + sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left, 34, 150, 68); functionSceneAutoBG.AddChidren(sceneBtn); sceneBtn.Init(); sceneBtn.SetTitle(R.MyInternationalizationString.Scence); - + //鍔熻兘 + functionBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 34, 150, 68); + functionSceneAutoBG.AddChidren(functionBtn); + functionBtn.Init(); + functionBtn.SetTitle(R.MyInternationalizationString.Function); //鑷姩鍖� automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20, 34, 150, 68); automationBtn.Init(); @@ -895,11 +894,10 @@ deviceListScrolView = new VerticalScrolViewLayout { X = Application.GetRealWidth(CommonFormResouce.X_Left), - Y = functionTypeScrowView.Bottom + Application.GetRealHeight(50), + Y = Application.GetRealHeight(35+275), Width = Application.GetRealWidth(1028), - Height = functionSceneBodyView.Height - Application.GetRealHeight(279 + 50) - 1, + Height = Application.GetRealHeight(938) - 1, BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor - }; functionSceneBodyView.AddChidren(deviceListScrolView); tempFunctionTypeBtn = new FunctionButton(); @@ -987,18 +985,18 @@ var deviceTypeRowLayout = new RowLayout() { - Height = Application.GetRealHeight(127 + 35), + Height = Application.GetRealHeight(129 + 35), LineColor = ZigbeeColor.Current.GXCBackgroundColor, Tag = deviceUI }; deviceListScrolView.AddChidren(deviceTypeRowLayout); - var deviceRow = new FunctionRow(0, 35); + var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); deviceRow.SetStatu(light.IsOnline == 1); + deviceRow.SetZoneText(deviceUI.GetZone()); deviceTypeRowLayout.AddChidren(deviceRow); - deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) => { @@ -1007,6 +1005,7 @@ zbGateway.ReportAction += UpdateDeviceControllStatu; AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice); (send2 as Button).IsSelected = !(send2 as Button).IsSelected; + deviceRow.IsSelected = (send2 as Button).IsSelected; if ((send2 as Button).IsSelected) { light.SwitchControl(1); @@ -1030,6 +1029,15 @@ }); }; + deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => + { + var lightControl = new Phone.Device.Light.LightControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.action = RefreshBodyView; + lightControl.Show(deviceUI, room); + }; + var editBtn = new CommonForm.RowLayoutEditButton() { Tag = deviceUI, @@ -1080,10 +1088,11 @@ }; deviceListScrolView.AddChidren(deviceTypeRowLayout); - var deviceRow = new FunctionRow(0, 35); + var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); deviceRow.SetStatu(airSwitch.IsOnline == 1); + deviceRow.SetZoneText(deviceUI.GetZone()); deviceTypeRowLayout.AddChidren(deviceRow); deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) => @@ -1115,6 +1124,15 @@ DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); } }); + }; + + deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => + { + var lightControl = new Phone.Device.Light.LightControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.action = RefreshBodyView; + lightControl.Show(deviceUI, room); }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1163,16 +1181,17 @@ var deviceTypeRowLayout = new RowLayout() { - Height = Application.GetRealHeight(127 + 35), + Height = Application.GetRealHeight(129 + 35), LineColor = ZigbeeColor.Current.GXCBackgroundColor, Tag = deviceUI }; deviceListScrolView.AddChidren(deviceTypeRowLayout); - var deviceRow = new FunctionRow(0, 35); + var deviceRow = new CategoryFunctionRow(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); deviceRow.SetStatu(dimmableLight.IsOnline == 1); + deviceRow.SetZoneText(deviceUI.GetZone()); deviceTypeRowLayout.AddChidren(deviceRow); deviceRow.SwitchBtn.MouseUpEventHandler += (send2, e2) => @@ -1204,6 +1223,16 @@ DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); } }); + }; + + deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => + { + var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); + UserView.HomePage.Instance.AddChidren(dimmableLightControl); + UserView.HomePage.Instance.PageIndex += 1; + UserView.HomePage.Instance.ScrollEnabled = false; + dimmableLightControl.action = RefreshBodyView; + dimmableLightControl.Show(deviceUI, room); }; var editBtn = new CommonForm.RowLayoutEditButton() @@ -1452,7 +1481,7 @@ var roomFL = new HorizontalScrolViewLayout() { X = Application.GetRealWidth(CommonFormResouce.X_Left), - Height = Application.GetRealHeight(167), + Height = Application.GetRealHeight(170), Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonFormResouce.X_Left), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; @@ -1462,7 +1491,7 @@ functionSceneBodyView = new FrameLayout() { Y = roomFL.Bottom, - Height = Application.GetRealHeight(1316), + Height = Application.GetRealHeight(973+279), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; functionSceneAutoBodyView.AddChidren(functionSceneBodyView); @@ -1556,7 +1585,7 @@ { var sceneScrolView = new VerticalScrolViewLayout { - Y = Application.GetRealHeight(58) + //Y = Application.GetRealHeight(58) }; functionSceneBodyView.AddChidren(sceneScrolView); foreach (var scene in sceneList) diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/CategoryFunctionRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/CategoryFunctionRow.cs new file mode 100755 index 0000000..efb483a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/CategoryFunctionRow.cs @@ -0,0 +1,202 @@ +锘縰sing System; +using Shared.Common; +namespace Shared.Phone.Device.CommonForm +{ + public class CategoryFunctionRow : FrameLayout + { + /// <summary> + /// name + /// </summary> + public Button NameBtn; + /// <summary> + /// Image + /// </summary> + public Button ImageBtn; + /// <summary> + /// ImageBG + /// </summary> + public Button ImageBG; + /// <summary> + /// SwitchBtn + /// </summary> + public Button SwitchBtn; + /// <summary> + /// ZoneBtn + /// </summary> + private Button ZoneBtn; + /// <summary> + /// ClickBtn + /// </summary> + public Button ClickBtn; + /// <summary> + /// v_Selected + /// </summary> + private bool v_Selected; + /// <summary> + /// IsSelected + /// </summary> + public bool IsSelected + { + set + { + v_Selected = value; + try + { + SetStatu(v_Selected); + } + catch + { + + } + } + get + { + return v_Selected; + } + } + + /// <summary> + /// FunctionRow + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + public CategoryFunctionRow(int x = 0, int y = 0) + { + X = Application.GetRealWidth(x); + Y = Application.GetRealHeight(y); + Width = Application.GetRealWidth(1022); + Height = Application.GetRealHeight(127); + BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; + } + + /// <summary> + /// Init + /// </summary> + /// <param name="imagePath"></param> + /// <param name="selectedImagePath"></param> + public void Init(string imagePath, string selectedImagePath) + { + ImageBG = new Button() + { + X = Application.GetRealWidth(45), + Width = Application.GetMinRealAverage(112), + Height = Application.GetMinRealAverage(112), + Gravity = Gravity.CenterVertical, + Radius = (uint)Application.GetMinRealAverage(112 / 2), + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, + SelectedBackgroundColor = ZigbeeColor.Current.GXCSelectedBackgroundColor, + Tag = Tag + }; + AddChidren(ImageBG); + + ImageBtn = new Button() + { + X = Application.GetRealWidth(63), + Width = Application.GetMinRealAverage(78), + Height = Application.GetMinRealAverage(78), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = imagePath, + SelectedImagePath = selectedImagePath, + Tag = Tag + }; + AddChidren(ImageBtn); + + NameBtn = new Button() + { + X = Application.GetRealWidth(181), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(58), + TextColor = ZigbeeColor.Current.GXCTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, + TextAlignment = TextAlignment.CenterLeft, + Tag = Tag + }; + AddChidren(NameBtn); + + ZoneBtn = new Button + { + X = Application.GetRealWidth(181), + Y = Application.GetRealHeight(72), + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(49), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2 + }; + AddChidren(ZoneBtn); + + SwitchBtn = new Button() + { + X = Application.GetRealWidth(896), + Width = Application.GetMinRealAverage(78), + Height = Application.GetMinRealAverage(78), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "Item/Switch.png", + SelectedImagePath = "Item/SwitchSelected.png", + Tag = Tag + }; + AddChidren(SwitchBtn); + + var line = new Button() + { + X = Application.GetRealWidth(200), + Y = Height - 2, + Width = Application.GetRealWidth(821), + Height = 2, + BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor, + Tag = Tag + }; + AddChidren(line); + + ClickBtn = new Button + { + Width=Application.GetRealWidth(890) + }; + AddChidren(ClickBtn); + } + + /// <summary> + /// SetTitle + /// </summary> + /// <param name="title"></param> + public void SetTitle(string title) + { + NameBtn.Text = title; + } + /// <summary> + /// SetTitle + /// </summary> + /// <param name="title"></param> + public void SetTitle(int title) + { + SetTitle(Language.StringByID(title)); + } + + /// <summary> + /// SetZoneText + /// </summary> + /// <param name="title"></param> + public void SetZoneText(string title) + { + ZoneBtn.Text = title; + } + + /// <summary> + /// SetStatu + /// </summary> + /// <param name="statu"></param> + public void SetStatu(bool statu) + { + NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = SwitchBtn.IsSelected = statu; + } + + /// <summary> + /// HideSwitchBtn + /// </summary> + /// <param name="statu"></param> + public void HideSwitchBtn(bool statu) + { + SwitchBtn.Visible = statu; + } + } +} \ No newline at end of file diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardConfigureDeviceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardConfigureDeviceListForm.cs deleted file mode 100755 index 03594e8..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardConfigureDeviceListForm.cs +++ /dev/null @@ -1,113 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DeviceShard -{ - /// <summary> - /// 鍒嗕韩璁惧鐨勯厤缃垪琛ㄧ殑鐢婚潰 - /// </summary> - public class ShardConfigureDeviceListForm : UserCenterCommonForm - { - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalScrolViewLayout listview = null; - /// <summary> - /// 鏂颁笂鎶ョ殑璁惧(娉ㄦ剰:杩欎釜涓滆タ鏄釜鍦板潃寮曠敤) - /// </summary> - private List<CommonDevice> listNewDevice = null; - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="listdevices">璁惧鍒楄〃</param> - public void ShowForm(List<CommonDevice> listdevices) - { - this.listNewDevice = listdevices; - - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uConfigureDevice)); - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - - //娣诲姞鎵�鏈夌殑琛� - this.AddAllRowLayout(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - private void InitMiddleFrame() - { - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //杈撳嚭鍥炶矾鍒楄〃 - var btnText = new TitleViewControl(); - btnText.Y = Application.GetRealHeight(40); - btnText.TextColor = UserCenterColor.Current.TextGrayColor; - btnText.TextID = R.MyInternationalizationString.uOutputCircuitList; - bodyFrameLayout.AddChidren(btnText); - - listview = new VerticalScrolViewLayout(); - listview.Y = btnText.Bottom; - listview.Height = bodyFrameLayout.Height - btnText.Bottom; - bodyFrameLayout.AddChidren(listview); - } - - /// <summary> - /// 娣诲姞鎵�鏈夌殑琛� - /// </summary> - private void AddAllRowLayout() - { - foreach (CommonDevice device in this.listNewDevice) - { - this.AddRowLayout(device); - } - } - - /// <summary> - /// 娣诲姞琛� - /// </summary> - /// <param name="device">Device.</param> - private void AddRowLayout(CommonDevice device) - { - //璁惧鎺т欢 - var deviceRow = new DeviceRoomViewRow(listview, device); - //鍚戝彸鍥炬爣 - deviceRow.AddRightIconControl(); - - //妫�娴嬭澶囨槸鍚︽嫢鏈夋祴璇曠殑鍔熻兘 - if (Common.LocalDevice.Current.DeviceIsCanTest(device) == true) - { - //娴嬭瘯 - var btnTest = new RowSecondRightIconView(); - btnTest.UnSelectedImagePath = "Item/Test.png"; - btnTest.SelectedImagePath = "Item/TestSelected.png"; - deviceRow.AddChidren(btnTest, ChidrenBindMode.NotBind); - btnTest.MouseUpEventHandler += (sender, e) => - { - //娴嬭瘯 - Common.LocalDevice.Current.SetTestCommand(device); - }; - } - - deviceRow.MouseUpEvent += (sender, e) => - { - var form = new ShardDeviceEpointInfoForm(); - this.AddForm(form, device); - form.ActionNameChangedEvent += (deviceName, listName) => - { - //鍙樻洿鎴块棿 - Common.Room.CurrentRoom.ChangedRoom(device, listName); - //鍒锋柊鍏ㄩ儴淇℃伅淇℃伅 - deviceRow.listRoom = listName; - deviceRow.RefreshControlInfo(device); - }; - }; - } - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceEpointInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceEpointInfoForm.cs deleted file mode 100755 index a96e018..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceEpointInfoForm.cs +++ /dev/null @@ -1,236 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DeviceShard -{ - /// <summary> - /// 缃戝叧鎸囧畾鍒嗕韩璁惧鐨勪俊鎭敾闈� - /// </summary> - public class ShardDeviceEpointInfoForm : UserCenterCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 璁惧鍚嶇О鍙樻洿鐨勫洖璋冨嚱鏁�(璁惧鍚嶇О,鎴块棿鍚�) - /// </summary> - public Action<string, List<string>> ActionNameChangedEvent = null; - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalScrolViewLayout listview = null; - /// <summary> - /// 鏂颁笂鎶ョ殑璁惧 - /// </summary> - private CommonDevice newDevice = null; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="device">璁惧</param> - public void ShowForm(CommonDevice device) - { - this.newDevice = device; - - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceSettingUp)); - - //妫�娴嬭澶囨槸鍚︽嫢鏈夋祴璇曠殑鍔熻兘 - if (Common.LocalDevice.Current.DeviceIsCanTest(device) == true) - { - //鍒濆鍖栧ご閮ㄥ彸杈圭殑娴嬭瘯鍥炬爣 - this.InitTopLayoutRightIcon(); - } - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - } - - /// <summary> - /// 鍒濆鍖栧ご閮ㄥ彸杈圭殑娴嬭瘯鍥炬爣 - /// </summary> - private void InitTopLayoutRightIcon() - { - var btnIcon = new TopLayoutMostRightView(); - btnIcon.UnSelectedImagePath = "Item/Test.png"; - btnIcon.SelectedImagePath = "Item/TestSelected.png"; - topFrameLayout.AddChidren(btnIcon); - - btnIcon.MouseUpEventHandler += (sender, e) => - { - //娴嬭瘯 - Common.LocalDevice.Current.SetTestCommand(newDevice); - }; - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - public void InitMiddleFrame() - { - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //鎴块棿 - List<string> listRoomName = Common.Room.CurrentRoom.GetRoomListNameByDevice(this.newDevice); - - //鍥炬爣 - var btnImage = new IconViewControl(332); - btnImage.Y = Application.GetRealHeight(40); - btnImage.Gravity = Gravity.CenterHorizontal; - //璁剧疆澶у浘 - Common.LocalDevice.Current.SetDeviceBigIconToControl(btnImage, this.newDevice); - bodyFrameLayout.AddChidren(btnImage); - btnImage.MouseUpEventHandler += (sender, e) => - { - //鏄剧ず鍙樻洿璁惧鍥炬爣鐨勭晫闈� - this.ShowChangedIconForm(btnImage); - }; - - listview = new VerticalScrolViewLayout(); - listview.Y = btnImage.Bottom + Application.GetRealHeight(50); - listview.Height = bodyFrameLayout.Height - btnImage.Bottom - Application.GetRealHeight(50); - bodyFrameLayout.AddChidren(listview); - - //璁惧鍚嶇О - string caption = Language.StringByID(R.MyInternationalizationString.uDeviceName); - string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(newDevice); - var btnDeviceView = new EditorNameValueRow(caption, nameValue); - listview.AddChidren(btnDeviceView); - btnDeviceView.InitControl(); - //璇疯緭鍏ヨ澶囧悕绉� - btnDeviceView.SetEmptyNameTip(Language.StringByID(R.MyInternationalizationString.uDeviceNameMastInput)); - //缂栬緫璁惧鍚嶇О - btnDeviceView.SetDialogTitle(Language.StringByID(R.MyInternationalizationString.uEditorDeviceName)); - btnDeviceView.ActionNameChangedEvent += (deviceName) => - { - //璁惧閲嶅懡鍚� - this.DeviceReName(deviceName, listRoomName); - }; - - var statuRow = new StatuRowLayout(listview); - //鎵�灞炲尯鍩� - var btnBelongAreaView = new RowTopGrayView(false); - btnBelongAreaView.TextID = R.MyInternationalizationString.uBelongArea; - statuRow.AddChidren(btnBelongAreaView); - - var btnBelongArea = new RowBottomBlackView(false); - btnBelongArea.Text = Common.Room.CurrentRoom.GetRoomName(listRoomName); - statuRow.AddChidren(btnBelongArea); - //鍚戝彸鍥炬爣 - statuRow.AddRightIconControl(); - statuRow.MouseUpEvent += (sender, e) => - { - var form = new SelectRoomForm(); - this.AddForm(form, listRoomName); - form.ActionSelectRoom = (list) => - { - if (list != null) - { - //鍙樻洿鎴块棿 - Common.Room.CurrentRoom.ChangedRoom(newDevice, list); - - btnBelongArea.Text = Common.Room.CurrentRoom.GetRoomName(list); - listRoomName = list; - - if (this.ActionNameChangedEvent != null) - { - string name = Common.LocalDevice.Current.GetDeviceEpointName(this.newDevice); - this.ActionNameChangedEvent(name, listRoomName); - } - } - }; - }; - - //鎵�灞炴ā鍧� - var row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - - var btnBelongObjectView = new RowTopGrayView(false); - btnBelongObjectView.TextID = R.MyInternationalizationString.uBelongObject; - row.AddChidren(btnBelongObjectView); - - var btnBelongObject = new RowBottomBlackView(false); - btnBelongObject.Text = Common.LocalDevice.Current.GetDeviceMacName(newDevice); - row.AddChidren(btnBelongObject); - } - - #endregion - - #region 鈻� 淇敼鍚嶅瓧___________________________ - - /// <summary> - /// 璁惧閲嶅懡鍚� - /// </summary> - /// <param name="name">Name.</param> - /// <param name="listRoomName">Name.</param> - private async void DeviceReName(string name, List<string> listRoomName) - { - //璁惧鍚嶇О淇敼 - var result = await Common.LocalDevice.Current.ReName(this.newDevice, name); - if (result == false) - { - return; - } - Application.RunOnMainThread(() => - { - if (this.ActionNameChangedEvent != null) - { - name = Common.LocalDevice.Current.GetDeviceEpointName(this.newDevice); - this.ActionNameChangedEvent(name, listRoomName); - } - }); - } - - #endregion - - #region 鈻� 鍙樻洿鍥剧墖___________________________ - - /// <summary> - /// 鏄剧ず鍙樻洿璁惧鍥炬爣鐨勭晫闈� - /// </summary> - /// <param name="btnIcon"></param> - private void ShowChangedIconForm(IconViewControl btnIcon) - { - var form = new Phone.Device.CommonForm.DeviceIconSelectedIMGByLocal(); - UserView.HomePage.Instance.AddChidren(form); - UserView.HomePage.Instance.PageIndex += 1; - form.Show(); - form.action = (unSelectedImagePath, selectedImagePath) => - { - btnIcon.UnSelectedImagePath = selectedImagePath; - - //鍙樻洿鍥炬爣 - Common.LocalDevice.Current.ChangedDeviceIcon(newDevice, unSelectedImagePath); - - if (this.ActionNameChangedEvent != null) - { - List<string> listRoomName = Common.Room.CurrentRoom.GetRoomListNameByDevice(this.newDevice); - string name = Common.LocalDevice.Current.GetDeviceEpointName(this.newDevice); - this.ActionNameChangedEvent(name, listRoomName); - } - }; - } - - #endregion - - #region 鈻� 鍏抽棴鐣岄潰___________________________ - - /// <summary> - /// 鐢婚潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - this.ActionNameChangedEvent = null; - base.CloseForm(); - } - - #endregion - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceMacInfoEditorForm.cs deleted file mode 100755 index 701dddd..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceMacInfoEditorForm.cs +++ /dev/null @@ -1,319 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DeviceShard -{ - /// <summary> - /// 缂栬緫鍒嗕韩璁惧鐨勪俊鎭� - /// </summary> - public class ShardDeviceMacInfoEditorForm : UserCenterCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 鐢婚潰姝e父鍏抽棴鐨勫洖璋冨嚱鏁� - /// </summary> - public Action<string> ActionFormClose = null; - /// <summary> - /// 璁惧瀵硅薄 - /// </summary> - private List<CommonDevice> listNewDevice = null; - /// <summary> - /// 鑾峰彇寰楀埌浜嗛暅鍍忎俊鎭� - /// </summary> - private bool receiveImageInfo = false; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="listdevices">璁惧鍒楄〃</param> - public void ShowForm(List<CommonDevice> listdevices) - { - this.listNewDevice = listdevices; - - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceInfo)); - - //鍒濆鍖栧垹闄よ澶囩殑鐣岄潰(鍙充笂) - //this.InitDeleteDeviceForm(); - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - private void InitMiddleFrame() - { - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //璁惧鍥剧墖 - var btnpictrue = new PicViewControl(510, 320); - btnpictrue.Gravity = Gravity.CenterHorizontal; - btnpictrue.Y = Application.GetRealHeight(100); - Common.LocalDevice.Current.SetRealDeviceIconToControl(btnpictrue, listNewDevice); - bodyFrameLayout.AddChidren(btnpictrue); - - var listview = new VerticalScrolViewLayout(); - listview.Y = btnpictrue.Bottom + Application.GetRealHeight(100); - listview.Height = bodyFrameLayout.Height - btnpictrue.Bottom - Application.GetRealHeight(100); - bodyFrameLayout.AddChidren(listview); - - //鐢熶骇鍟嗗悕绉� - var row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnManuView = new RowTopGrayView(false); - btnManuView.TextID = R.MyInternationalizationString.uManufacturerName; - row.AddChidren(btnManuView); - var btnManu = new RowBottomBlackView(false); - btnManu.Text = listNewDevice[0].ManufacturerName; - if (string.IsNullOrEmpty(btnManu.Text) == true) - { - if (listNewDevice[0].DriveCode > 0) - { - //铏氭嫙璁惧鍥哄畾浣跨敤HDL - btnManu.Text = "HDL"; - } - } - row.AddChidren(btnManu); - - //璁惧鍨嬪彿 - row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnModelIdView = new RowTopGrayView(false); - btnModelIdView.TextID = R.MyInternationalizationString.uModelIdentifier; - row.AddChidren(btnModelIdView); - var btnModelId = new RowBottomBlackView(false); - btnModelId.Text = listNewDevice[0].ModelIdentifier; - row.AddChidren(btnModelId); - - //搴忓垪鍙� - row = new RowLayout(); - row.Height = ControlCommonResourse.ListViewRowHeight; - listview.AddChidren(row); - var btnSerialView = new RowTopGrayView(false); - btnSerialView.TextID = R.MyInternationalizationString.uSerialNumber; - row.AddChidren(btnSerialView); - var btnSerial = new RowBottomBlackView(false); - btnSerial.Text = listNewDevice[0].SerialNumber; - if (string.IsNullOrEmpty(btnSerial.Text) == true) - { - btnSerial.Text = listNewDevice[0].DeviceAddr; - } - row.AddChidren(btnSerial); - - //浜у搧鍚嶇О - string caption = Language.StringByID(R.MyInternationalizationString.uProductName); - string nameValue = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); - var btnDeviceView = new EditorNameValueRow(caption, nameValue); - listview.AddChidren(btnDeviceView); - btnDeviceView.InitControl(); - //璇疯緭鍏ヤ骇鍝佸悕绉� - btnDeviceView.SetEmptyNameTip(Language.StringByID(R.MyInternationalizationString.uProductNameMastInput)); - //缂栬緫浜у搧鍚嶇О - btnDeviceView.SetDialogTitle(Language.StringByID(R.MyInternationalizationString.uEditorProductName)); - btnDeviceView.ActionNameChangedEvent += (deviceName) => - { - //璁惧閲嶅懡鍚嶇劧鍚庢墦寮�鏂扮殑鐢婚潰 - this.DeviceReName(deviceName); - }; - - //鍙湁鏄渤涓滅殑璁惧鐨勬椂鍊� - if (Common.LocalDevice.Current.IsHdlDevice(listNewDevice[0]) == true) - { - //娣诲姞銆愬浐浠朵俊鎭�戣 - this.AddFirmwareVersionRow(listview); - } - } - - #endregion - - #region 鈻� 鍥轰欢淇℃伅___________________________ - - /// <summary> - /// 娣诲姞銆愬浐浠朵俊鎭�戣 - /// </summary> - /// <param name="listview"></param> - private void AddFirmwareVersionRow(VerticalScrolViewLayout listview) - { - //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず杩欎竴琛� - var oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr); - if (oTADevice == null || oTADevice.ImgVersion == -1) - { - return; - } - - var statuRow = new StatuRowLayout(listview); - //鍥轰欢淇℃伅 - var btnUpview = new RowCenterView(false); - btnUpview.TextID = R.MyInternationalizationString.uFirmwareInformation; - statuRow.AddChidren(btnUpview); - - statuRow.AddRightIconControl(); - - statuRow.MouseUpEvent += (sender, e) => - { - var form = new Device.DeviceFirmwareInfoForm(); - this.AddForm(form, listNewDevice); - }; - - //璁剧疆璁惧鐨勭増鏈俊鎭� - this.SetDeviceVersionInfo(oTADevice); - } - - /// <summary> - /// 璁剧疆璁惧鐨勭増鏈俊鎭� - /// </summary> - /// <param name="oTADevice">ota璁惧</param> - private void SetDeviceVersionInfo(OTADevice oTADevice) - { - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); - - new System.Threading.Thread(async () => - { - //璁剧疆璁惧鍏ㄩ儴鐨勯暅鍍忎俊鎭� - HdlDeviceImageInfoLogic.Current.SetAllImageInfoToOtaDevice(oTADevice, this.OtaImageInfoActionBack); - int count = 5; - while (this.receiveImageInfo == false && count > 0) - { - //绛夊緟璁惧闀滃儚鐨勫弽棣� - await System.Threading.Tasks.Task.Delay(300); - count--; - } - //鍙橀噺杩樺師 - this.receiveImageInfo = false; - //绉婚櫎浜嬩欢 - HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(oTADevice); - - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - }) - { IsBackground = true }.Start(); - } - - /// <summary> - /// 鑾峰彇鍒颁簡OTA闀滃儚淇℃伅鍥炶皟(100%鐗瑰畾鍥炶皟) - /// </summary> - /// <param name="device"></param> - /// <param name="reportData"></param> - private void OtaImageInfoActionBack(CommonDevice device, CommonDevice.DeviceStatusReportData reportData) - { - this.receiveImageInfo = true; - } - - #endregion - - #region 鈻� 淇敼鍚嶅瓧___________________________ - - /// <summary> - /// 璁惧閲嶅懡鍚� - /// </summary> - /// <param name="i_deviceName">deviceName.</param> - private async void DeviceReName(string i_deviceName) - { - //淇敼MAC鍚� - string deviceName = i_deviceName.Trim(); - var result = await Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName); - if (result == false) - { - return; - } - - Application.RunOnMainThread(() => - { - this.ActionFormClose?.Invoke(deviceName); - }); - } - - #endregion - - #region 鈻� 鍏抽棴鐣岄潰___________________________ - - /// <summary> - /// 鐢婚潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - this.ActionFormClose = null; - base.CloseForm(); - } - - #endregion - - #region 鈻� 鍒犻櫎鐣岄潰___________________________ - - /// <summary> - /// 鍒濆鍖栧垹闄よ澶囩殑鐣岄潰 - /// </summary> - private void InitDeleteDeviceForm() - { - var btnIcon = new TopLayoutMostRightView(); - btnIcon.UnSelectedImagePath = "Item/More.png"; - btnIcon.SelectedImagePath = "Item/MoreSelected.png"; - topFrameLayout.AddChidren(btnIcon); - btnIcon.MouseUpEventHandler += ((sender, e) => - { - //鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈� - this.ShowDeleteDeviceDialogForm(); - }); - } - - /// <summary> - /// 鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈� - /// </summary> - private void ShowDeleteDeviceDialogForm() - { - var frame = new TopRightMenuControl(this, 1); - //鍒犻櫎璁惧 - string deviceMenu = Language.StringByID(R.MyInternationalizationString.uDeleteDevice); - frame.AddRowMenu(deviceMenu, (obj) => - { - //纭瑕佸垹闄よ璁惧锛焮0}(鍒犻櫎璁惧鍚�,缁戝畾鐩爣灏嗘秷澶�) - string msg = Language.StringByID(R.MyInternationalizationString.uDeleteDeviceMsg); - if (msg.Contains("{0}") == true) - { - msg = string.Format(msg, "\r\n"); - } - this.ShowConfirmMsg(msg, "DoDeleteDevice"); - }); - } - - /// <summary> - /// 鍒犻櫎鎸囧畾璁惧 - /// </summary> - public async void DoDeleteDevice() - { - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); - //鍒犻櫎璁惧 - bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice); - - this.CloseProgressBar(); - - if (result == false) - { - return; - } - - Application.RunOnMainThread(() => - { - //鍏抽棴鐣岄潰 - this.CloseForm(); - //绉婚櫎璁惧鍒楄〃鐣岄潰鎸囧畾鐨勮澶� - //this.LoadFormMethodByName("DeviceManagementMainForm", "RemoveDeviceFromMemory", listNewDevice); - }); - } - #endregion - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs deleted file mode 100755 index ecd826a..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs +++ /dev/null @@ -1,743 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DeviceShard -{ - /// <summary> - /// 鍒嗕韩璁惧绠$悊鐨勪富鐣岄潰 - /// </summary> - public class ShardDeviceManagementMainForm : UserCenterCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 閿� - /// </summary> - private object objLock = new object(); - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalScrolViewLayout listView = null; - /// <summary> - /// 鎼滅储鎺т欢 - /// </summary> - //private SearchEditText txtSearchControl = null; - /// <summary> - /// 琛屾帶浠剁殑淇℃伅(Keys锛歁ac鍦板潃) - /// </summary> - private Dictionary<string, DeviceObjRowInfo> dicRowInfo = new Dictionary<string, DeviceObjRowInfo>(); - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - public void ShowForm() - { - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DeviceManagement)); - - //娣诲姞鑿滃崟 - this.AddTopMenu(); - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - public void InitMiddleFrame() - { - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //鍒濆鍖栨悳绱㈡帶浠� - this.InitSearchControl(); - - new System.Threading.Thread(() => - { - //鍒濆鍖栬澶囧垪琛ㄦ帶浠� - this.InitDeviceListControl(); - }) - { IsBackground = true }.Start(); - } - - #endregion - - #region 鈻� 鍒濆鍖栨悳绱㈡帶浠禵____________________ - - /// <summary> - /// 鍒濆鍖栨悳绱㈡帶浠� - /// </summary> - private void InitSearchControl() - { - //鎼滅储 - //if (txtSearchControl != null) - //{ - // txtSearchControl.CloseThead(); - //} - //txtSearchControl = new SearchEditText(); - //bodyFrameLayout.AddChidren(txtSearchControl); - ////缁戝畾鍥炶皟鍑芥暟 - //txtSearchControl.BindEvent(this.SetRowDataBySearchKeys); - - //鍒楄〃鎺т欢 - listView = new VerticalScrolViewLayout(); - //listView.Y = txtSearchControl.Bottom + Application.GetRealHeight(30); - //listView.Height = bodyFrameLayout.Height - txtSearchControl.Bottom - Application.GetRealHeight(30); - listView.Height = bodyFrameLayout.Height; - bodyFrameLayout.AddChidren(listView); - } - - #endregion - - #region 鈻� 鍒濆鍖栬澶囧垪琛ㄦ帶浠禵________________ - - /// <summary> - /// 鍒濆鍖栬澶囧垪琛ㄦ帶浠� - /// </summary> - private void InitDeviceListControl() - { - //鏍规嵁MAC鍚堝苟璁惧鍒楄〃 - this.MargeAllDeviceByMac(); - - //娌℃湁璁惧 - if (this.dicRowInfo.Count == 0) - { - Application.RunOnMainThread(() => - { - if (this.Parent != null) - { - //鍦ㄧ晫闈腑闂存樉绀烘棤鍒嗕韩璁惧鐨勬彁绀烘秷鎭� - this.ShowNotShardDeviceMsg(); - } - }); - } - else - { - //鏄剧ず杩涘害鏉� - this.ShowProgressBar(); - //娣诲姞鍏ㄩ儴鐨勮澶囪彍鍗曡 - this.DoAddAllMenuRow(true); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - } - } - - /// <summary> - /// 娣诲姞鍏ㄩ儴鐨勮澶囪彍鍗曡 - /// </summary> - /// <param name="readOnline">鏄惁璇诲彇璁惧鍦ㄧ嚎鐘舵��</param> - private void DoAddAllMenuRow(bool readOnline) - { - //娣诲姞璁惧鐨勮彍鍗曡 - int count = 0; - foreach (var rowInfo in this.dicRowInfo.Values) - { - Application.RunOnMainThread(() => - { - if (this.Parent == null) - { - return; - } - count++; - //娣诲姞璁惧鐨勮彍鍗曡 - this.AddDeviceMenuRow(rowInfo.listDevice); - if (count == this.dicRowInfo.Count && readOnline == true) - { - //寮�鍚澶囧湪绾跨嚎绋� - this.StartDeviceListControlThread(); - } - }); - } - } - - #endregion - - #region 鈻� 娣诲姞璁惧鑿滃崟琛宊____________________ - - /// <summary> - /// 娣诲姞璁惧鐨勮彍鍗曡 - /// </summary> - /// <param name="listDevice">璁惧瀵硅薄</param> - private void AddDeviceMenuRow(List<CommonDevice> listDevice) - { - var rowInfo = this.dicRowInfo[listDevice[0].DeviceAddr]; - if (rowInfo.frameLayout != null) - { - //鐩存帴娌跨敤涓婁竴娆$殑鎺т欢(鎸夐敭鍊兼悳绱笓鐢�) - listView.AddChidren(rowInfo.frameLayout); - //閲嶆柊鍒锋柊淇℃伅 - if (rowInfo.dicDetailRow != null) - { - foreach (var tempDevice in listDevice) - { - string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(tempDevice); - if (rowInfo.dicDetailRow.ContainsKey(mainkeys) == true) - { - rowInfo.dicDetailRow[mainkeys].RefreshControlInfo(tempDevice); - } - } - } - return; - } - - //鍒涘缓涓�涓彲浠ュ睍寮�鍜屾敹缂╃殑FrameLayout,鐩稿綋浜庤彍鍗曟爮 - var frame = new FrameLayout(); - frame.Height = ControlCommonResourse.ListViewRowHeight; - listView.AddChidren(frame); - rowInfo.frameLayout = frame; - - //鎺т欢 - var rowlayout = new DeviceObjectViewRow(listDevice); - frame.AddChidren(rowlayout); - rowlayout.InitControl(); - rowInfo.MenuRow = rowlayout; - - //鍚戝彸鐨勫浘鏍� - var btnRight = new MostRightEmptyView(); - btnRight.UnSelectedImagePath = "Item/Next.png"; - btnRight.SelectedImagePath = "Item/Down.png"; - rowlayout.AddChidren(btnRight, ChidrenBindMode.NotBind); - //鍗曞嚮浜嬩欢 - btnRight.MouseUpEventHandler += (sender, e) => - { - btnRight.IsSelected = !btnRight.IsSelected; - //灞曞紑鎴栬�呴殣钘忓垪琛� - this.ShowDetailList(listDevice, btnRight.IsSelected); - }; - - //缂栬緫 - var btnEditor = new RowEditorButton(); - rowlayout.AddRightView(btnEditor); - btnEditor.MouseUpEventHandler += (sender, e) => - { - //鎵撳紑璁惧淇℃伅鐣岄潰 - string macAddr = listDevice[0].DeviceAddr; - //淇敼璁惧鍚嶅瓧 - var form = new ShardDeviceMacInfoEditorForm(); - form.AddForm(form, this.dicRowInfo[macAddr].listDevice); - form.ActionFormClose += (deviceName) => - { - if (string.IsNullOrEmpty(deviceName) == false) - { - this.dicRowInfo[macAddr].MenuRow.btnDeviceName.Text = deviceName; - } - }; - }; - - rowlayout.MouseUpEvent += (sender, e) => - { - //濡傛灉鍗曞嚮鐨勬槸鍥炬爣鐨勮瘽锛岃烦杞澶囧洖璺厤缃晫闈� - var form = new ShardConfigureDeviceListForm(); - this.AddForm(form, listDevice); - }; - } - - #endregion - - #region 鈻� 娣诲姞璁惧鏄庣粏琛宊____________________ - - /// <summary> - /// 娣诲姞璁惧鐨勬槑缁嗚 - /// </summary> - /// <param name="frame">瀹瑰櫒</param> - /// <param name="device"></param> - private void AddDeviceDetailRow(FrameLayout frame, CommonDevice device) - { - var rowInfo = this.dicRowInfo[device.DeviceAddr]; - if (rowInfo.dicDetailRow == null) - { - rowInfo.dicDetailRow = new Dictionary<string, DeviceRoomViewRow>(); - } - - //琛屾帶浠� - var rowDevice = new DeviceRoomViewRow(device); - rowDevice.Y = frame.ChildrenCount * ControlCommonResourse.ListViewRowHeight; - frame.AddChidren(rowDevice); - rowDevice.InitControl(); - //淇濆瓨鎺т欢 - string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device); - rowInfo.dicDetailRow[maikey] = rowDevice; - - //妫�娴嬭澶囨槸鍚︽嫢鏈夋祴璇曠殑鍔熻兘 - if (Common.LocalDevice.Current.DeviceIsCanTest(device) == true) - { - //娴嬭瘯 - var btnTest = new RowSecondRightIconView(); - btnTest.UnSelectedImagePath = "Item/Test.png"; - btnTest.SelectedImagePath = "Item/TestSelected.png"; - rowDevice.AddChidren(btnTest, ChidrenBindMode.NotBind); - btnTest.MouseUpEventHandler += (sender, e) => - { - //娴嬭瘯 - Common.LocalDevice.Current.SetTestCommand(device); - }; - } - - //灞曞紑妯″紡鏃讹紝瀛愭帶浠惰涓庨《閮ㄨ鐨刋鐨勫亸绉婚噺 - int Xvalue = ControlCommonResourse.ChidrenXvalue; - rowDevice.btnIcon.X += Xvalue; - rowDevice.btnDevie.X += Xvalue; - rowDevice.btnRoom.X += Xvalue; - - rowDevice.MouseUpEvent += (sender, e) => - { - var form = new ShardDeviceEpointInfoForm(); - this.AddForm(form, device); - form.ActionNameChangedEvent += (deviceName, listName) => - { - //鍙樻洿鎴块棿 - Common.Room.CurrentRoom.ChangedRoom(device, listName); - //鍒锋柊鍏ㄩ儴淇℃伅淇℃伅 - rowDevice.listRoom = listName; - rowDevice.RefreshControlInfo(device); - }; - }; - } - - #endregion - - #region 鈻� 娣诲姞鑿滃崟___________________________ - - /// <summary> - /// 娣诲姞鑿滃崟 - /// </summary> - private void AddTopMenu() - { - var btnIcon = new TopLayoutMostRightView(); - btnIcon.UnSelectedImagePath = "Item/More.png"; - btnIcon.SelectedImagePath = "Item/MoreSelected.png"; - topFrameLayout.AddChidren(btnIcon); - btnIcon.MouseUpEventHandler += ((sender, e) => - { - var frame = new TopRightMenuControl(this, 1); - //鍚屾鍏变韩鏁版嵁 - string deviceMenu = Language.StringByID(R.MyInternationalizationString.uSynchronizeShardData); - frame.AddRowMenu(deviceMenu, (obj) => - { - //纭鏄惁鍚屾鍏变韩鏁版嵁锛� - string msg = Language.StringByID(R.MyInternationalizationString.uConfirmSynchronizeShardDataMsg); - this.ShowConfirmMsg(msg, "RefreshShardData"); - }); - }); - } - - #endregion - - #region 鈻� 鍒锋柊鍏变韩___________________________ - - /// <summary> - /// 鍒锋柊鍏变韩 - /// </summary> - public void RefreshShardData() - { - new System.Threading.Thread(async () => - { - var result = await HdlShardLogic.Current.SynchronizeDbSharedContent(); - if (result == false) - { - //鍚屾鍏变韩鏁版嵁澶辫触 - this.ShowErrorMsg(Language.StringByID(R.MyInternationalizationString.uSynchronizeShardDataFail)); - return; - } - //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅 - Common.LocalGateway.Current.ReFreshByLocal(); - //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅 - Common.LocalDevice.Current.ReFreshByLocal(); - //浠庢湰鍦伴噸鏂板姞杞藉叏閮ㄧ殑鎴块棿 - Common.Room.RefreshAllRoomByLocation(); - - Application.RunOnMainThread(() => - { - //閲嶆柊鍒濆鍖栫晫闈� - this.InitMiddleFrame(); - }); - }) - { IsBackground = true }.Start(); - } - - #endregion - - #region 鈻� 閿�兼悳绱__________________________ - - /// <summary> - /// 鏍规嵁鎼滅储閿�硷紝璁惧畾鍒楄〃鏁版嵁 - /// </summary> - /// <param name="searchKey">Search key.</param> - private void SetRowDataBySearchKeys(string searchKey) - { - lock (objLock) - { - Application.RunOnMainThread(() => - { - //棣栧厛鍏堢Щ闄ゅ垪琛ㄦ墍鏈夋帶浠� - this.listView.RemoveAll(); - }); - - //濡傛灉鎼滅储閿�间负绌猴紝鍒欒繕鍘熶负鍘熷鐘舵��:鏄剧ず璁惧绫诲瀷鎬昏 - if (searchKey == string.Empty) - { - foreach (var rowInfo in dicRowInfo.Values) - { - Application.RunOnMainThread(() => - { - if (this.Parent != null) - { - //娣诲姞璁惧鐨勮 - this.AddDeviceMenuRow(rowInfo.listDevice); - } - }); - } - } - else - { - //鎼滅储鍚嶅瓧閲岄潰鍖呭惈閿�肩殑璁惧 - foreach (var rowInfo in this.dicRowInfo.Values) - { - if ((rowInfo.MacName != null && rowInfo.MacName.Contains(searchKey) == true) - || rowInfo.DeviveTypeName.Contains(searchKey) == true) - { - Application.RunOnMainThread(() => - { - if (this.Parent != null) - { - //娣诲姞璁惧鐨勮 - this.AddDeviceMenuRow(rowInfo.listDevice); - } - }); - } - } - } - } - } - - #endregion - - #region 鈻� 灞曞紑鎶樺彔___________________________ - - /// <summary> - /// 灞曞紑鎴栬�呴殣钘忓垪琛� - /// </summary> - /// <param name="listDevice">璁惧鏄庣粏</param> - /// <param name="isShow">鏄惁灞曞紑</param> - private void ShowDetailList(List<CommonDevice> listDevice, bool isShow) - { - var rowInfo = this.dicRowInfo[listDevice[0].DeviceAddr]; - //瀹冨師鏉ョ殑楂樺害 - int oldHeight = rowInfo.frameLayout.Height; - //鍙樻洿鐨勯珮搴�,榛樿涓哄垪琛ㄩ殣钘� - int heightValue = ControlCommonResourse.ListViewRowHeight; - - if (isShow == true) - { - //灞曞紑妯″紡鏃讹紝鎵╁ぇ渚濇嵁涓�:瀹冩湁鍑犱釜瀛愭帶浠� - heightValue = (listDevice.Count + 1) * ControlCommonResourse.ListViewRowHeight; - //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 - if (rowInfo.frameLayout.ChildrenCount == 1) - { - new System.Threading.Thread(() => - { - foreach (CommonDevice info in listDevice) - { - Application.RunOnMainThread(() => - { - //鍔犺浇瀹冪殑鍒楄〃 - this.AddDeviceDetailRow(rowInfo.frameLayout, info); - }); - } - }) - { IsBackground = true }.Start(); - } - } - //鑷韩楂樺害鍙樻洿 - rowInfo.frameLayout.Height = heightValue; - } - - #endregion - - #region 鈻� 寮�鍚澶囧湪绾跨嚎绋媉__________________ - - /// <summary> - /// 寮�鍚澶囧湪绾跨嚎绋� - /// </summary> - private void StartDeviceListControlThread() - { - //寮�鍚澶囧湪绾跨洃娴� - this.StartCheckDeviceOnline(); - //寮�鍚紶鎰熷櫒鎶ヨ鐩戣 - this.StartCheckDeviceAlarm(); - } - - #endregion - - #region 鈻� 璁惧鍦ㄧ嚎___________________________ - - /// <summary> - /// 寮�鍚澶囧湪绾跨洃娴� - /// </summary> - private void StartCheckDeviceOnline() - { - //娣诲姞鎺ュ彈缃戝叧鑷姩鎺ㄩ�佺殑浜嬩欢 - HdlDeviceAttributeLogic.Current.AddReceiveDeviceOnlinePushEvent("DeviceListFormReceivePushOnline", this.ReceiveDeviceStatuPush); - - //浠庤澶囧垪琛ㄤ腑鑾峰彇鍦ㄧ嚎鐘舵�� - new System.Threading.Thread(async () => - { - //棣栧厛鑾峰彇杩欎簺浼犳劅鍣ㄦ墍鍦ㄧ殑缃戝叧 - var listWay = new List<ZbGateway>(); - var listDevice = Common.LocalDevice.Current.listAllDevice; - foreach (var device in listDevice) - { - ZbGateway realWay = null; - //鏄惁瀛樺湪鐪熷疄鐗╃悊缃戝叧 - if (Common.LocalGateway.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false) - { - continue; - } - listWay.Add(realWay); - } - foreach (var zbway in listWay) - { - if (this.Parent == null) - { - //鐣岄潰鍏抽棴 - return; - } - await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, this.ReceiveDeviceStatuPush, ShowErrorMode.NO); - } - }) - { IsBackground = true }.Start(); - } - - /// <summary> - /// 鎺ュ彈璁惧鍦ㄧ嚎鎺ㄩ�侊紙缃戝叧鍦ㄧ嚎鎺ㄩ�佸嵆鍦ㄧ嚎锛� - /// </summary> - /// <param name="device"></param> - private void ReceiveDeviceStatuPush(CommonDevice device) - { - lock (objLock) - { - if (device == null || this.Parent == null) - { - return; - } - DeviceObjectViewRow row = null; - if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == true) - { - row = this.dicRowInfo[device.DeviceAddr].MenuRow; - } - if (row == null) - { - return; - } - //鍒锋柊璁惧鐨勫湪绾跨姸鎬� - string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); - if (localDevice != null) - { - //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂� - if (localDevice.IsOnline == device.IsOnline) - { - return; - } - //淇濆瓨鐘舵�� - localDevice.IsOnline = device.IsOnline; - localDevice.ReSave(); - } - - Application.RunOnMainThread(() => - { - row?.SetOnlineStatu(device.IsOnline == 1); - }); - } - } - - #endregion - - #region 鈻� 浼犳劅鍣ㄦ姤璀________________________ - - /// <summary> - /// 寮�鍚紶鎰熷櫒鎶ヨ鐩戣(浠呬緵澶栭儴璋冪敤,缃戝叧鍦ㄧ嚎鐘舵�佺‘璁ゅ悗鎵ц) - /// </summary> - private void StartCheckDeviceAlarm() - { - HdlDeviceAttributeLogic.Current.AddSafetyAlarmEvent("DeviceListFormSensor", this.SetAlarmInfoByInterfaceResult); - } - - /// <summary> - /// 鏍规嵁鎺ュ彛鎺ㄩ�侊紝璁剧疆鎶ヨ淇℃伅 - /// </summary> - /// <param name="common"></param> - /// <param name="safetyDevice">鏄惁鏄畨闃茶澶囨姤璀�</param> - private void SetAlarmInfoByInterfaceResult(CommonDevice common, bool safetyDevice) - { - lock (objLock) - { - if (this.dicRowInfo.ContainsKey(common.DeviceAddr) == false) - { - return; - } - var row = this.dicRowInfo[common.DeviceAddr].MenuRow; - if (row == null) - { - return; - } - - //鑾峰彇浼犳劅鍣ㄦ姤璀︿俊鎭殑缈昏瘧鏂囨湰 - var msgInfo = Common.LocalSafeguard.Current.GetSensorAlarmInfo(common); - if (msgInfo == null) - { - return; - } - Application.RunOnMainThread(() => - { - row?.StartSelectStatuThread(3000); - }); - } - } - - #endregion - - #region 鈻� 鍚堝苟鏁版嵁___________________________ - - /// <summary> - /// 鏍规嵁MAC鍚堝苟璁惧鍒楄〃 - /// </summary> - private void MargeAllDeviceByMac() - { - lock (objLock) - { - this.dicRowInfo.Clear(); - //鑾峰彇璁惧鍒楄〃 - var listDevice = Common.LocalDevice.Current.listAllDevice; - //璁惧鎺掑簭 - List<CommonDevice> listSort = Common.LocalDevice.Current.SortDeviceList(listDevice); - foreach (CommonDevice device in listSort) - { - if (device == null || device.DeviceAddr == null) - { - continue; - } - if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == false) - { - this.dicRowInfo[device.DeviceAddr] = new DeviceObjRowInfo(); - } - this.dicRowInfo[device.DeviceAddr].listDevice.Add(device); - } - //鏀堕泦妫�绱㈢敤鐨勪俊鎭� - foreach (var rowInfo in this.dicRowInfo.Values) - { - rowInfo.listDevice.Sort((CommonDevice device1, CommonDevice device2) => - { - if (device1.DeviceEpoint > device2.DeviceEpoint) - { - return 1; - } - return -1; - }); - rowInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(rowInfo.listDevice[0]); - rowInfo.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(rowInfo.listDevice); - } - } - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鍦ㄧ晫闈腑闂存樉绀烘棤鍒嗕韩璁惧鐨勬彁绀烘秷鎭� - /// </summary> - private void ShowNotShardDeviceMsg() - { - //璇疯仈绯荤鐞嗗憳閰嶇疆鍏变韩璁惧 - //this.txtSearchControl.Visible = false; - var btnmsg = new MsgViewControl(1000, true); - btnmsg.TextID = R.MyInternationalizationString.uPleaseAdminToConfigureShardDeviceMsg; - btnmsg.Gravity = Gravity.Center; - bodyFrameLayout.AddChidren(btnmsg); - } - - /// <summary> - /// 鎵撳紑缃戝叧鍒楄〃鐣岄潰 - /// </summary> - public void OpenGatewayManagementForm() - { - var form = new GatewayManage.GatewayManagementForm(); - this.AddForm(form); - } - - #endregion - - #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ - - /// <summary> - /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠� - /// </summary> - public override void FormActionAgainEvent() - { - //閲嶆柊鍒锋柊鐣岄潰 - this.listView.RemoveAll(); - //娣诲姞鍏ㄩ儴鐨勮澶囪彍鍗曡 - this.DoAddAllMenuRow(false); - } - - #endregion - - #region 鈻� 鍏抽棴鐣岄潰___________________________ - - /// <summary> - /// 鐢婚潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor"); - HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline"); - - base.CloseForm(); - } - - #endregion - - #region 鈻� 缁撴瀯浣撶被___________________________ - - /// <summary> - /// 璁惧琛屼俊鎭� - /// </summary> - private class DeviceObjRowInfo - { - /// <summary> - /// 璁惧鐨凪AC鍚嶅瓧 - /// </summary> - public string MacName = string.Empty; - /// <summary> - /// 璁惧绫诲瀷鐨勬枃鏈俊鎭� - /// </summary> - public string DeviveTypeName = string.Empty; - /// <summary> - /// 妗屽竷FrameLayout - /// </summary> - public FrameLayout frameLayout = null; - /// <summary> - /// 鑿滃崟琛� - /// </summary> - public DeviceObjectViewRow MenuRow = null; - /// <summary> - /// 鏄庣粏琛� - /// </summary> - public Dictionary<string, DeviceRoomViewRow> dicDetailRow = null; - /// <summary> - /// 璁惧鍒楄〃 - /// </summary> - public List<CommonDevice> listDevice = new List<CommonDevice>(); - } - - #endregion - } -} diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 1d35185..51c0d12 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -72,7 +72,7 @@ private readonly int sleepSpan = 300; - private FrameLayout itemView; + private FrameLayout itemView=new FrameLayout(); #endregion diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs index bcfbb8e..13ca839 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -67,6 +67,7 @@ /// <param name="typeTag">Type tag.</param> public void DeviceInfoChange(CommonDevice common, string typeTag) { + /// //璁惧涓婃姤鐘舵�佷腑 褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� if (typeTag == "DeviceStatusReport") { diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index 4ae94cf..2d36486 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -44,6 +44,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ACLeftIconButtonRowLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\BackButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\ButtonLineForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CategoryFunctionRow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonEnum.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CommonFormResouce.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\CommonForm\CompleteButton.cs" /> -- Gitblit v1.8.0