日期:2014-05-17 浏览次数:21016 次
/// <summary>
/// 负责属性更改通知
/// </summary>
public class ObservableObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public virtual void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
private System.Timers.Timer DisplayTimer = new System.Timers.Timer(500);
AsyncOperation asyncOp;
bool Flg = false;
DateTime startDt = DateTime.Now;
private void Form1_Load(object sender, EventArgs e)
{
this.DisplayTimer.Elapsed += new System.Timers.ElapsedEventHandler(DisplayTimer_Elapsed);
this.asyncOp = AsyncOperationManager.CreateOperation(this);
}
private void DisplayTimer_Elapsed(object sender, EventArgs e)
{
Random rd = new Random();
this.asyncOp.Post((obj) =>