PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
C# | 45 lines | 25 code | 4 blank | 16 comment | 2 complexity | 04775420f5eb2dd0395fc19bdd71db4a 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. //===================================================================================
  17. using UIComposition.Modules.Project.Services;
  18. namespace UIComposition.Modules.Project
  19. {
  20. public class ProjectsListPresenter : IProjectsListPresenter
  21. {
  22. private readonly IProjectService projectService;
  23. readonly ProjectsListPresentationModel model;
  24. public ProjectsListPresenter(IProjectsListView view, IProjectService projectService)
  25. {
  26. this.View = view;
  27. this.projectService = projectService;
  28. this.model = new ProjectsListPresentationModel();
  29. this.model.PropertyChanged += this.model_PropertyChanged;
  30. view.Model = this.model;
  31. }
  32. void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
  33. {
  34. if (e.PropertyName == "EmployeeId")
  35. {
  36. model.Projects = this.projectService.RetrieveProjects(this.model.EmployeeId);
  37. }
  38. }
  39. public IProjectsListView View { get; set; }
  40. }
  41. }