private void SessionTerminated(object sender, SessionTerminatedEventArgs dpMessage)
    {
        // This session is being terminated, let the user know
        if (dpMessage.Message.ResultCode == ResultCode.HostTerminatedSession)
        {
            MessageBox.Show("The Host has terminated this session.  This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        else
        {
            MessageBox.Show("The session has been lost.  This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        // This will post a message on the main thread to shut down our form
        parent.BeginInvoke(new PeerCloseCallback(parent.PeerClose));
    }