2 Star 5 Fork 3

彭添/SerialPlot_PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Observable.cs 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
彭添 提交于 2015-08-13 01:36 . FirstSync
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace 帆板仪表盘
{
public class Observable : INotifyPropertyChanged
{
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
public void RaisePropertyChanged(string property)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(property));
}
}
protected void RaisePropertyChanged(Expression<Func<object>> expression)
{
var lambda = expression as LambdaExpression;
MemberExpression memberExpression;
if (lambda.Body is UnaryExpression)
{
var unaryExpression = lambda.Body as UnaryExpression;
memberExpression = unaryExpression.Operand as MemberExpression;
}
else
{
memberExpression = lambda.Body as MemberExpression;
}
if (memberExpression != null)
{
var propertyInfo = memberExpression.Member as PropertyInfo;
if (propertyInfo != null)
RaisePropertyChanged(propertyInfo.Name);
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pengtianabc/SerialPlot_PT.git
git@gitee.com:pengtianabc/SerialPlot_PT.git
pengtianabc
SerialPlot_PT
SerialPlot_PT
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385