示例#1
0
 public void Add(string message, MessageType.Type type, Type from)
 {
     actionlist.Add(new LogMessageModel
     {
         date    = dataHelper.GetTimeNow(),
         type    = type.ToString(),
         message = message
     });
     Debug.WriteLine(message);
 }
示例#2
0
 public void Add(Exception e, MessageType.Type type, Type from)
 {
     actionlist.Add(new LogMessageModel
     {
         date    = dataHelper.GetTimeNow(),
         type    = type.ToString(),
         message = e.Message + " Error in" + from.Name
     });
     Debug.WriteLine(e.Message + "Error in " + from.Name);
 }
        private void Process(MessageType.Type type)
        {
            helper = new ProcessMessageHelper();
            helper.AssembleComponents();
            List <string> result = helper.Execute(MessageId.Text, MessageBody.Text, type);

            if (result.Any())
            {
                Display display = new Display(MessageId.Text, result);
                display.Show();
            }
        }
        public List <string> Execute(string messageId, string messageBody, MessageType.Type messageType)
        {
            List <string> errors;
            List <string> message = new List <string>();

            foreach (var CalPlugin in CalPlugins)
            {
                if ((string)CalPlugin.Metadata["MessageMetaData"] == messageType.ToString())
                {
                    errors = CalPlugin.Value.RunValidation(messageBody);
                    if (errors.Any())
                    {
                        MessageBox.Show(string.Join(System.Environment.NewLine, errors), "Validation Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                        break;
                    }
                    message = CalPlugin.Value.ProcessMessage(messageId, messageBody);
                    break;
                }
            }
            return(message);
        }