The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ RefreshPropertiesAttribute

  1. //------------------------------------------------------------------------------
  2. // <copyright file="RefreshPropertiesAttribute.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. /*
  16. */
  17. namespace System.ComponentModel
  18. {
  19.     using System.Security.Permissions;
  20.    
  21.     /// <devdoc>
  22.     /// <para> Specifies how a designer refreshes when the property value is changed.</para>
  23.     /// </devdoc>
  24.     [AttributeUsage(AttributeTargets.All)]
  25.     public sealed class RefreshPropertiesAttribute : Attribute
  26.     {
  27.        
  28.         /// <devdoc>
  29.         /// <para>
  30.         /// Indicates all properties should
  31.         /// be refreshed if the property value is changed. This field is
  32.         /// read-only.
  33.         /// </para>
  34.         /// </devdoc>
  35.         public static readonly RefreshPropertiesAttribute All = new RefreshPropertiesAttribute(RefreshProperties.All);
  36.        
  37.         /// <devdoc>
  38.         /// <para>
  39.         /// Indicates all properties should
  40.         /// be invalidated and repainted if the
  41.         /// property value is changed. This field is read-only.
  42.         /// </para>
  43.         /// </devdoc>
  44.         public static readonly RefreshPropertiesAttribute Repaint = new RefreshPropertiesAttribute(RefreshProperties.Repaint);
  45.        
  46.         /// <devdoc>
  47.         /// <para>
  48.         /// Indicates that by default
  49.         /// no
  50.         /// properties should be refreshed if the property value
  51.         /// is changed. This field is read-only.
  52.         /// </para>
  53.         /// </devdoc>
  54.         public static readonly RefreshPropertiesAttribute Default = new RefreshPropertiesAttribute(RefreshProperties.None);
  55.        
  56.         private RefreshProperties refresh;
  57.        
  58.         /// <devdoc>
  59.         /// </devdoc>
  60.         /// <internalonly/>
  61.         public RefreshPropertiesAttribute(RefreshProperties refresh)
  62.         {
  63.             this.refresh = refresh;
  64.         }
  65.        
  66.         /// <devdoc>
  67.         /// <para>
  68.         /// Gets or sets
  69.         /// the refresh properties for the member.
  70.         /// </para>
  71.         /// </devdoc>
  72.         public RefreshProperties RefreshProperties {
  73.             get { return refresh; }
  74.         }
  75.        
  76.         /// <devdoc>
  77.         /// <para>
  78.         /// Overrides object's Equals method.
  79.         /// </para>
  80.         /// </devdoc>
  81.         public override bool Equals(object value)
  82.         {
  83.             if (value is RefreshPropertiesAttribute) {
  84.                 return (((RefreshPropertiesAttribute)value).RefreshProperties == refresh);
  85.             }
  86.             return false;
  87.         }
  88.        
  89.         /// <devdoc>
  90.         /// <para>
  91.         /// Returns the hashcode for this object.
  92.         /// </para>
  93.         /// </devdoc>
  94.         public override int GetHashCode()
  95.         {
  96.             return base.GetHashCode();
  97.         }
  98.        
  99.         /// <devdoc>
  100.         /// <para>Gets a value indicating whether the current attribute is the default.</para>
  101.         /// </devdoc>
  102.         public override bool IsDefaultAttribute()
  103.         {
  104.             return this.Equals(Default);
  105.         }
  106.     }
  107. }

Developer Fusion