本文整理汇总了C#中MessageCollection类的典型用法代码示例。如果您正苦于以下问题:C# MessageCollection类的具体用法?C# MessageCollection怎么用?C# MessageCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageCollection类属于命名空间,在下文中一共展示了MessageCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCreateTransaction
public void CanCreateTransaction()
{
SendPipelineWrapper pipeline =
PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));
using ( TransactionControl control = pipeline.EnableTransactions() )
{
// Create the input message to pass through the pipeline
Stream stream = DocLoader.LoadStream("SampleDocument.xml");
IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream);
// Add the necessary schemas to the pipeline, so that
// disassembling works
pipeline.AddDocSpec(typeof(Schema1_NPP));
pipeline.AddDocSpec(typeof(Schema2_WPP));
MessageCollection inputMessages = new MessageCollection();
inputMessages.Add(inputMessage);
// Execute the pipeline, and check the output
IBaseMessage outputMessage = pipeline.Execute(inputMessages);
Assert.IsNotNull(outputMessage);
control.SetComplete();
}
}
示例2: ObterClientesIncompleto
public MessageCollection<Dominio.Models.Cliente> ObterClientesIncompleto()
{
MessageCollection<Dominio.Models.Cliente> msg = new MessageCollection<Dominio.Models.Cliente>();
try
{
var clientes = Integracao.XYZ.XYZClientes.ClientesIncompletos();
if (clientes.Resultado != TipoResultado.Sucesso)
throw clientes.Exception;
msg.Instances = clientes.Instances.Select(s => new Dominio.Models.Cliente()
{
Id = s.Idk__BackingField,
Nome = s.Nomek__BackingField,
Endereco = s.Enderecok__BackingField,
TelefoneResidencial = s.TelefoneResidencialk__BackingField,
TelefoneCelular = s.TelefoneCelulark__BackingField,
DataNascimento = s.DataNascimentok__BackingField
}).ToList();
}
catch (Exception ex)
{
msg.Exception = ex;
}
return msg;
}
示例3: _ProcessMessages
void _ProcessMessages (MessageCollection messages, IRule rule, object target)
{
if (messages == RuleSuccess)
return;
Violations.Add (rule, target, messages);
}
示例4: CheckType
public MessageCollection CheckType(TypeDefinition type, Runner runner)
{
MessageCollection messageCollection = new MessageCollection();
foreach (MethodDefinition method in type.Methods)
{
if (!method.IsStatic)
{
return null;
}
}
foreach (FieldDefinition field in type.Fields)
{
if (!field.IsStatic)
{
return null;
}
}
foreach (MethodDefinition ctor in type.Constructors)
{
if (!ctor.IsStatic && (ctor.Attributes & MethodAttributes.Public) == MethodAttributes.Public)
{
Location location = new Location(type.Name, ctor.Name, 0);
Message message = new Message(MessageString, location, MessageType.Error);
messageCollection.Add(message);
}
}
return messageCollection.Count > 0 ? messageCollection : null;
}
示例5: ConcatMessagesAsPart
internal MimePartCollection ConcatMessagesAsPart(MessageCollection input)
{
MimePartCollection output = new MimePartCollection();
foreach(MimePart part in this) output.Add(part);
foreach(Message message in input) output.Add(message.ToMimePart());
return output;
}
示例6: AddMessages
public void AddMessages(MessageCollection messageCollection)
{
foreach (var message in messageCollection)
{
this.AddMessage(message);
}
}
示例7: ChatWindow
public ChatWindow(Chat parrent, RoomLink link)
{
InitializeComponent();
DataContext = this; //aby šel bindovat title okna
Parrent = parrent;
Link = link;
RefreshTime = 20;
refresher = new System.Timers.Timer(RefreshTime * 1000);
refresher.Elapsed += (object sender, ElapsedEventArgs ea) => {
Logger.dbgOut("Refresh");
//tohle tu je, protoze potrebuju kolekci updatovat z jinýho vlákna
Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate() {
List<Message> ms = parrent.getMessages();
Messages.Clear();
foreach(Message m in ms)
{
Messages.Add(m);
}
}
);
};
Messages = new MessageCollection(parrent.getMessages());
lbChatView.ItemsSource = Messages;
//zapnutí obnovování zpráv
refresher.Start();
}
示例8: ValidateBinaryParsing
public void ValidateBinaryParsing()
{
string [] code = new [] {
" B'1010101111'",
" b\"111\"",
" B'121'"
};
FortranOptions opts = new FortranOptions();
MessageCollection messages = new MessageCollection(opts);
Lexer ls = new Lexer(code, opts, messages);
SimpleToken token = ls.GetToken();
Assert.IsTrue(token.ID == TokenID.INTEGER);
IntegerToken intToken = (IntegerToken)token;
Assert.AreEqual(intToken.Value, 687);
Assert.IsTrue(ls.GetToken().ID == TokenID.EOL);
token = ls.GetToken();
Assert.IsTrue(token.ID == TokenID.INTEGER);
intToken = (IntegerToken)token;
Assert.AreEqual(intToken.Value, 7);
Assert.IsTrue(ls.GetToken().ID == TokenID.EOL);
ls.GetToken();
Assert.IsTrue(messages.ErrorCount > 0);
Assert.IsTrue(messages[0].Line == 3);
Assert.IsTrue(messages[0].Code == MessageCode.BADNUMBERFORMAT);
}
示例9: CheckMethod
public MessageCollection CheckMethod(MethodDefinition method, Runner runner)
{
MessageCollection messageCollection = new MessageCollection();
if (method.Body == null || method.Body.Instructions == null)
{
return null;
}
foreach (Instruction instruction in method.Body.Instructions)
{
if (instruction.OpCode.Code == Code.Pop)
{
Message message = CheckForViolation(instruction.Previous);
if (message != null)
{
messageCollection.Add(message);
}
}
}
return messageCollection.Count == 0 ? runner.RuleSuccess : messageCollection;
}
示例10: Main
static void Main(string[] args)
{
FortranOptions opts = new FortranOptions();
MessageCollection messages = new MessageCollection(opts);
opts.Messages = messages;
if (opts.Parse(args)) {
Compiler comp = new Compiler(opts);
comp.Messages = messages;
foreach (string srcfile in opts.SourceFiles) {
if (!File.Exists(srcfile)) {
messages.Error(MessageCode.SOURCEFILENOTFOUND, String.Format("File '{0}' not found", srcfile));
break;
}
comp.Compile(srcfile);
}
if (messages.ErrorCount == 0) {
comp.Save();
if (opts.Run && messages.ErrorCount == 0) {
comp.Execute();
}
}
}
foreach (Message msg in messages) {
if (msg.Level == MessageLevel.Error) {
Console.ForegroundColor = ConsoleColor.Red;
}
Console.WriteLine(msg);
Console.ResetColor();
}
if (messages.ErrorCount > 0) {
Console.WriteLine(String.Format("*** {0} errors found. Compilation stopped.", messages.ErrorCount));
}
}
示例11: CheckMessageType
private void CheckMessageType (MessageCollection messageCollection, MessageType messageType)
{
IEnumerator enumerator = messageCollection.GetEnumerator ();
if (enumerator.MoveNext ()) {
Message message = (Message) enumerator.Current;
Assert.AreEqual (message.Type, messageType);
}
}
示例12: Account
public Account(dynamic oAccount)
{
_account = oAccount;
dynamic oMessages = _account.Messages;
_messageCollection = new MessageCollection(oMessages);
}
示例13: TraceScan
/// <summary>
/// This constructor will create an empty class, normally
/// used when the Node property is assigned
/// </summary>
public TraceScan()
{
m_id = Guid.NewGuid();
m_messages = new MessageCollection();
m_machine = Environment.MachineName;
m_messages.MachineName = m_machine;
m_user = Environment.UserName;
m_mailBox = Environment.UserName;
}
示例14: AddExistingMessages
private void AddExistingMessages (MessageCollection existingMessages) {
if (existingMessages == null)
return;
foreach (Message violation in existingMessages) {
Message message = new Message ("This method contains unused parameters. This is a sign for the Speculative Generality smell.",violation.Location, MessageType.Error);
messageCollection.Add (message);
}
}
示例15: FixtureSetUp
public void FixtureSetUp ()
{
string unit = Assembly.GetExecutingAssembly ().Location;
assembly = AssemblyFactory.GetAssembly (unit);
rule = new UsePluralNameInEnumFlagsRule ();
messageCollection = null;
}