using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone
{
///
/// Icon控件的共通
///
public class IconControlCommon : ButtonBase
{
#region ■ 变量声明___________________________
///
/// 是否启用点亮功能(默认不启用)
///
public bool UseClickStatu = false;
#endregion
#region ■ 初始化_____________________________
///
/// Icon控件的共通
///
public IconControlCommon()
{
//这个事件是搞点亮特效的
this.ButtonDownClickEvent += this.Button_MouseDownEvent;
}
#endregion
#region ■ 控件点亮特效_______________________
///
/// 单击按下事件
///
///
///
private void Button_MouseDownEvent(object sender, MouseEventArgs e)
{
if (this.UseClickStatu == false || string.IsNullOrEmpty(this.SelectedImagePath) == true)
{
//永久移除
this.ButtonDownClickEvent -= Button_MouseDownEvent;
return;
}
if (base.CanClick == false || this.IsSelected == true)
{
//控件不能点击,或者当前处于选择状态,则不能触发
return;
}
//设置处于选择状态时,显示的图标
this.SetSelectPictrue();
//设置处于非选择状态时,显示的图标
this.SetUnSelectPictrue(true);
}
///
/// 设置处于选择状态时,显示的图标
///
public void SetSelectPictrue()
{
this.IsSelected = true;
}
///
/// 设置处于非选择状态时,显示的图标
///
/// 追加变量:是否等待
public void SetUnSelectPictrue(bool waitTime)
{
if (waitTime == false)
{
HdlThreadLogic.Current.RunMain(() =>
{
//设置不选择状态
this.IsSelected = false;
});
}
else
{
HdlThreadLogic.Current.RunThread(() =>
{
System.Threading.Thread.Sleep(HdlControlResourse.StatuChangedWaitTime);
HdlThreadLogic.Current.RunMain(() =>
{
//设置不选择状态
this.IsSelected = false;
});
});
}
}
#endregion
}
}