The .NET Command Pattern, Part 2: Listing 4

The Presentation ViewModel

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
 
namespace VSMCommandPatternUndo.ViewModel
{
    public class Presentation : INotifyPropertyChanged
    {
        private string _title;
        private string _presenter;
        private string _summary;
 
        public string Title 
        {
            get
            {
                return _title;
            }
            set
            {
                _title = value;
                OnNotifyPropertyChanged("Title");
            }
        }
        public string Presenter
        {
            get
            {
                return _presenter;
            }
            set
            {
                _presenter = value;
                OnNotifyPropertyChanged("Presenter");
            }
        }
        public string Summary
        {
            get
            {
                return _summary;
            }
            set
            {
                _summary = value;
                OnNotifyPropertyChanged("Summary");
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void OnNotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}

About the Author

Eric Vogel is a Senior Software Developer for Red Cedar Solutions Group in Okemos, Michigan. He is the president of the Greater Lansing User Group for .NET. Eric enjoys learning about software architecture and craftsmanship, and is always looking for ways to create more robust and testable applications. Contact him at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube