Exemplo n.º 1
0
 IObservable <HttpConnection> GetConnection(Uri uri)
 {
     if (m_connection != null &&
         m_connection.Uri.Host == uri.Host &&
         m_connection.Uri.Port == uri.Port &&
         m_connection.IsConnected
         )
     {
         return(Observable.Return(m_connection)
                .Do(x =>
         {
             Console.WriteLine("<KeepAlive>");
         })
                );
     }
     else
     {
         return(HttpConnection.Create(uri).Connect()
                .Do(x => {
             m_connection = x;
             Console.WriteLine(x);
         })
                );
     }
 }