Example #1
0
        protected ABoardVm(BoardDto board, ITerminalEvents terminalEvents, ITerminalTasks terminalTasks)
        {
            board.notNull();
            terminalEvents.OnTouchNumber += (s, e) => terminalEvents_OnTouchNumber_handling(e.Value);
            this.terminalTasks = terminalTasks.notNull();

            Position = board.Position;
            Numbers = new GuessKeyboardVm(board, terminalTasks);
            Keyboard = new BoardKeyboardVm(Position, terminalTasks);
        }
        public GuessKeyboardVm(BoardDto board, ITerminalTasks terminalTasks)
        {
            terminalTasks.notNull();
            board.notNull();

            var cmds = new List<CommandWithStateVm>(49);
            for(byte i = 1; i <= 49; i++){
                byte nr = i; // BEWARE OF ACCESS TO MODIFIED CLOSURE !
                cmds.Add(
                    new CommandWithStateVm(board.Numbers.Contains(nr), nr.ToString(),
                        new Command(action => terminalTasks.touchNumber(board.Position, nr))));
            }
            this.Commands = cmds;
            IsInvalid = board.IsInvalid;
            IsWin = board.IsWin;
        }
Example #3
0
 public ComboSelector(BoardDto board, ITerminalTasks terminalTasks)
 {
     ts = terminalTasks.notNull();
     b = board.notNull();
 }
Example #4
0
 public BoardCVm(BoardDto board, ITerminalEvents terminalEvents, ITerminalTasks terminalTasks)
     : base(board, terminalEvents, terminalTasks)
 {
     Description = board.Combo + " of 49";
     Combo = new ComboSelector(board, terminalTasks);
 }
Example #5
0
 void terminalEvents_OnTouchNumber_handling(BoardDto board)
 {
     if(null == board || !this.Position.Equals(board.Position)) return;
     this.Numbers = new GuessKeyboardVm(board, this.terminalTasks);
     this.render();
 }
Example #6
0
 public BoardRVm(BoardDto board, ITerminalEvents terminalEvents, ITerminalTasks terminalTasks)
     : base(board, terminalEvents, terminalTasks)
 {
 }