示例#1
0
        public AdminAreaView(AdminAreaViewModel adminAreaViewModel)
        {
            InitializeComponent();
            this.DataContext = adminAreaViewModel;

            this.PreviewKeyDown += ((AdminAreaViewModel)DataContext).InputService.ButtonDownEventHandler;
            this.PreviewKeyUp += ((AdminAreaViewModel)DataContext).InputService.ButtonUpEventHandler;
        }
示例#2
0
        public Window1()
        {
            InitializeComponent();
            var eventAggregator = new EventAggregator();

            _standingsService = new StandingsService(5);
            _roundService = new RoundService();
            //var names = new List<string> {"Emil", "CJ", "Rune", "Andreas", "Kristoffer"};
            var counter = 1;
            foreach (var p in _standingsService.Players)
            {
                p.Name = "P" + counter++;
                //p.Name = names[counter - 1];
                //p.Points = counter*100;
                //counter++;
            }
            _inputService = new InputService(eventAggregator, _standingsService);

            _questionGridViewModel = new QuestionGridViewModel(eventAggregator, _roundService, _standingsService);

            _adminAreaViewModel = new AdminAreaViewModel(eventAggregator, _questionGridViewModel, _roundService, _standingsService, _inputService);
            _adminArea = new AdminAreaView(_adminAreaViewModel);
            _adminArea.Show();
            var mainViewModel = new MainViewModel(this, eventAggregator, _roundService, _standingsService, _inputService);
            MainView.DataContext = mainViewModel;

            this.PreviewKeyDown += _inputService.ButtonDownEventHandler;
            this.PreviewKeyUp += _inputService.ButtonUpEventHandler;

            new System.Threading.Tasks.TaskFactory().StartNew(() => { System.Threading.Thread.Sleep(100);
                                                                        UIHelperService.ExecuteUIAction(() =>
                                                                                                        this.WindowState
                                                                                                        =
                                                                                                        WindowState.
                                                                                                            Minimized);
            });
        }