public void SetupAsServer() { TournamentManager = new RoundRobinTournamentManager(); XmppHost = new XmppTournamentManagerHost(TournamentManager, XmppConnection); XmppConnection = XmppHost.Connection; SetupErrrorHandling(); IsServer = true; }
public CreateTournamentViewModel(Dispatcher dispatcher) { _dispatcher = dispatcher; _xmppHost = ((App)App.Current).XmppHost; _gameController = ServiceLocator.Current.GetInstance<GameController>(); StartTournamentCommand = new RelayCommand(StartTournament); TournamentTypeListInternal.Add(new Option<string>("Round Robin", "RoundRobin")); _xmppHost.PlayerRegistered += (sender, e) => { _dispatcher.BeginInvoke(() => { RegisteredPlayerListInternal.Add(new Option<Jid>(e.User.Bare, e.User)); UpdateCanStartTournament(); }); }; }
public void SetupAsPlayer() { Func<IPlayerBot> createNewBotFunc = () => { //TODO: Create your bot here return new SimpleBot(); }; XmppHost = new XmppPlayerBotHost(createNewBotFunc, XmppConnection); XmppConnection = XmppHost.Connection; SetupErrrorHandling(); IsServer = false; }
public MainViewModel(Dispatcher dispatcher) { _dispatcher = dispatcher; _botHost = ((App)App.Current).XmppHost; _botHost.RegistrationComplete += RegistrationCompleteHandler; OpenXmppLogViewCommand = new RelayCommand(OpenXmppLogView, true); ExitApplicationCommand = new RelayCommand(ExitApplication, true); WindowTitle = "RPS - Connected as " + _botHost.Connection.MyJID.Bare; _gameController = ServiceLocator.Current.GetInstance<GameController>(); if (((App)App.Current).IsServer) _gameController.ShowCreateTournamentView(); else _gameController.ShowRegisterView(); }
public TournamentViewModel(Dispatcher dispatcher) { _dispatcher = dispatcher; _xmppHost = ((App)App.Current).XmppHost; _xmppHost.TurnCompleted += new EventHandler<TurnCompletedReceivedEventArgs>(TurnCompletedEventHandler); _xmppHost.TournamentStarted += TournamentStartedHandler; ShowTournamentWait = true; ShowTournamentList = false; if (((App)App.Current).IsServer) { ShowTournamentList = true; ShowTournamentWait = false; } }