No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

StaticObservable.cs

Description du code

StaticObservable.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. namespace be.gaudry.observer
  2. {
  3. /// <summary>
  4. /// Singleton used to add observable features into a class (the observer may not know the class, it must know only this).
  5. /// </summary>
  6. public class StaticObservable
  7. {
  8. #region singleton
  9. private static Observable instance = null;
  10. private static readonly object padlock = new object();
  11. private StaticObservable() { }
  12. /// <summary>
  13. ///
  14. /// </summary>
  15. private static Observable Instance
  16. {
  17. get
  18. {
  19. lock (padlock)
  20. {
  21. if (instance == null)
  22. {
  23. instance = new Observable();
  24. }
  25. return instance;
  26. }
  27. }
  28. }
  29. #endregion
  30.  
  31. #region observable methods
  32. /// <summary>
  33. /// Send a notification to all registerd obervers
  34. /// </summary>
  35. /// <param name="notification">notification to send</param>
  36. public static void notify(Notification notification)
  37. {
  38. StaticObservable.Instance.notify(notification);
  39. }
  40.  
  41. /// <summary>
  42. /// Add (register) an observer
  43. /// </summary>
  44. /// <param name="o">observer to add</param>
  45. public static void addObserver(IObserver o)
  46. {
  47. StaticObservable.Instance.addObserver(o);
  48. }
  49.  
  50. /// <summary>
  51. /// Remove an observer
  52. /// </summary>
  53. /// <param name="o">observer to remove</param>
  54. public static void removeObserver(IObserver o)
  55. {
  56. StaticObservable.Instance.removeObserver(o);
  57. }
  58. #endregion
  59.  
  60. #region static helper methods
  61.  
  62. /// <summary>
  63. /// store errors and not display it
  64. /// </summary>
  65. /// <param name="notification">notification to send</param>
  66. public static void hideErrors()
  67. {
  68. notify(new Notification(Notification.VERBOSE.hideErrors,null));
  69. }
  70.  
  71. /// <summary>
  72. /// display stored errors
  73. /// </summary>
  74. /// <param name="notification">notification to send</param>
  75. public static void showErrors()
  76. {
  77. notify(new Notification(Notification.VERBOSE.showErrors,null));
  78. }
  79.  
  80. /// <summary>
  81. /// lean stored errors and adopt normal behaviour
  82. /// </summary>
  83. /// <param name="notification">notification to send</param>
  84. public static void showNewErrors()
  85. {
  86. notify(new Notification(Notification.VERBOSE.showNewErrors,null));
  87. }
  88. #endregion
  89. }
  90. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/observer/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1714353967 29/04/2024 03:26:07
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/observer/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csIObserver.cs133 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csIObservable.cs790 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csObservable.cs1.5 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csNotification.cs4.92 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csStaticObservable.cs2.74 Ko31/10/2018 18:32:48-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-observer/StaticObservable.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.