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


C# IEventPublisher.Subscribe方法代码示例

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


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

示例1: MovesHistory

 public MovesHistory(IEventPublisher eventPublisher)
 {
     _eventPublisher = eventPublisher;
     _eventPublisher.Subscribe<PhutballGameStarted>(OnGameStart);
     _eventPublisher.Subscribe<PhutballGameEnded>(OnGameEnd);
     _done.CollectionChanged += RaiseHistoryChanged;
     _undone.CollectionChanged += RaiseHistoryChanged;
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:8,代码来源:MovesHistory.cs

示例2: CheatsPresenter

 public CheatsPresenter(
     IEventPublisher eventPublisher,
     BestMoveApplier bestMoveApplier,
     MoveStrategiesCollection moveStrategies
     )
 {
     MoveStrategies = moveStrategies;
     _eventPublisher = eventPublisher;
     _bestMoveApplier = bestMoveApplier;
     _eventPublisher.Subscribe<PhutballGameStarted>(Enable);
     _eventPublisher.Subscribe<PhutballGameEnded>(Disable);
     _eventPublisher.Subscribe<ComputerStartedMoving>(Disable);
     _eventPublisher.Subscribe<ComputerStopedMoving>(Enable);
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:14,代码来源:CheatsPresenter.cs

示例3: PhutballGameState

 public PhutballGameState(
     IEventPublisher eventPublisher,
     IPhutballBoard phutballBoard,
     IPlayersState playersState,
     BestMoveApplier bestMoveApplier,
     Func<IHandlePlayerMoves> handlePlayerMovesFactory)
 {
     _currentState = PhutballGameStateEnum.NotStarted;
     _eventPublisher = eventPublisher;
     _phutballBoard = phutballBoard;
     _playersState = playersState;
     _bestMoveApplier = bestMoveApplier;
     _handlePlayerMovesFactory = handlePlayerMovesFactory;
     _handlePlayerMoves = handlePlayerMovesFactory();
     _eventPublisher.Subscribe<PlayerWonEvent>((e)=> CurrentPlayerWon());
     _eventPublisher.Subscribe<PlayerOnTheMoveChanged>(OnPlayerOnTheMoveChanged);
     _eventPublisher.Subscribe<ComputerStartedMoving>((e)=> LongRunningProcess.Clear());
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:18,代码来源:PhutballGameState.cs

示例4: GameStatePresenter

 public GameStatePresenter(PhutballGameState gameState,
     IEventPublisher eventPublisher)
 {
     _gameState = gameState;
     _eventPublisher = eventPublisher;
     _timer = new DispatcherTimer()
                  {
                      Interval = TimeSpan.FromMilliseconds(200),
                      IsEnabled = false
                  };
     _timer.Tick += UpdatePlayersTimes;
     _eventPublisher.Subscribe<PlayerWonEvent>(OnCurrentPlayerWon);
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:13,代码来源:GameStatePresenter.cs

示例5: PhutballBoardModel

 public PhutballBoardModel(IPhutballBoard phutballBoard, IEventPublisher eventPublisher, IPhutballOptions phutballOptions)
 {
     _phutballBoard = phutballBoard;
     _eventPublisher = eventPublisher;
     _phutballOptions = phutballOptions;
     _eventPublisher.Subscribe<PhutballBoardInitialized>(HandleGameInitialized);
     _eventPublisher.Subscribe<PhutballGameStarted>(HandleGameStart);
     _eventPublisher.Subscribe<PhutballGameEnded>(HandleGameEnded);
     _eventPublisher.Subscribe<ComputerStartedMoving>(m=> IsEnabled = false);
     _eventPublisher.Subscribe<ComputerStopedMoving>(m=> IsEnabled = true);
     _eventPublisher.Subscribe<PhutballGameFieldsChanged>(HandleGameFieldsChanged);
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:12,代码来源:PhutballBoardModel.cs

示例6: MovesHistoryPresenter

 public MovesHistoryPresenter(MovesHistory movesHistory, IEventPublisher eventPublisher)
 {
     _movesHistory = movesHistory;
     _eventPublisher = eventPublisher;
     _eventPublisher.Subscribe<MovesHistoryChanged>(OnMovesHistoryChanged);
 }
开发者ID:wobuzhudao,项目名称:Phutball,代码行数:6,代码来源:MovesHistoryPresenter.cs


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