From 9cc8fd11b13813adbdd3c6c31554e5c0bebf4026 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 21 八月 2020 19:53:49 +0800 Subject: [PATCH] 发布到商店的版本 --- ZigbeeApp/GateWay.Droid/FengLinVideo/Forms/MonitorFragment.cs | 73 ++++++++++++++++++++++++++++-------- 1 files changed, 56 insertions(+), 17 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/FengLinVideo/Forms/MonitorFragment.cs b/ZigbeeApp/GateWay.Droid/FengLinVideo/Forms/MonitorFragment.cs index 1afe637..26311cf 100755 --- a/ZigbeeApp/GateWay.Droid/FengLinVideo/Forms/MonitorFragment.cs +++ b/ZigbeeApp/GateWay.Droid/FengLinVideo/Forms/MonitorFragment.cs @@ -28,6 +28,7 @@ private RelativeLayout rlUnlock; private ImageView imgUnlock; private TextView tvUnlock; + private System.Threading.Thread thread = null; public MonitorFragment(VideoPhone phone) { @@ -89,22 +90,44 @@ //鏇存柊寮�閿佹寜閽姸鎬� private void updataUnlockState() - { - //寮�閿佹垚鍔燂紝15绉掑唴涓嶇粰鍐嶇偣鍑绘寜閽� - rlUnlock.Enabled = false; - imgUnlock.SetImageResource(Resource.Drawable.unlock_disable); - tvUnlock.SetTextColor(new Color(Activity.GetColor(Resource.Color.color_disable))); - - new System.Threading.Thread(() => - { - System.Threading.Thread.Sleep(15 * 1000); - Activity.RunOnUiThread(() => - { - rlUnlock.Enabled = true; - imgUnlock.SetImageResource(Resource.Drawable.unlock); - tvUnlock.SetTextColor(new Color(Activity.GetColor(Resource.Color.text_color))); - }); - }).Start(); + { + try + { + //寮�閿佹垚鍔燂紝15绉掑唴涓嶇粰鍐嶇偣鍑绘寜閽� + rlUnlock.Enabled = false; + imgUnlock.SetImageResource(Resource.Drawable.unlock_disable); + tvUnlock.SetTextColor(new Color(Activity.GetColor(Resource.Color.color_disable))); + if (thread != null) + { + try + { + thread.Interrupt(); + } + catch { } + thread = null; + } + thread = new System.Threading.Thread(() => + { + try + { + System.Threading.Thread.Sleep(15 * 1000); + Activity.RunOnUiThread(() => + { + try + { + rlUnlock.Enabled = true; + imgUnlock.SetImageResource(Resource.Drawable.unlock); + tvUnlock.SetTextColor(new Color(Activity.GetColor(Resource.Color.text_color))); + } + catch { } + }); + } + catch { } + }); + + thread.Start(); + } + catch { } } public void OnClick(View v) @@ -112,7 +135,8 @@ // if (v.Equals(rlUnlock)) { - unlock(); + if (mPhone != null) + unlock(); } else if (v.Equals(rlScreenshot)) { @@ -194,5 +218,20 @@ string error = e.Message; } } + + public override void OnDestroy() + { + base.OnDestroy(); + + if (thread != null) + { + try + { + thread.Interrupt(); + } + catch { } + thread = null; + } + } } } -- Gitblit v1.8.0