private void ProcessMessage() // called from read { try { MessageValidation.ValidateHeader(txtMessageHeader.Text); // Validate Header Message m = ParseMessage(); // parsing messege = as this is in a try statement, should it fail, it will returh the exception and the message to this try's catch if (m is null) { throw new Exception("No Message"); // if parsing message was unsuccessful go no further } m.ToJson(); // writing message to jsonfile os.Add(m); // adding message to main list UpdateGlobalMessageList(); // adding message to message list box if (m is EmailMessage) { EmailMessage em = m as EmailMessage; UpdateURLList(em); // if message is email message, cast as such and add it's qurantined links to URL list } if (m is SIREmail) { UpdateSIRList(); // if Message is an incident report, add the details to a SIR list } if (m is TweetMessage) { TweetMessage tm = m as TweetMessage; MasterHashtags = tm.HashTagCount(MasterHashtags); MasterMentions = tm.MentionsCount(MasterMentions); Refresh(); // if message is tweet = add its hashtags/mentions to master list(if they exist increase count) refresh trending and mentions list } MessageBox.Show("Message Added"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message Not Added"); return; } }