PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/PrismLibrary/Desktop/Prism.Tests/Mocks/MockViewsCollection.cs

#
C# | 55 lines | 33 code | 6 blank | 16 comment | 0 complexity | 27e6de492a44bb655718b95bd21fb9b1 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 System.Collections;
  18. using System.Collections.Generic;
  19. using System.Collections.ObjectModel;
  20. using System.Collections.Specialized;
  21. using Microsoft.Practices.Prism.Regions;
  22. namespace Microsoft.Practices.Prism.Tests.Mocks
  23. {
  24. class MockViewsCollection : IViewsCollection
  25. {
  26. public ObservableCollection<object> Items = new ObservableCollection<object>();
  27. public void Add(object view)
  28. {
  29. this.Items.Add(view);
  30. }
  31. public bool Contains(object value)
  32. {
  33. return Items.Contains(value);
  34. }
  35. public IEnumerator<object> GetEnumerator()
  36. {
  37. return Items.GetEnumerator();
  38. }
  39. IEnumerator IEnumerable.GetEnumerator()
  40. {
  41. return GetEnumerator();
  42. }
  43. public event NotifyCollectionChangedEventHandler CollectionChanged
  44. {
  45. add { Items.CollectionChanged += value; }
  46. remove { Items.CollectionChanged -= value; }
  47. }
  48. }
  49. }