NotificationObject.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
namespace SC
{
/// <summary>
/// notification object base class
/// </summary>
public abstract class NotificationObject : INotifyPropertyChanged
{
/// <summary>
/// property changed handler
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// raise property changed handler
/// </summary>
/// <param name="propertyName">property name to raise</param>
protected virtual void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
/// <summary>
/// raise many property changed handler
/// </summary>
/// <param name="propertyNames">properties to raise</param>
protected void RaisePropertyChanged(params string[] propertyNames)
{
if (propertyNames == null)
{
throw new ArgumentNullException("propertyNames");
}
foreach (var propertyName in propertyNames)
{
this.RaisePropertyChanged(() => propertyName);
}
}
/// <summary>
/// Raises the <see cref="PropertyChanged"/> event using expression.
/// </summary>
/// <typeparam name="TP">Expression</typeparam>
/// <param name="property">Property</param>
protected void RaisePropertyChanged<T>(Expression<Func<T>> property)
{
var propertyInfo = (property.Body as MemberExpression).Member as PropertyInfo;
if (null == propertyInfo)
{
throw new ArgumentException("The lambda expression 'property' should point to a valid Property");
}
RaisePropertyChanged(propertyInfo.Name);
}
}
}
NotificationObject.cs的更多相关文章
- MVVM页面跳转 技巧性标记
刚学MVVM 百度了很多概念性的东西 也参考了网上的例子 基本有了了解 但是我发现 我做了一个登录页面以后 我跳转咋办呢? VM里面咋做跳转? 问了一下其他的群友得到了一些启发.感谢“上海*松” 我仅 ...
- WPF MVVM实例三
在没给大家讲解wpf mwm示例之前先给大家简单说下MVVM理论知识: WPF技术的主要特点是数据驱动UI,所以在使用WPF技术开发的过程中是以数据为核心的,WPF提供了数据绑定机制,当数据发生变化时 ...
- [C#] 剖析 AssemblyInfo.cs - 了解常用的特性 Attribute
剖析 AssemblyInfo.cs - 了解常用的特性 Attribute [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/5944391.html 序 ...
- Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结
Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结 1.1. 软件体系架构是沿着单机到 CS 架构,再到 BS 的三层架构甚至多层架构逐步发展过来的,关于 ...
- 从java文件和CS文件里查询方法使用次数工具
前几天,领导让我找一下老系统(Java)里getRemoteUser方法都哪个文件用了,package是什么,方法被调用了多少次,当时因为着急,所以,直接人工找的,但是以后要是再出现,人工找就太讨厌了 ...
- 关于 WP 开发中.xaml 与.xaml.cs 的关系
今天我们先来看一下在WP8.1开发中最长见到的几个文件之间的关系.比较论证,在看这个问题之前我们简单看看.NET平台其他两个不同的框架: Windows Forms 先看看Window Forms中的 ...
- .net 用户控件ascx.cs注册js脚本代码无效果
在.net web项目中碰到一个比较奇怪的问题,网上没找到解决方案,先自己mark一下 问题描述: 添加一个用户控件ascx,在后端.cs添加js注册脚本,执行后没有弹出框 注册脚本为: this.P ...
- DateHelper.cs日期时间操作辅助类C#
//==================================================================== //** Copyright © classbao.com ...
- 仅用aspx文件实现Ajax调用后台cs程序。(实例)
仅用aspx文件实现Ajax调用后台cs无刷新程序.(实例) 两个文件:aaa.aspx 和aaa.aspx.cs 一.aaa.aspx <script type="text/java ...
随机推荐
- 转:python socket编程详细介绍
Python 提供了两个基本的 socket 模块. 第一个是 Socket,它提供了标准的 BSD Sockets API. 第二个是 SocketServer, 它提供了服务器中心类,可以简化网络 ...
- 01分数规划POJ3621(最优比例生成环)
Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8218 Accepted: 2756 ...
- FAQ: c++ 函数名后添加 const void function1(int &id) const
说明这个函数不能修改这个类的成员变量!只能操作自己的参数和内部的范围变量! 括号内的&id,&表示这个变量和C# in和out是一样的,算是一个reference,可以更改值,要想不更 ...
- Python学习总结18:函数 参数篇
1. 判断函数是否可调用 >>> import math >>> x = 1 >>> y = math.sqrt >>> cal ...
- JSon_零基础_007_将JSon格式的"数组"字符串转换为Java对象"数组"
将JSon格式的"数组"字符串转换为Java对象"数组". 应用此技术从一个json对象字符串格式中得到一个java对应的对象. JSONObject是一个“n ...
- .NET 4.0 MemoryCache with SqlChangeMonitor
Summary There isn't a lot of documentation on the internet about how to use the SqlChangeMonitor wit ...
- paper 47 :Latex中文显示(转)
中文支持需要cjk-latex,总得来说中文可以使用GB和GBK两种字体,GBK需要从windows下copy *.ttc或*.ttf, GB字体则在linux下就用. 先说支持GB的中文显示,安装以 ...
- 夺命雷公狗ThinkPHP项目之----企业网站13之文章列表页的实现(主要是分页的实现)
列表页这个其实是比较简单的一个,直接遍历除数据即可: public function lists(){ //$mod = M("Article")->select(); // ...
- 夺命雷公狗---Thinkphp----8之栏目功能的分页显示
我们开始在列表页写我们的分页功能,我们直接将刚才取的列表页改写下即可: public function lists(){ //$type = M('Type')->select(); //$th ...
- PTPX的average power analysis
在average power analysis中,switching activity被分解为toggle rate和static probabilities两部分. annotation的sourc ...