Пример #1
0
        /// <summary>
        /// Post message to server and get response.
        /// </summary>
        /// <param name="data">Message to send.</param>
        /// <returns>Response from the server. Null if connection failed.</returns>
        public string GetResponseText(string data)
        {
            SyncMLConnection connection = SyncMLConnection.Create(Uri, Proxy);

            if (connection != null)
            {
                return(connection.GetResponseText(data));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public static SyncMLConnection Create(string uriLink, WebProxy proxy)
        {
            if (String.IsNullOrEmpty(uriLink))
            {
                return(null);
            }

            try
            {
                SyncMLConnection connection = new SyncMLConnection(uriLink, proxy);
                return(connection);
            }
            catch (UriFormatException)
            {
                return(null);
            }
            catch (InvalidCastException)
            {
                return(null);
            }
        }