예제 #1
0
        public GameBoardVM(IGameDataClient dataClient)
        {
            DataClient = dataClient;

            RestartGame();

            DataClient.Get();
            DataClient.Start();
            CmdSave = new DelegateCommand(CmdSave_HandleExecute);

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    int x = X;
                    ++x;
                    x %= CurrentLevel.Lvl.Width;
                    X = x;

                    int y = Y;
                    y += 2;
                    y %= CurrentLevel.Lvl.Height;
                    Y = y;
                    Thread.Sleep(1000);

                }
            });
        }
예제 #2
0
        public GameBoard(IGameBoardVM vm, IGameDataClient dataClient)
        {
            InitializeComponent();

            // Set important dependand properties
            DataContext = vm;
            ViewModel = vm;
            DataClient = dataClient;

            // Debug-mode - enables to draw a level
            IsDebug = true;

            // Draw elements
            Init();
        }