using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone
|
{
|
/// <summary>
|
/// Icon控件的共通
|
/// </summary>
|
public class IconControlCommon : ButtonBase
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 是否启用点亮功能(默认不启用)
|
/// </summary>
|
public bool UseClickStatu = false;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// Icon控件的共通
|
/// </summary>
|
public IconControlCommon()
|
{
|
//这个事件是搞点亮特效的
|
this.ButtonDownClickEvent += this.Button_MouseDownEvent;
|
}
|
|
#endregion
|
|
#region ■ 控件点亮特效_______________________
|
|
/// <summary>
|
/// 单击按下事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
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);
|
}
|
|
/// <summary>
|
/// 设置处于选择状态时,显示的图标
|
/// </summary>
|
public void SetSelectPictrue()
|
{
|
this.IsSelected = true;
|
}
|
|
/// <summary>
|
/// 设置处于非选择状态时,显示的图标
|
/// </summary>
|
/// <param name="waitTime">追加变量:是否等待</param>
|
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
|
}
|
}
|