/// <summary>
        /// Eventfunction that is run when an UPnP sink is detected on the network. Only accepts sinks with the friendly name: "HiPi - Sink". 
        /// If it has the right name then it creates three stacks (AVTransport, ConnectionManager and RenderingControl)
        /// </summary>
        /// <param name="sender">The object that send the event</param>
        /// <param name="d">The discovered sink device</param>
        private void AddSink(MediaRendererDiscovery sender, UPnPDevice d)
        {
            Console.WriteLine("Discovered Sink Device: " + d.FriendlyName);
            if (d.FriendlyName == "HiPi - Sink")
            {
                Console.WriteLine("Added Sink Device: " + d.FriendlyName);

                ISinkFunctions func = new UPnP_SinkFunctions(
                    new SinkStack.CpAVTransport(d.GetServices(SinkStack.CpAVTransport.SERVICE_NAME)[0]),
                    new SinkStack.CpConnectionManager(d.GetServices(SinkStack.CpConnectionManager.SERVICE_NAME)[0]),
                    new SinkStack.CpRenderingControl(d.GetServices(SinkStack.CpRenderingControl.SERVICE_NAME)[0]));

                AddSinkEvent(func, null);
            }
        }
 public void getUPnPSink(UPnP_SinkFunctions e, EventArgs s)
 {
     _UPnPSink = e;
     MessageBox.Show("Sink added");
 }
 public void getUPnPSink(UPnP_SinkFunctions e, EventArgs s)
 {
     _UPnPSink = e;
     _UPnPSink.getVolEvent += getVolEvent;
     _UPnPSink.getPositionEvent += getPosEvent;
     _UPnPSink.transportStateEvent += UpnPSinkOnTransportStateEvent;
     _UPnPSink.GetVolume();
     _UPnPSink.GetPosition();
 }