From a5b3c4bae726ef6770d4bfcbf2f4b50a37ed4a15 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 06 三月 2020 15:31:36 +0800 Subject: [PATCH] 删除了郭雪城的 DeviceUi 这个类 --- ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs | 137 ++++++++++++++------------------------------- 1 files changed, 42 insertions(+), 95 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs index 6916f59..67b09b3 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs @@ -21,19 +21,6 @@ private TopFrameLayout top; private Button selectAllBtn; - private FrameLayout itemView; - /// <summary> - /// low_High - /// </summary> - private const int low_High = 127; - /// <summary> - /// 鍔熻兘 - /// </summary> - private ButtonLineForm functionBtn; - /// <summary> - /// 鍦烘櫙 - /// </summary> - private ButtonLineForm sceneBtn; /// <summary> /// 涓儴鑳屾櫙bodyView /// </summary> @@ -61,7 +48,7 @@ /// <summary> /// dList /// </summary> - private List<DeviceUI> devList; + private List<CommonDevice> devList; /// <summary> /// sceneList /// </summary> @@ -70,11 +57,15 @@ /// <summary> /// 鐩稿悓绫诲瀷鐨勮澶囧垪琛� /// </summary> - private Dictionary<int ,List<DeviceUI>> typeDeviceDic; + private Dictionary<int ,List<CommonDevice>> typeDeviceDic; /// <summary> /// 璁惧绫诲瀷鐨勫浘id /// </summary> private Dictionary<int, DeviceConcreteType> typeIdDic; + /// <summary> + /// 褰撳墠閫夋嫨鐨勫垎鏀� 1:鍦烘櫙 2:鍔熻兘 + /// </summary> + private int NowSelectIndex = 1; #endregion @@ -102,7 +93,7 @@ /// </summary> private void InitData() { - typeDeviceDic = new Dictionary<int, List<DeviceUI>> { }; + typeDeviceDic = new Dictionary<int, List<CommonDevice>> { }; typeIdDic = new Dictionary<int, DeviceConcreteType> { }; RefreshData(); @@ -113,8 +104,8 @@ /// </summary> private void RefreshData() { - devList = Shared.Common.Room.CurrentRoom.GetUnalloctedDeviceUIs(); - sceneList = Shared.Common.Room.CurrentRoom.GetUnalloctedScenes(); + devList = UserCenter.HdlRoomLogic.Current.GetUnalloctedDevice(); + sceneList = UserCenter.HdlSceneLogic.Current.GetUnalloctedScenes(); typeDeviceDic.Clear(); typeIdDic.Clear(); if (devList == null) @@ -123,10 +114,10 @@ } foreach (var device in devList) { - var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device?.CommonDevice); + var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device); if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false) { - var sameDevList = new List<DeviceUI> { }; + var sameDevList = new List<CommonDevice> { }; sameDevList.Add(device); typeDeviceDic[info.BeloneTextId] = sameDevList; } @@ -137,15 +128,6 @@ typeIdDic[info.BeloneTextId] = info.ConcreteType; } } - - ///// <summary> - ///// RefreshView - ///// </summary> - //public void RefreshView() - //{ - // InitData(); - // RefreshBodyView(); - //} #region Add____________________________________ @@ -177,68 +159,27 @@ }; AddChidren(bodyFrameLayout); - var functionSceneBG = new FrameLayout() - { - Height = Application.GetRealHeight(low_High), - BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor + //鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var btnSceneFunctionSwitch = new UserCenter.SceneFunctionSwitchControl(); + btnSceneFunctionSwitch.Y = Application.GetRealHeight(43); + bodyFrameLayout.AddChidren(btnSceneFunctionSwitch); + btnSceneFunctionSwitch.SelectTabEvent += (index) => + { + this.NowSelectIndex = index; + this.RefreshBodyView(); }; - bodyFrameLayout.AddChidren(functionSceneBG); - - //鍦烘櫙 - sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left, 43); - functionSceneBG.AddChidren(sceneBtn); - sceneBtn.Init(); - sceneBtn.SetTitle(R.MyInternationalizationString.Scence); - sceneBtn.IsSelected = true; - - //鍔熻兘 - functionBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 43); - functionSceneBG.AddChidren(functionBtn); - functionBtn.Init(); - functionBtn.SetTitle(R.MyInternationalizationString.Function); - functionBtn.IsSelected = false; - functionBtn.X = sceneBtn.Right; - - //閫夋嫨鍔熻兘鍒嗘爮 - functionBtn.NameBtn.MouseUpEventHandler += FunctionBtn_MouseUpEventHandler; - //閫夋嫨鍦烘櫙鍒嗘爮 - sceneBtn.NameBtn.MouseUpEventHandler += SceneBtn_MouseUpEventHandler; //鍔熻兘鍜屽満鏅痓odyView functionSceneBodyView = new FrameLayout() { - Y= Application.GetRealHeight(127), + Y = Application.GetRealHeight(127), Height = Application.GetRealHeight(1607), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; bodyFrameLayout.AddChidren(functionSceneBodyView); - RefreshBodyView(); - - } - - /// <summary> - /// 閫夋嫨鍔熻兘鍒嗘爮 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void FunctionBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) - { - functionBtn.IsSelected = true; - sceneBtn.IsSelected = false; - RefreshBodyView(); - } - - /// <summary> - /// 閫夋嫨鍦烘櫙鍒嗘爮 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void SceneBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) - { - functionBtn.IsSelected = false; - sceneBtn.IsSelected = true; - RefreshBodyView(); + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + btnSceneFunctionSwitch.InitControl(); } #endregion @@ -251,11 +192,11 @@ { functionSceneBodyView.RemoveAll(); - if (functionBtn.IsSelected) + if (this.NowSelectIndex == 2) { ShowFunction(); } - else if (sceneBtn.IsSelected) + else if (this.NowSelectIndex == 1) { ShowScene(); } @@ -363,8 +304,8 @@ deviceListScrolView.RemoveAll(); - var sameTypeList = new List<DeviceUI> { }; - var selectedList = new List<DeviceUI> { }; + var sameTypeList = new List<CommonDevice> { }; + var selectedList = new List<CommonDevice> { }; sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; foreach (var deviceUI in sameTypeList) @@ -378,7 +319,7 @@ var deviceRow = new SelectFunctionView(0, 35); deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); - deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); + deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI)); deviceTypeRowLayout.AddChidren(deviceRow); EventHandler<MouseEventArgs> eventHandler = (sender, e) => @@ -474,7 +415,7 @@ { foreach (var d in selectedList) { - r.AddDevice(d.CommonDevice, true); + UserCenter.HdlRoomLogic.Current.AddDevice(r, d, true); deviceListScrolView.RemoveViewByTag(d); } @@ -539,7 +480,7 @@ { var sceneScrolView = new VerticalScrolViewLayout { - Y = Application.GetRealHeight(22), + Y = Application.GetRealHeight(81), Height=Application.GetRealHeight(1405-22) }; functionSceneBodyView.AddChidren(sceneScrolView); @@ -548,7 +489,7 @@ var sceneFL = new FrameLayout() { Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth), - Height = Application.GetRealHeight(397 + 58), + Height = Application.GetRealHeight(397 + 46), Gravity = Gravity.CenterHorizontal, BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, Tag = sceneUI, @@ -559,18 +500,23 @@ var sceneImg = new ImageView() { X = Application.GetRealWidth(179), - Y = Application.GetRealHeight(58), Width = Application.GetRealWidth(844), Height = Application.GetRealHeight(397), ImagePath = sceneUI.IconPath, Radius = (uint)Application.GetRealHeight(17) }; - sceneFL.AddChidren(sceneImg); + sceneFL.AddChidren(sceneImg); + + //闃村奖 + var btnShadow = new UserCenter.PicViewControl(sceneImg.Width + Application.GetRealWidth(14 * 2), sceneImg.Height + Application.GetRealHeight(43), false); + btnShadow.X = sceneImg.X - Application.GetRealWidth(14); + btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png"; + sceneFL.AddChidren(btnShadow); var selectedBtn = new Button { X = Application.GetRealWidth(919), - Y = Application.GetRealHeight(92), + Y = Application.GetRealHeight(45), Width = Application.GetMinRealAverage(60), Height = Application.GetMinRealAverage(60), UnSelectedImagePath = "Room/ItemUnSelected.png", @@ -581,10 +527,11 @@ var leftFL = new FrameLayout { X = Application.GetRealWidth(CommonFormResouce.X_Left), - Y = Application.GetRealHeight(58 + 58), + Y = Application.GetRealHeight(58), Width = Application.GetRealWidth(251), Height = Application.GetRealHeight(282), - BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor2 + BackgroundColor = 0xd6333333, + Radius = (uint)Application.GetRealHeight(17) }; sceneFL.AddChidren(leftFL); @@ -705,7 +652,7 @@ { foreach (var s in selectedList) { - r.AddScene(s); + UserCenter.HdlSceneLogic.Current.AddScene(r, s); sceneScrolView.RemoveViewByTag(s); } RefreshData(); -- Gitblit v1.8.0