コード例 #1
0
        public void AddListener(DeviceConfiguration configuration)
        {
            var listener = new ProcessEvents(_playbackDeviceProvider);
            listener.RegisterSwitchForProcess(configuration.Process, configuration.PlaybackDeviceId, _defaultPlaybackDevice);

            _processEvents.Add(configuration.Id, listener);
        }
コード例 #2
0
 private void AddItemToList(DeviceConfiguration configuration)
 {
     var playbackDeviceName = _playbackDeviceProvider.GetPlaybackDeviceName(configuration.PlaybackDeviceId);
     var listItem = lvConfigurations.Items.Add(configuration.Process);
     listItem.Tag = configuration;
     listItem.SubItems.Add(playbackDeviceName);
 }
コード例 #3
0
 private void AddConfiguration(DeviceConfiguration configuration)
 {
     _configuration.Add(configuration);
     SaveConfiguration();
 }
コード例 #4
0
 private void RemoveConfiguration(DeviceConfiguration configuration)
 {
     _configuration.Remove(configuration);
     SaveConfiguration();
 }
コード例 #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            using(var dlg = new AddConfigurationForm())
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    var configuration = new DeviceConfiguration();
                    configuration.PlaybackDeviceId = dlg.SelectedPlaybackDevice.Id;
                    configuration.Process = dlg.SelectedProcess;

                    AddItemToList(configuration);
                    AddConfiguration(configuration);
                }
            }
        }
コード例 #6
0
 public void Remove(DeviceConfiguration configuration)
 {
     var configurationToRemove = DeviceConfigurations.FirstOrDefault(x => x.Id == configuration.Id);
     if (configurationToRemove != null)
     {
         DeviceConfigurations.Remove(configurationToRemove);
         OnDeviceConfigurationsChanged(new EventArgs());
     }
 }
コード例 #7
0
 public void Add(DeviceConfiguration configuration)
 {
     DeviceConfigurations.Add(configuration);
     OnDeviceConfigurationsChanged(new EventArgs());
 }