/// <summary> /// Add an input /// </summary> /// <param name="ID">ID of the input to be added</param> public void AddInput(string ID) { // Try to find input ID to be added in existing inputs bool inputExists = inputs.Exists(device => device.ID == ID); // Add input if it doesn't already exist if (!inputExists) { // Create input Input input = new Input(ID); // Add input to current inputs inputs.Add(input); // Fire streams changed event if (StreamsChanged != null) { StreamsChanged(this, new EventArgs()); } } // Else throw an exception else { throw new ArgumentException("An input has already been created for this device."); } }
public void RemoveInput(Input input) { // Disposes input input.Dispose(); // Remove input inputs.Remove(input); // Fire streams changed event if (StreamsChanged != null) { StreamsChanged(this, new EventArgs()); } }