PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/V2.2/trunk/Quickstarts/UI Composition/ViewDiscovery/Desktop/UIComposition.Modules.Project/Views/ProjectsListView/ProjectsListPresentationModel.cs

#
C# | 74 lines | 50 code | 8 blank | 16 comment | 6 complexity | cd999ec45625aa4c3918221b0ed5c0a9 MD5 | raw file
 1//===================================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
 4//===================================================================================
 5// Copyright (c) Microsoft Corporation.  All rights reserved.
 6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 9// FITNESS FOR A PARTICULAR PURPOSE.
10//===================================================================================
11// The example companies, organizations, products, domain names,
12// e-mail addresses, logos, people, places, and events depicted
13// herein are fictitious.  No association with any real company,
14// organization, product, domain name, email address, logo, person,
15// places, or events is intended or should be inferred.
16//===================================================================================
17using System.Collections.ObjectModel;
18using System.ComponentModel;
19
20namespace UIComposition.Modules.Project
21{
22
23    public class ProjectsListPresentationModel : INotifyPropertyChanged
24    {
25        private int employeeId;
26        private ObservableCollection<BusinessEntities.Project> projects;
27
28        public event PropertyChangedEventHandler PropertyChanged;
29
30        public ObservableCollection<BusinessEntities.Project> Projects
31        {
32            get
33            {
34                return this.projects;
35            }
36            set
37            {
38                if (this.projects != value)
39                {
40                    this.projects = value;
41                    this.OnPropertyChanged("Projects");
42                }
43            }
44        }
45
46        public int EmployeeId
47        {
48            get
49            {
50                return this.employeeId;
51            }
52            set
53            {
54                if (this.employeeId != value)
55                {
56                    this.employeeId = value;
57                    this.OnPropertyChanged("EmployeeId");
58                }
59            }
60        }
61
62        public static string HeaderInfo
63        {
64            get { return "Current Projects"; }
65        }
66
67        private void OnPropertyChanged(string propertyName)
68        {
69            PropertyChangedEventHandler Handler = this.PropertyChanged;
70            if (Handler != null) Handler(this, new PropertyChangedEventArgs(propertyName));
71        }
72    }
73}
74