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

/tags/stable-1.1.2/Client/Settings/SettingPropertyGridObject.cs

#
C# | 63 lines | 43 code | 12 blank | 8 comment | 2 complexity | 0eeecaf9d7bf2caa32d684880f99ea4b MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. //-----------------------------------------------------------------------
  2. // <copyright>
  3. // Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
  4. //
  5. // This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
  6. // See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
  7. // </copyright>
  8. //-----------------------------------------------------------------------
  9. using System;
  10. using System.Collections;
  11. using System.ComponentModel;
  12. using Microsoft.Web.Management.Client;
  13. using Microsoft.Web.Management.Client.Win32;
  14. namespace Web.Management.PHP.Settings
  15. {
  16. internal class SettingPropertyGridObject : PropertyGridObject
  17. {
  18. public SettingPropertyGridObject(ModulePropertiesPage page)
  19. : this(page, false)
  20. {
  21. }
  22. public SettingPropertyGridObject(ModulePropertiesPage page, bool readOnly)
  23. : base(page, readOnly)
  24. {
  25. }
  26. protected override System.ComponentModel.PropertyDescriptorCollection GetProperties(Attribute[] attributes)
  27. {
  28. PropertyDescriptorCollection props = base.GetProperties(attributes);
  29. Type thisType = GetType();
  30. ArrayList properties = new ArrayList();
  31. foreach (PropertyDescriptor prop in props)
  32. {
  33. AttributeCollection collection = prop.Attributes;
  34. SettingDisplayNameAttribute displayNameAttribute =
  35. (SettingDisplayNameAttribute)(collection[typeof(SettingDisplayNameAttribute)]);
  36. if (displayNameAttribute != null)
  37. {
  38. DisplayNameAttribute newDisplayNameAttribute =
  39. GetDisplayNameAttribute(displayNameAttribute.FriendlyName, displayNameAttribute.ConfigPropertyName);
  40. properties.Add(TypeDescriptor.CreateProperty(thisType, prop, newDisplayNameAttribute));
  41. }
  42. else
  43. {
  44. properties.Add(prop);
  45. }
  46. }
  47. props = new PropertyDescriptorCollection((PropertyDescriptor[])properties.ToArray(typeof(PropertyDescriptor)));
  48. return props;
  49. }
  50. }
  51. }