Beispiel #1
0
        public static MessageT GetMessageAtIndex(int index = -1)
        {
            MessageT message = new MessageT();

            if (index != -1)
            {
                message = Messages[index];
                RemoveMessage(index);
                return(message);
            }
            else
            {
                message = Messages[Messages.Count - 1];
                RemoveMessage();
            }
            return(message);
        }
Beispiel #2
0
 /// <summary>
 /// Adds a Message to the List
 /// </summary>
 /// <param name="message">Text message</param>
 /// <param name="type">Type of message</param>
 /// <returns></returns>
 public static bool AddMessage(string message, int?type)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(message) && type != null)
         {
             try
             {
                 MessageT newMex = new MessageT(message, (int)type);
                 Messages.Add(newMex);
                 return(true);
             }
             catch
             {
                 return(false);
             }
         }
         return(false);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
 private static string FormatMessage(MessageT message, bool crlf = false)
 {
     return(message.Time + " - " + TypeToString(message.Type) + ": " +
            message.Message + (crlf? System.Environment.NewLine : string.Empty));
 }