コード例 #1
0
ファイル: DelcomDeviceInfo.cs プロジェクト: JRoughan/Emanate
        public DelcomDeviceInfo(DelcomDevice delcomDevice, IOutputDevice configuredDevice, IOutputConfiguration delcomConfiguration)
        {
            IndicateCommand = new DelegateCommand(Indicate);

            Device = delcomDevice;

            if (configuredDevice != null)
            {
                Name = configuredDevice.Name;
                Profile = configuredDevice.Profile.Id.ToString();
            }
            else
            {
                for (int i = 0;; i++)
                {
                    var currentname = defaultName + " #" + i;
                    if (delcomConfiguration.OutputDevices.All(d => d.Name != currentname))
                    {
                        Name = currentname;
                        break;
                    }
                }
            }
        }
コード例 #2
0
        private async void AddActiveDevice(IOutputConfiguration moduleConfiguration, IOutputDevice outputDevice)
        {
            var outputDeviceInfo = new DeviceViewModel(outputDevice, moduleConfiguration, globalConfig.InputDevices, mediator);

            var mapping = globalConfig.Mappings.Single(m => m.OutputDeviceId == outputDevice.Id);
            if (mapping != null)
            {
                foreach (var inputGroup in mapping.InputGroups)
                {
                    var inputDevice = globalConfig.InputDevices.Single(i => i.Id == inputGroup.InputDeviceId);
                    var inputSelector = inputSelectors[inputDevice.Key];
                    await inputSelector.SetDevice(inputDevice);
                    inputSelector.SelectInputs(inputGroup.Inputs);
                    outputDeviceInfo.InputSelectors.Add(inputSelector);
                    outputDeviceInfo.AvailableInputDevices.Remove(inputDevice);
                }
            }

            ActiveDevices.Add(outputDeviceInfo);
        }
コード例 #3
0
 public ConfigurationCaretakerBuilder AddOutputConfiguration(string key, IOutputConfiguration outputConfiguration)
 {
     outputConfigurations[key].Returns(outputConfiguration);
     lazyOutputConfigurations.Add(new Lazy<IOutputConfiguration>(() => outputConfiguration));
     return this;
 }