From 6144d4267f92db9be96a7003f4352732bfe9bb3b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 19 三月 2020 17:49:31 +0800
Subject: [PATCH] 2020-03-19-1
---
ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 429 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 244 insertions(+), 185 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
index 8c802bc..c0f6072 100755
--- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs
@@ -1,5 +1,7 @@
锘縰sing System;
using Shared.Common;
+using Shared.Phone.Device.CommonForm;
+using Shared.Phone.Device.DeviceLogic;
using ZigBee.Device;
namespace Shared.Phone.Device.Light
@@ -11,19 +13,15 @@
/// <summary>
/// The action.
/// </summary>
- public Action action;
+ public Action<CommonDevice, Common.Room> action;
///// <summary>
///// The top view.
///// </summary>
- private CommonForm.TopFrameLayout topFL;
- /// <summary>
- /// 鏇村璁剧疆
- /// </summary>
- private Button moreBtn;
+ private CommonForm.TopFrameLayout top;
/// <summary>
/// 浼犺繃鏉ョ殑璁惧
/// </summary>
- private DeviceUI device;
+ private CommonDevice device;
/// <summary>
/// 浼犺繃鏉ョ殑ac
/// </summary>
@@ -33,25 +31,14 @@
/// </summary>
private Shared.Common.Room room;
/// <summary>
- /// The middle fl.
+ /// bodyFrameLayout
/// </summary>
- private FrameLayout midFL;
+ private FrameLayout bodyFrameLayout;
/// <summary>
/// 鏀惰棌鎸夐挳
/// </summary>
private Button collectionBtn;
- /// <summary>
- /// 璁惧鏄惁鍦ㄧ嚎鏍囪瘑--Online
- /// </summary>
- private readonly string DeviceStatus_Online = "Online";
- /// <summary>
- /// 璁惧鐘舵�佸紑鍏虫爣璇�--Switch
- /// </summary>
- private readonly string DeviceStatus_OnOffStatus = "Switch";
- /// <summary>
- /// The light image.
- /// </summary>
- private Button deviceIMG;
+
/// <summary>
/// 寮�鍏�
/// </summary>
@@ -59,11 +46,35 @@
/// <summary>
/// 婊戞潯
/// </summary>
- private HorizontalSeekBar levelSeekBar;
+ private WaveSeekBar levelSeekBar;
+
+
+ private Button StatuBtn;
/// <summary>
- /// 寤舵椂 300姣
+ /// 鎴块棿
/// </summary>
- private int sleepSpan = 300;
+ private Button roomBtn;
+ /// <summary>
+ /// 鎴块棿鍚�
+ /// </summary>
+ private Button roomName;
+ /// <summary>
+ /// MaxLevel
+ /// </summary>
+ private const int MaxLevel = 254;
+
+ /// <summary>
+ /// IsDrawerLockMode
+ /// </summary>
+ public bool IsDrawerLockMode;
+ /// <summary>
+ /// ProgressBtn
+ /// </summary>
+ Button ProgressBtn;
+ /// <summary>
+ /// ProgressBtnY
+ /// </summary>
+ int ProgressBtnY;
#endregion
@@ -113,35 +124,46 @@
{
var deviceUI = device;
//璁惧涓虹┖
- if (deviceUI.CommonDevice == null)
+ if (deviceUI == null)
{
return;
}
//鏄惁涓哄綋鍓嶈澶�
- if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
+ if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr)
{
return;
}
- if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight)
+ if (deviceUI.Type == DeviceType.DimmableLight)
{
- if ((common as DimmableLight).DeviceStatusReport.CluterID == 6)
+ if (common.DeviceStatusReport.CluterID == 6)
{
- dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.DeviceStatusReport = (common as DimmableLight).DeviceStatusReport;
- //璁板綍銆佹洿鏂扮姸鎬�
+ dimmableLight = deviceUI as DimmableLight;
+ dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
{
return;
}
dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
switchBtn.IsSelected = dimmableLight.OnOffStatus == 1;
+ StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} {UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
+
+ if (switchBtn.IsSelected == true)
+ {
+ levelSeekBar.IsClickable = true;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
+ }
+ else
+ {
+ levelSeekBar.IsClickable = false;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
+ }
dimmableLight.LastDateTime = DateTime.Now;
}
//浜害
- if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 8)
+ if (common.DeviceStatusReport.CluterID == 8)
{
- dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
- dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport;
+ dimmableLight = deviceUI as ZigBee.Device.DimmableLight;
+ dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
var attriButeList = dimmableLight.DeviceStatusReport.AttriBute;
if (attriButeList == null || attriButeList.Count == 0)
{
@@ -153,18 +175,12 @@
//姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴�
dimmableLight.Level = attriButeList[0].AttriButeData;
dimmableLight.LastDateTime = DateTime.Now;
- levelSeekBar.Progress = dimmableLight.Level;
+ levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100);
+ StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
break;
}
}
- //***鏂版敼***璁惧鐘舵�佷笂鎶ヤ腑锛屽綋CluterID=3,璇佹槑璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
- else if ((common as DimmableLight).DeviceStatusReport.CluterID == 3)
- {
- dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.IsOnline = 1;
- deviceIMG.IsSelected = dimmableLight.IsOnline == 1;
- dimmableLight.LastDateTime = DateTime.Now;
- }
+
}
}
catch (Exception ex)
@@ -175,34 +191,7 @@
}
else if (typeTag == "OnlineStatusChange")
{
- Application.RunOnMainThread(() =>
- {
- try
- {
- var deviceUI = device;
- //璁惧涓虹┖
- if (deviceUI.CommonDevice == null)
- {
- return;
- }
- //鏄惁涓哄綋鍓嶈澶�
- if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
- {
- return;
- }
- if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight)
- {
- dimmableLight = deviceUI.CommonDevice as DimmableLight;
- dimmableLight.IsOnline = (common as DimmableLight).IsOnline;
- deviceIMG.IsSelected = dimmableLight.IsOnline == 1;
- dimmableLight.LastDateTime = DateTime.Now;
- }
- }
- catch (Exception ex)
- {
- System.Console.WriteLine($"Error:{ex.Message}");
- }
- });
+
}
}
@@ -217,6 +206,12 @@
{
ZbGateway.StatusList.Remove(this);
UserView.HomePage.Instance.ScrollEnabled = true;
+ action(device, room);
+ action = null;
+ if (IsDrawerLockMode)
+ {
+ CommonPage.Instance.IsDrawerLockMode = false;
+ }
base.RemoveFromParent();
}
@@ -228,7 +223,9 @@
/// </summary>
public DimmableLightControl()
{
+ UserView.HomePage.Instance.ScrollEnabled = false;
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+ ZbGateway.StatusList.Add(this);
}
#endregion
@@ -239,17 +236,16 @@
/// </summary>
/// <param name="device">Device.</param>
/// <param name="room">Room.</param>
- public void Show(DeviceUI device, Shared.Common.Room room)
+ public void Show(CommonDevice device, Shared.Common.Room room)
{
- ZbGateway.StatusList.Add(this);
this.device = device;
this.room = room;
- this.dimmableLight = device.CommonDevice as ZigBee.Device.DimmableLight;
+ this.dimmableLight = device as ZigBee.Device.DimmableLight;
//娣诲姞topview
AddTopView();
//娣诲姞midview
- AddMidview();
+ AddBodyView(this.device);
//缁戝畾浜嬩欢
BindEvent();
//鏀惰棌
@@ -260,9 +256,7 @@
//鍙戦�佽鍙栫姸鎬佸懡浠�
UserView.UserHomeView.ReadStatus(dimmableLight, () =>
{
- dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
- dimmableLight.ReadOnOffStatus();
- dimmableLight.ReadLevel();
+ ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device);
});
}
else
@@ -270,9 +264,7 @@
//闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵��
if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
{
- dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
- dimmableLight.ReadOnOffStatus();
- dimmableLight.ReadLevel();
+ ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device);
}
}
}
@@ -286,30 +278,26 @@
/// </summary>
private void AddTopView()
{
- topFL = new CommonForm.TopFrameLayout(this) { };
- AddChidren(topFL);
-
- AddMoreview();
- }
-
- /// <summary>
- /// Adds the moreview.
- /// </summary>
- private void AddMoreview()
- {
- moreBtn = new CommonForm.SelectedStatuButton()
+ top = new CommonForm.TopFrameLayout();
+ AddChidren(top);
+ top.InitTopview();
+ top.backButton.MouseUpEventHandler += (sender, e) =>
{
- X = Application.GetRealWidth(CommonPage.AppRealWidth - 150),
- Width = Application.GetMinReal(110),
- Height = Application.GetMinReal(110),
- Gravity = Gravity.CenterVertical,
- UnSelectedImagePath = "Item/More.png",
- SelectedImagePath = "Item/MoreSelected.png",
+ RemoveFromParent();
};
- topFL.topView.AddChidren(moreBtn);
+
+ var moreBtn = new Button
+ {
+ X = Application.GetRealWidth(953),
+ Width = Application.GetMinReal(69),
+ Height = Application.GetMinReal(69),
+ Gravity = Gravity.CenterVertical,
+ UnSelectedImagePath = "Item/More.png"
+ };
+ top.topView.AddChidren(moreBtn);
+
moreBtn.MouseUpEventHandler += MoreEvent;
}
-
/// <summary>
/// 鏇村璁剧疆
/// </summary>
@@ -321,9 +309,9 @@
UserView.HomePage.Instance.AddChidren(detailInfo);
UserView.HomePage.Instance.PageIndex += 1;
detailInfo.Show(device, room);
- detailInfo.action = () =>
+ detailInfo.EditAction += (curDev, curRoom) =>
{
- Show(device, room);
+ Show(curDev, curRoom);
};
}
@@ -332,17 +320,17 @@
#region 鈼� midview_______________________
/// <summary>
- /// Adds the midview.
+ /// AddBodyView
/// </summary>
- private void AddMidview()
+ public void AddBodyView(CommonDevice device)
{
- midFL = new FrameLayout()
+ bodyFrameLayout = new FrameLayout()
{
- Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
- Y = topFL.Bottom,
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
+ Y = Application.GetRealHeight(184),
+ Height = Application.GetRealHeight(1737),
+ BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor,
};
- AddChidren(midFL);
+ AddChidren(bodyFrameLayout);
AddItemview();
}
@@ -360,113 +348,182 @@
Y = Application.GetRealHeight(115),
Width = Application.GetRealWidth(965),
Height = Application.GetRealHeight(1316),
- Radius = CommonPage.BigFormRadius,
+ Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
Gravity = Gravity.CenterHorizontal,
- BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
};
- midFL.AddChidren(itemView);
- var deviceView = new FrameLayout()
- {
- X = 2,
- Y = 2,
- Width = itemView.Width - 4,
- Height = itemView.Height - Application.GetRealHeight(138),
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
- Tag = device
- };
- itemView.AddChidren(deviceView);
+ bodyFrameLayout.AddChidren(itemView);
collectionBtn = new Button()
{
- X = deviceView.Width - Application.GetRealWidth(130),
- Y = Application.GetRealHeight(20),
- Width = Application.GetMinReal(110),
- Height = Application.GetMinReal(110),
+ X = Application.GetRealWidth(850),
+ Y = Application.GetRealHeight(46),
+ Width = Application.GetMinReal(69),
+ Height = Application.GetMinReal(69),
UnSelectedImagePath = "Item/Collection.png",
SelectedImagePath = "Item/CollectionSelected.png"
};
- deviceView.AddChidren(collectionBtn);
+ itemView.AddChidren(collectionBtn);
- deviceIMG = new Button()
+ var deviceNameBtn = new Button()
{
- Y = Application.GetRealHeight(100),
- Height = Application.GetMinRealAverage(240),
- Width = Application.GetMinRealAverage(240),
+ Y = Application.GetRealHeight(46),
+ Width = Application.GetRealWidth(500),
+ Height = Application.GetRealHeight(60),
Gravity = Gravity.CenterHorizontal,
- UnSelectedImagePath = device.IconPath,
- SelectedImagePath = device.OnlineIconPath,
- IsSelected = dimmableLight.IsOnline == 1,
- Tag = DeviceStatus_Online
+ Text = Common.LocalDevice.Current.GetDeviceEpointName(device),
+ TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ TextSize = 15,
+ IsBold=true
};
- deviceView.AddChidren(deviceIMG);
+ itemView.AddChidren(deviceNameBtn);
- var lightName = new Button()
+ StatuBtn = new Button
{
- Y = deviceIMG.Bottom,
- Height = Application.GetRealHeight(85),
+ Y = Application.GetRealHeight(118),
+ Width = Application.GetRealWidth(600),
+ Height = Application.GetRealHeight(60),
Gravity = Gravity.CenterHorizontal,
- Text = device.CommonDevice.DeviceEpointName,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor
+ TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+ Text = dimmableLight.Level>0?$"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" :$"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}",
+ TextSize=10
};
- deviceView.AddChidren(lightName);
- levelSeekBar = new HorizontalSeekBar()
+ itemView.AddChidren(StatuBtn);
+
+ levelSeekBar = new WaveSeekBar()
{
- Y = lightName.Bottom + Application.GetRealHeight(150),
- Width = Application.GetRealWidth(800),
- Height = Application.GetRealHeight(80),
+ Y = Application.GetRealHeight(377),
+ Width = Application.GetRealWidth(271),
+ Height = Application.GetRealHeight(533),
Gravity = Gravity.CenterHorizontal,
- BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor,
- ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor,
- BorderColor = ZigbeeColor.Current.GXCButtonBlueColor,
- ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor,
- Max = 254,
- Tag = "LevelSeekBar",
- Progress = dimmableLight.Level,
- SleepTime=sleepSpan,
+ WavePadding = Application.GetRealWidth(8),
+ MaxValue=100,
+ Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100),
+
+ CornerRadius= Application.GetRealHeight(58)
};
- deviceView.AddChidren(levelSeekBar);
- levelSeekBar.ProgressChanged += (send2, e2) =>
+
+ itemView.AddChidren(levelSeekBar);
+
+ if (dimmableLight.OnOffStatus == 1)
{
- dimmableLight.SetLevel(levelSeekBar.Progress);
+ levelSeekBar.IsClickable = true;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
+ }
+ else
+ {
+ levelSeekBar.IsClickable = false;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
+ }
+
+ levelSeekBar.OnStartTrackingTouchEvent += (sender, e) =>
+ {
+ OnProgressButtonMove(levelSeekBar.Progress);
+ levelSeekBar.IsProgressTextShow = false;
+ ProgressBtn.Visible = true;
};
+
+ levelSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
+ {
+ ProgressBtn.Visible = false;
+ levelSeekBar.IsProgressTextShow = true;
+ dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0));
+ };
+
+ levelSeekBar.OnProgressChangedEvent += (send2, e2) =>
+ {
+
+ OnProgressButtonMove(e2);
+
+ //鍒ゆ柇鏄惁300ms灞忚斀
+ //if (levelSeekBar.IsProgressChangeDelay()) return;
+ //dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0));
+ };
+
+ InitProgressBtn(itemView);
switchBtn = new Button()
{
- Y = levelSeekBar.Bottom + Application.GetRealHeight(150),
+ Y = Application.GetRealHeight(1005),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
Gravity = Gravity.CenterHorizontal,
- Width = Application.GetMinRealAverage(180),
- Height = Application.GetMinRealAverage(120),
UnSelectedImagePath = "Item/Switch.png",
SelectedImagePath = "Item/SwitchSelected.png",
- Tag = DeviceStatus_OnOffStatus,
- IsSelected = dimmableLight.OnOffStatus == 1
+ IsSelected = (device as DimmableLight).OnOffStatus == 1
};
- deviceView.AddChidren(switchBtn);
+ itemView.AddChidren(switchBtn);
- var roomBtn = new Button()
+ var roomBG = new Button
{
- X = Application.GetRealWidth(50),
- Y = Application.GetRealHeight(25) + deviceView.Bottom,
+ Y = Application.GetRealHeight(1178 - 50),
+ Height = Application.GetRealHeight(138 + 50),
+ BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor,
+ Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius)
+ };
+ itemView.AddChidren(roomBG);
+
+ var roomBG2 = new Button
+ {
+ Y = Application.GetRealHeight(1178 - 50),
+ Height = Application.GetRealHeight(50),
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+ };
+ itemView.AddChidren(roomBG2);
+
+ roomBtn = new Button()
+ {
+ X = Application.GetRealWidth(CommonFormResouce.X_Left),
+ Y = Application.GetRealHeight(1207),
Width = Application.GetMinReal(80),
Height = Application.GetMinReal(80),
- UnSelectedImagePath = "Item/Room.png",
- SelectedImagePath = "Item/RoomSelected.png"
+ UnSelectedImagePath = "Item/Room.png"
};
itemView.AddChidren(roomBtn);
- var roomName = new Button()
+ roomName = new Button()
{
- X = roomBtn.Right + Application.GetRealWidth(20),
- Y = roomBtn.Y,
+ X = Application.GetRealWidth(150),
+ Y = Application.GetRealHeight(1224),
Width = Application.GetRealWidth(400),
- Height = Application.GetRealHeight(80),
+ Height = Application.GetRealHeight(50),
Text = room.Name,
TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- SelectedTextColor = ZigbeeColor.Current.GXCTextBlueColor
+ TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
+ TextSize = 12
};
itemView.AddChidren(roomName);
+ }
+
+ /// <summary>
+ /// OnProgressButtonMove
+ /// </summary>
+ private void OnProgressButtonMove(int mProgress)
+ {
+ ProgressBtn.Y = ProgressBtnY + levelSeekBar.NowProgressY;
+ ProgressBtn.Text = mProgress + "%";
+ }
+
+ /// <summary>
+ /// 娣诲姞杩涘害鎸夐挳
+ /// </summary>
+ private void InitProgressBtn(FrameLayout layout)
+ {
+ ProgressBtnY = levelSeekBar.Y - Application.GetMinReal(154);
+ ProgressBtn = new Button()
+ {
+ Y = ProgressBtnY,
+ Width = Application.GetMinReal(135),
+ Height = Application.GetMinReal(104),
+ UnSelectedImagePath = "Item/ProgressBubbles.png",
+ Visible = false,
+ Gravity = Gravity.CenterHorizontal,
+ TextSize = 14,
+ IsBold = true,
+ TextColor = ZigbeeColor.Current.GXCTextWhiteColor
+ };
+ layout.AddChidren(ProgressBtn);
}
#endregion
@@ -479,7 +536,6 @@
{
switchBtn.MouseUpEventHandler += Switch_MouseUpEvent;
collectionBtn.MouseUpEventHandler += Collection;
- moreBtn.MouseUpEventHandler += MoreEvent;
}
#endregion
@@ -494,13 +550,18 @@
private void Switch_MouseUpEvent(object sender, MouseEventArgs eventArgs)
{
switchBtn.IsSelected = !switchBtn.IsSelected;
+ StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
if (switchBtn.IsSelected == true)
{
dimmableLight.SwitchControl(1);
+ levelSeekBar.IsClickable = true;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
}
else
{
dimmableLight.SwitchControl(0);
+ levelSeekBar.IsClickable = false;
+ levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
}
}
@@ -513,8 +574,7 @@
/// </summary>
private void InitCollection()
{
- var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName);
- if (dev == null)
+ if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device) == false)
{
collectionBtn.IsSelected = false;
}
@@ -531,17 +591,16 @@
private void Collection(object sender, MouseEventArgs e)
{
//collection
- if (collectionBtn.IsSelected)
+ if ((sender as Button).IsSelected)
{
- Shared.Common.Room.Lists[0].DeleteDevice(device.FileName);
- collectionBtn.IsSelected = false;
+ UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device);
+ (sender as Button).IsSelected = false;
}
else
- {
- Shared.Common.Room.Lists[0].AddDevice(device.FileName);
- collectionBtn.IsSelected = true;
+ {
+ UserCenter.HdlRoomLogic.Current.AddLoveDevice(device);
+ (sender as Button).IsSelected = true;
}
- action?.Invoke();
}
#endregion
--
Gitblit v1.8.0