public CheckersPlugin(IMessageDispatcher remote, IUIThreadDispatcher uiThreadDispatcher) { this._remote = remote; this._uiThreadDispatcher = uiThreadDispatcher; uiThreadDispatcher.BlockingInvoke(() => { game = new GameShape(); game.UserPlayed += (s, e) => { JObject body = new JObject(); body["humanMove"] = ((CheckerEventArg)e).moveDesc; _remote.Send("checkers.human_played_move", body); }; game.UserTouchedAgentChecker += (s, e) => { JObject body = new JObject(); body["howMany"] = ((UserTouchedAgentStuffEventArg)e).howManyTimes; _remote.Send("checkers.touched_agent_piece", body); }; pluginContainer = new Viewbox(); pluginContainer.Child = game; game.MakeTheBoardUnplayable(); }); _remote.RegisterReceiveHandler("checkers.agent_move", new MessageHandlerDelegateWrapper(x => PlayAgentMove(x))); _remote.RegisterReceiveHandler("checkers.reset", new MessageHandlerDelegateWrapper(x => game.ResetGame(_uiThreadDispatcher))); _remote.RegisterReceiveHandler("checkers.confirm_human_move", new MessageHandlerDelegateWrapper(x => game.ReceivedConfirmation())); _remote.RegisterReceiveHandler("checkers.playability", new MessageHandlerDelegateWrapper(x => SetPlayability(x))); }