本文整理汇总了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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例6: MovesHistoryPresenter
public MovesHistoryPresenter(MovesHistory movesHistory, IEventPublisher eventPublisher)
{
_movesHistory = movesHistory;
_eventPublisher = eventPublisher;
_eventPublisher.Subscribe<MovesHistoryChanged>(OnMovesHistoryChanged);
}