private void Dispose(bool disposing)
 {
     if (disposing)
     {
         CloseWebSocket();
         uri = null;
         if (!callbackManager.IsNull())
         {
             callbackManager.Dispose();
             callbackManager = null;
         }
         if (!sendingQueue.IsNull())
         {
             sendingQueue.Clear();
             sendingQueue = null;
         }
         pinging = false;
         connectionOpenEvent.Reset();
         connectionOpenEvent.Close();
         if (!receivedQueue.IsNull())
         {
             receivedQueue.Clear();
             receivedQueue = null;
         }
     }
 }
Example #2
0
 public Connection(string url, bool sendFromThread)
 {
     uri             = new Uri(url);
     callbackManager = new CallbackControl();
     receivedQueue   = new Queue <Response>();
     if (sendFromThread)
     {
         new Thread(ThreadDequeuSendMessages).Start(sendingQueue = new Queue <string>());
     }
 }
        /// <summary>
        /// Creates a new media object
        /// </summary>
        /// <param name="filename"></param>
        /// <exception cref="MediaPlayerException"></exception>
        /// <exception cref="ArgumentNullException">When the given filename is null.</exception>
        public Media(string filename)
        {
            if (filename == null)
                throw new ArgumentNullException(filename);

            _callbackControl = new CallbackControl(this);

            _filename = filename;
            _alias = System.Guid.NewGuid().ToString();

            open();
        }