| | |
| | | private RelativeLayout rlUnlock; |
| | | private ImageView imgUnlock; |
| | | private TextView tvUnlock; |
| | | private System.Threading.Thread thread = null; |
| | | |
| | | public MonitorFragment(VideoPhone phone) |
| | | { |
| | |
| | | |
| | | //更新开锁按钮状态 |
| | | 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) |
| | |
| | | // |
| | | if (v.Equals(rlUnlock)) |
| | | { |
| | | unlock(); |
| | | if (mPhone != null) |
| | | unlock(); |
| | | } |
| | | else if (v.Equals(rlScreenshot)) |
| | | { |
| | |
| | | string error = e.Message; |
| | | } |
| | | } |
| | | |
| | | public override void OnDestroy()
|
| | | {
|
| | | base.OnDestroy();
|
| | |
|
| | | if (thread != null)
|
| | | { |
| | | try
|
| | | {
|
| | | thread.Interrupt();
|
| | | }
|
| | | catch { } |
| | | thread = null; |
| | | }
|
| | | } |
| | | } |
| | | } |