public MediaSearchForm(TreeNode cdsRootNode, TreeNode rendererRootNode, MainForm parent)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.cdsRootNode = cdsRootNode;
            this.rendererRootNode = rendererRootNode;
            this.parent = parent;
        }
        public RendererControlForm(MainForm parent, AVRenderer renderer, AVConnection connection)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.parent = parent;
            this.renderer = renderer;
            this.connection = connection;

            renderer.OnCreateConnection += new AVRenderer.ConnectionHandler(RendererCreateConnectionSink);
            renderer.OnRecycledConnection += new AVRenderer.ConnectionHandler(RendererRecycledConnectionSink);
            renderer.OnRemovedConnection +=  new AVRenderer.ConnectionHandler(RendererRemovedConnectionSink);

            if (connection == null && renderer.Connections.Count > 0)
            {
                connection = (AVConnection)renderer.Connections[0];
                this.connection = connection;
            }

            if (connection != null)
            {
                connection.OnMediaResourceChanged += new AVConnection.MediaResourceChangedHandler(OnMediaResourceChangedHandlerSink);
                connection.OnMute += new AVConnection.MuteStateChangedHandler(MuteStateChangedHandlerSink);
                connection.OnPlayStateChanged += new AVConnection.PlayStateChangedHandler(PlayStateChangedHandlerSink);
                connection.OnPositionChanged += new AVConnection.PositionChangedHandler(PositionChangedHandlerSink);
                connection.OnRemoved += new AVConnection.RendererHandler(RemovedConnectionHandlerSink);
                connection.OnTrackChanged += new AVConnection.CurrentTrackChangedHandler(CurrentTrackChangedHandlerSink);
                connection.OnVolume += new AVConnection.VolumeChangedHandler(VolumeChangedHandlerSink);
                volumeTrackBar.Value = (int)connection.MasterVolume;
                PositionChangedHandlerSink(connection, connection.CurrentPosition);

                muteMenuItem.Checked = connection.IsMute;
                if (connection.IsMute == true)
                {
                    muteButton.Image = mutedPictureBox.Image;
                }
                else
                {
                    muteButton.Image = mutePictureBox.Image;
                }
            }

            this.Text = "Renderer - " + renderer.FriendlyName;
            rendererNameLabel.Text = renderer.FriendlyName;

            if (connection != null) PlayStateChangedHandlerSink(connection,connection.CurrentState);
            UpdateUserInterface();
        }