Ejemplo n.º 1
0
        public CreateLobbyViewModel()
        {
            IsPageEnabled = true;

            NumberOfColours = new ObservableCollection <int>();
            SetNumberOfColours(2);

            NumberOfPlayers = new int[MAX_PLAYERS - 1];
            for (int i = 0; i < MAX_PLAYERS - 1; i++)
            {
                NumberOfPlayers[i] = i + 2;
            }

            ReadyCommand      = new CommandHandler(Ready);
            CancelCommand     = new CommandHandler(Cancel);
            StartCommand      = new CommandHandler(Start);
            BackCommand       = new CommandHandler(Back);
            DisconnectCommand = new CommandHandler(Disconnect);

            bots = new Dictionary <BotDifficulty, int>();
            bots[BotDifficulty.EASY]   = 0;
            bots[BotDifficulty.MEDIUM] = 0;
            bots[BotDifficulty.HARD]   = 0;

            IncreaseBotCommand = new ParameterizedCommandHandler(IncreaseBot, IsIncreaseBotEnabled);
            DecreaseBotCommand = new ParameterizedCommandHandler(DecreaseBot, IsDecreaseBotEnabled);

            connectedPlayerAdapter = new List <Player>();
            connectedPlayers       = new ObservableCollection <Player>();

            lobbyServer = ClientProxyManager.Instance;
        }
Ejemplo n.º 2
0
        public MainWindowViewModel()
        {
            Options     = new OptionsViewModel(AppDomain.CurrentDomain.BaseDirectory);
            Timer       = new TimerViewModel();
            Timer.Tick += dispatcherTimer_Tick;

            SendCommand       = new ParameterizedCommandHandler <PasswordBox>(SendAction);
            ExitCommand       = new EmptyCommandHandler(ExitAction);
            ConfigSaveCommand = new ParameterizedCommandHandler <PasswordBox>(ConfigSaveAction);
            ConfigLoadCommand = new ParameterizedCommandHandler <PasswordBox>(ConfigLoadAction);
            TimerStartCommand = new ParameterizedCommandHandler <PasswordBox>(TimerStartAction);
            TimerStopCommand  = new EmptyCommandHandler(TimerStop);
            ShowAboutCommand  = new EmptyCommandHandler(ShowAboutAction);

            _configHandler = new ConfigHandler(Options.InputDirectory, Options.OptionsModel);

            About = new AboutBox();
        }