private static DeviceViewModel CreateDeviceViewMode(out IHOTASQueue hotasQueue, out IHOTASDevice hotasDevice, out IJoystick subJoystick)
        {
            var subFileSystem         = Substitute.For <IFileSystem>();
            var subDispatchFactory    = Substitute.For <DispatcherFactory>();
            var subDirectInputFactory = Substitute.For <DirectInputFactory>();
            var subMediaPlayerFactory = Substitute.For <MediaPlayerFactory>();
            var subJoystickFactory    = Substitute.For <JoystickFactory>();

            var hotasQueueFactory  = new HOTASQueueFactory(Substitute.For <IKeyboard>());
            var hotasDeviceFactory = new HOTASDeviceFactory();

            var deviceId    = Guid.NewGuid();
            var productId   = Guid.NewGuid();
            var directInput = subDirectInputFactory.CreateDirectInput();

            subJoystick = subJoystickFactory.CreateJoystick(directInput, deviceId);
            subJoystick.Capabilities.Returns(new Capabilities());

            hotasQueue  = hotasQueueFactory.CreateHOTASQueue();
            hotasDevice = hotasDeviceFactory.CreateHOTASDevice(directInput, subJoystickFactory, productId, deviceId, "test", hotasQueue);
            hotasDevice.Capabilities = new Capabilities()
            {
                AxeCount = 0, ButtonCount = 2
            };

            var deviceVm = new DeviceViewModel(subDispatchFactory.CreateDispatcher(), subFileSystem, subMediaPlayerFactory, hotasDevice);

            return(deviceVm);
        }
        private static DeviceViewModel CreateDeviceViewMode(string deviceName, out IHOTASDevice hotasDevice)
        {
            var subFileSystem         = Substitute.For <IFileSystem>();
            var subDispatcherFactory  = Substitute.For <DispatcherFactory>();
            var subDirectInputFactory = Substitute.For <DirectInputFactory>();
            var subMediaPlayerFactory = Substitute.For <MediaPlayerFactory>();
            var subHotasQueueFactory  = Substitute.For <HOTASQueueFactory>(Substitute.For <IKeyboard>());

            var hotasDeviceFactory = new HOTASDeviceFactory();

            var deviceId  = Guid.NewGuid();
            var productId = Guid.NewGuid();

            hotasDevice = hotasDeviceFactory.CreateHOTASDevice(subDirectInputFactory.CreateDirectInput(), productId, deviceId, deviceName, subHotasQueueFactory.CreateHOTASQueue());
            hotasDevice.Capabilities = new Capabilities()
            {
                AxeCount = 0, ButtonCount = 2
            };

            var deviceVm = new DeviceViewModel(subDispatcherFactory.CreateDispatcher(), subFileSystem, subMediaPlayerFactory, hotasDevice);

            return(deviceVm);
        }
Beispiel #3
0
        public void AddDevice(IHOTASDevice device)
        {
            var newDevice = _hotasDeviceFactory.CreateHOTASDevice(_directInput, device.ProductId, device.DeviceId, device.Name, _hotasQueueFactory.CreateHOTASQueue());

            RebuildMapForNewDevice(device, newDevice);
        }