Ejemplo n.º 1
0
        /// <summary>
        /// Calls message frame and retrieves last 10 messages from server.
        /// </summary>
        /// <returns>A string with the number of messages retrieved if retrieving was successful or an error message else.</returns>
        public static string RetrieveTenMessages()
        {
            int messagesRetrieved;

            try
            {
                messagesRetrieved = (char)_messages.RetrieveTenMessages();
            }
            catch (Exception e)
            {
                _logger.log(3, "The following error occurred while trying to retrieve from server: " + e.Message);
                return(e.Message);
            }
            string numMessages = System.String.Empty + messagesRetrieved;

            _logger.log(2, "USER: "******" retrieved " + numMessages + " messages successfully from server.");
            return(numMessages);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calls message frame and retrieves last 10 messages from server.
        /// </summary>
        /// <param name="checkRetrieval">Indicates whteher the method was used in order to check connection ore for normal use.</param>
        /// <returns>A string indicating the number of messages rettrieved.</returns>
        /// <returns>A string with the number of messages retrieved if retrieving was successful or an error message else.</returns>
        public static string RetrieveTenMessages(bool checkRetrieval)
        {
            int messagesRetrieved;

            try
            {
                messagesRetrieved = (char)_messages.RetrieveTenMessages();
                if (!checkRetrieval && messagesRetrieved != 0)
                {
                    _logger.log(2, "USER: "******" retrieved " + messagesRetrieved + "" + " messages successfully from server.");
                }
            }
            catch (Exception e)
            {
                _logger.log(3, "The following error occurred while trying to retrieve from server: " + e.Message);
                return(e.Message);
            }
            return(messagesRetrieved + String.Empty);
        }