当前位置: 首页>>代码示例>>C#>>正文


C# ISubject.AddObserver方法代码示例

本文整理汇总了C#中ISubject.AddObserver方法的典型用法代码示例。如果您正苦于以下问题:C# ISubject.AddObserver方法的具体用法?C# ISubject.AddObserver怎么用?C# ISubject.AddObserver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISubject的用法示例。


在下文中一共展示了ISubject.AddObserver方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BicycleObserver

        public BicycleObserver(Label displayLabel, ISubject bicycleSubject)
        {
            this.displayLabel = displayLabel;

            RPM = 0;
            currentValue = 0;

            bicycleSubject.AddObserver(this);
        }
开发者ID:hdewattignar,项目名称:IN710dewahm1,代码行数:9,代码来源:BicycleObserver.cs

示例2: BicycleObserver

        /// <summary>
        /// Constructor - initialises the label responsible for displaying 
        /// computed results, and the subject which will push information
        /// to the observers.
        /// </summary>
        /// <param name="displayLabel">The label to display computed results.</param>
        /// <param name="bikeSubject">The subject to push notifications to it's observers.</param>
        public BicycleObserver(Label displayLabel, ISubject bikeSubject)
        {
            this.displayLabel = displayLabel;
            this.bikeSubject = bikeSubject;

            currentRPM = 0;
            currentComputedValue = 0.0;

            ///<summary>
            ///Ensuring that the observer is added to the subject
            ///on creation.
            ///</summary>
            bikeSubject.AddObserver(this);
        }
开发者ID:rattfieldnz,项目名称:BicycleObserverPatternApp,代码行数:21,代码来源:BicycleObserver.cs

示例3: Observer

        public Observer(ListBox display, ISubject subject)
        {
            this.display = display;
            this.subject = subject;

            // IMPORTANT
            subject.AddObserver(this);
        }
开发者ID:rNdm74,项目名称:C-,代码行数:8,代码来源:Observer.cs

示例4: Observer

        public Observer(ListBox display, ISubject subject)
        {
            this.display = display;
            this.subject = subject;

            temp = humidity = bPressure = 0;

            // IMPORTANT
            subject.AddObserver(this);
        }
开发者ID:rNdm74,项目名称:C-,代码行数:10,代码来源:Observer.cs

示例5: Observer

 public Observer(ISubject subject, string name, string gap)
 {
     this.subject = subject;
     this.name = name;
     this.gap = gap;
     subject.AddObserver(this);
 }
开发者ID:LukinEgor,项目名称:Design-Pattern,代码行数:7,代码来源:Observer.cs

示例6: Observer

        public Observer(Label displayLabel, ISubject bikeSubject)
        {
            this.displayLabel = displayLabel;
            this.bikeSubject = bikeSubject;

            currentRPM = 0;
            currentComputedValue = 0;
            // IMPORTANT
            bikeSubject.AddObserver(this);
        }
开发者ID:rNdm74,项目名称:C-,代码行数:10,代码来源:Observer.cs

示例7: FancyMP3Display

 public FancyMP3Display(MP3Player player)
 {
     this.player = player;
     player.AddObserver(this);
 }
开发者ID:Schroefdop,项目名称:Design-Patterns-opdrachten,代码行数:5,代码来源:FancyMP3Display.cs

示例8: SimpleMP3Display

 public SimpleMP3Display(MP3Player player)
 {
     this.player = player;
     player.AddObserver(this);
 }
开发者ID:Schroefdop,项目名称:Design-Patterns-opdrachten,代码行数:5,代码来源:SimpleMP3Display.cs


注:本文中的ISubject.AddObserver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。