From 4f0ab0ad21ce450b7856d50f98322a7899361386 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 22 九月 2020 10:30:01 +0800
Subject: [PATCH] 不要下载这个备份
---
ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs | 71 ++++++++++++++++++++++-------------
1 files changed, 44 insertions(+), 27 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs
index 7290a4b..c674940 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs
@@ -8,7 +8,7 @@
/// <summary>
/// 鍦烘櫙鍗$墖鎺т欢
/// </summary>
- public class SceneCardControl : FrameLayoutControl
+ public class SceneCardControl : FrameLayoutStatuControl
{
#region 鈻� 鍙橀噺澹版槑___________________________
@@ -51,15 +51,16 @@
public SceneCardControl()
{
//鍥剧墖鐪熷疄瀹藉害+鍥剧墖鑷韩宸﹀彸绌虹櫧
- this.Width = Application.GetMinRealAverage(458 + 14 * 2);
+ this.Width = HdlControlLogic.Current.GetPictrueRealSize(458 + 14 * 2);
//鍥剧墖楂樺害+闃村奖
- this.Height = Application.GetMinRealAverage(305 + 43);
+ this.Height = HdlControlLogic.Current.GetPictrueRealSize(305 + 43);
//鍙栨秷鐐瑰嚮鐗规晥
this.UseClickStatu = false;
this.ButtonClickEvent += (sender, e) =>
{
//璋冪敤鍦烘櫙
+ this.CanClick = false;
this.SetSceneAction();
};
}
@@ -77,33 +78,33 @@
//鍦烘櫙鍥剧墖鎺т欢
this.btnScenePic = new ImageView();
- btnScenePic.X = Application.GetMinRealAverage(14);
- btnScenePic.Width = Application.GetMinRealAverage(458);
- btnScenePic.Height = Application.GetMinRealAverage(305);
- btnScenePic.Radius = (uint)Application.GetMinRealAverage(17);
+ btnScenePic.X = HdlControlLogic.Current.GetPictrueRealSize(14);
+ btnScenePic.Width = HdlControlLogic.Current.GetPictrueRealSize(458);
+ btnScenePic.Height = HdlControlLogic.Current.GetPictrueRealSize(305);
+ btnScenePic.Radius = (uint)Application.GetRealHeight(17);
this.AddChidren(btnScenePic, ChidrenBindMode.NotBind);
//鍦烘櫙鑳屾櫙鍥炬帶浠�
this.btnSceneBackGroud = new PicViewControl(this.Width, this.Height, false);
btnSceneBackGroud.UnSelectedImagePath = "Scene/Background.png";
- this.AddChidren(btnSceneBackGroud, ChidrenBindMode.BindEventOnly);
+ this.AddChidren(btnSceneBackGroud, ChidrenBindMode.BindEvent);
//寤舵椂鏃堕棿鏄剧ず鎺т欢
- this.btnTimeView = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false);
- btnTimeView.X = Application.GetMinRealAverage(37);
- btnTimeView.Y = Application.GetMinRealAverage(10);
+ this.btnTimeView = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(280), HdlControlLogic.Current.GetPictrueRealSize(63), false);
+ btnTimeView.X = HdlControlLogic.Current.GetPictrueRealSize(37);
+ btnTimeView.Y = HdlControlLogic.Current.GetPictrueRealSize(10);
btnTimeView.TextColor = 0xffffb400;
btnTimeView.IsBold = true;
if (i_scene.SceneDelayTime > 0)
{
btnTimeView.Text= this.GetTimeString(i_scene.SceneDelayTime, hourText, minuText, secondText);
}
- this.AddChidren(btnTimeView, ChidrenBindMode.BindEventOnly);
+ this.AddChidren(btnTimeView, ChidrenBindMode.BindEvent);
//鏃堕棿鍥炬爣鎺т欢
this.btnTimeIcon = new IconViewControl(63);
- btnTimeIcon.X = Application.GetMinRealAverage(37);
- btnTimeIcon.Y = Application.GetMinRealAverage(20);
+ btnTimeIcon.X = HdlControlLogic.Current.GetPictrueRealSize(37);
+ btnTimeIcon.Y = HdlControlLogic.Current.GetPictrueRealSize(20);
btnTimeIcon.UnSelectedImagePath = "Item/Time.png";
this.AddChidren(btnTimeIcon, ChidrenBindMode.NotBind);
if (i_scene.SceneDelayTime > 0)
@@ -125,19 +126,24 @@
timeSelect.Init();
timeSelect.TimeAction = (time) =>
{
+ //閫夋嫨鐨勬槸涓嶅紑鍚�
+ if (time == 0) { return; }
+
i_scene.SceneDelayTime = time;
//鏃堕棿鍥炬爣涓嶆樉绀�
this.btnTimeIcon.Visible = false;
//鏄剧ず鍓╀綑鐨勬椂闂�
this.btnTimeView.Text = this.GetTimeString(time, hourText, minuText, secondText);
+ //閫夋嫨寤舵椂鏃�,闇�瑕佸埛鏂颁富椤�
+ UserView.UserPage.Instance.RefreshAllForm = true;
};
};
//鏀惰棌鎺т欢
var btnCollect = new IconViewControl(107);
- btnCollect.X = Application.GetMinRealAverage(350);
- btnCollect.Y = Application.GetMinRealAverage(12);
+ btnCollect.X = HdlControlLogic.Current.GetPictrueRealSize(350);
+ btnCollect.Y = HdlControlLogic.Current.GetPictrueRealSize(12);
btnCollect.UnSelectedImagePath = "Item/Collection1.png";
btnCollect.SelectedImagePath = "Item/CollectionSelected1.png";
this.AddChidren(btnCollect, ChidrenBindMode.NotBind);
@@ -150,7 +156,7 @@
{
//鍙栨秷鏀惰棌
HdlSceneLogic.Current.DeleteLoveScene(i_scene);
- if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
+ if (HdlRoomLogic.Current.NowMainPageRoom.IsLove == true)
{
//濡傛灉褰撳墠鎴块棿鏄垜鐨勫枩鐖辩殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑浜嬩欢
this.CardNeedRemoveEvent?.Invoke();
@@ -164,12 +170,12 @@
};
//鍦烘櫙鍚嶇О鎺т欢
- this.btnSceneName = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false);
- btnSceneName.X = Application.GetMinRealAverage(37);
- btnSceneName.Y = Application.GetMinRealAverage(236);
+ this.btnSceneName = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(280), HdlControlLogic.Current.GetPictrueRealSize(63), false);
+ btnSceneName.X = HdlControlLogic.Current.GetPictrueRealSize(37);
+ btnSceneName.Y = HdlControlLogic.Current.GetPictrueRealSize(236);
btnSceneName.IsBold = true;
btnSceneName.TextColor = UserCenterColor.Current.White;
- this.AddChidren(btnSceneName, ChidrenBindMode.BindEventOnly);
+ this.AddChidren(btnSceneName, ChidrenBindMode.BindEvent);
//鍒锋柊鎺т欢鐘舵��
this.RefreshControlInfo(i_scene);
@@ -195,7 +201,13 @@
var result = await HdlSceneLogic.Current.ControlScene(scene);
if (result == false)
{
+ this.CanClick = true;
return;
+ }
+ if (scene.SceneDelayTime > 0)
+ {
+ //璋冪敤鏈夊欢鏃剁殑鍦烘櫙,闇�瑕佸埛鏂颁富椤�
+ UserView.UserPage.Instance.RefreshAllForm = true;
}
//淇敼鏃堕棿
scene.RemainTime = scene.SceneDelayTime;
@@ -219,9 +231,11 @@
//鍒锋柊鍥剧墖
if (i_scene.IconPathType == 0)
{
- if (this.btnScenePic.ImagePath != i_scene.IconPath)
+ //涓婚〉鐨勫満鏅崱鐗囩敤鐨勬槸鍙﹀鐨勫浘
+ string newPath = i_scene.IconPath.Replace("SceneIcon", "SceneCardIcon");
+ if (this.btnScenePic.ImagePath != newPath)
{
- this.btnScenePic.ImagePath = i_scene.IconPath;
+ this.btnScenePic.ImagePath = newPath;
}
}
else
@@ -234,6 +248,7 @@
}
//寮�鍚欢鏃跺�掕鏃剁壒鏁�
+ this.CanClick = false;
this.StartRemainTimeApreal(i_scene);
}
@@ -249,6 +264,7 @@
{
if (i_scene.RemainTime <= 0)
{
+ this.CanClick = true;
return;
}
int remainTine = i_scene.RemainTime;
@@ -269,20 +285,21 @@
while (remainTine > 0 && this.Parent != null)
{
System.Threading.Thread.Sleep(1000);
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
this.btnTimeView.Text = this.GetTimeString(remainTine, hourText, minuText, secondText);
- });
+ }, ShowErrorMode.NO);
remainTine--;
}
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鍊掕鏃剁粨鏉熸椂锛屾椂闂村浘鏍囨樉绀�
this.btnTimeIcon.Visible = true;
this.btnTimeView.Text = string.Empty;
//鐩存帴寮�鍚疞oading鐗规晥
this.StartLoadingApreal();
- });
+ this.CanClick = true;
+ }, ShowErrorMode.NO);
})
{ IsBackground = true }.Start();
}
--
Gitblit v1.8.0