Пример #1
0
        public GameControllerWindow(GameControllerViewModel viewModel)
        {
            InitializeComponent();
            _ViewModel       = viewModel;
            this.DataContext = _ViewModel;
            // InitializeController();
            this.Title = "Configure " + _ViewModel.Controller.Name;

            // Hook up to the viewmodels close actions
            if (_ViewModel.SaveAndCloseAction == null)
            {
                _ViewModel.SaveAndCloseAction = new Action(() => {
                    this.DialogResult = true;
                    this.Close();
                });
            }
            if (_ViewModel.CancelAndCloseAction == null)
            {
                _ViewModel.CancelAndCloseAction = new Action(() => {
                    this.DialogResult = false;
                    this.Close();
                });
            }
        }
Пример #2
0
        private async Task PeriodicCheck()
        {
            { // XBox
                GameControllerViewModel xboxController = null;
                await this.Dispatcher.InvokeAsync(() =>
                {
                    xboxController = this.cboXBoxController.SelectedItem as GameControllerViewModel;
                });

                if (xboxController != null)
                {
                    try
                    {
                        var state = this.xInputService.GetControllerState(xboxController.Id);
                        await this.ShowXBoxState(state, null);
                    }
                    catch (Exception ex)
                    {
                        await this.ShowXBoxState(null, ex);
                    }
                }
            }

            { // VJoy
                GameControllerViewModel vJoyController = null;
                await this.Dispatcher.InvokeAsync(() =>
                {
                    vJoyController = this.cboVJoyController.SelectedItem as GameControllerViewModel;
                });

                if (vJoyController != null)
                {
                    await this.ShowVJoyState(vJoyController.Id);
                }
            }
        }
Пример #3
0
 void InitLogic()
 {
     Game = new GameControllerViewModel(new GameController());
 }