使用GalaSoft MvvmLight消息传递类,如何将字符附加到现有消息的末尾? [英] Using the GalaSoft MvvmLight messaging class, how can I append characters to the end of an existing message?
本文介绍了使用GalaSoft MvvmLight消息传递类,如何将字符附加到现有消息的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Using the GalaSoft MvvmLight messaging class, how can I append characters (more dots, for example) to the end of an existing message that is displaying on the GUI, rather than over-writing the message each time?
For example, I have a particular class (MyMessage) that I created:
<pre lang="c#">public class MyMessage : MessageBase
{
public enum FeedbackStateEnum { Starting, Completed, Skipped }
public string StatusMsg { get; private set; }
public MyMessage(object sender, string statusMsg)
: base(sender)
{
StatusMsg = statusMsg;
}
public override string ToString()
{
return base.ToString() + "(" + StatusMsg + ")";
}
}
我有另一个基类,我在其中注册了消息对象:
I have another base class in which I register the message object:
// Handle any broadcast messages so that they can be resent to the client
Messenger.Default.Register<MyMessage>(this, MyMessageMethod);
private void MyMessageMethod(MyMessage obj)
{
DisplayMessage("Status: " + obj.StatusMsg);
}
我不想每次都覆盖此消息,而是想附加一个。到现有消息的末尾。现在我有以下行在GUI上显示消息。
Rather than over-writing this message each time, I wanted to append a " ." to the end of the existing message. Right now I have the following line that displays the message on the GUI.
Messenger.Default.Send(new MyMessage(this, "Processing Data . ."));
每个通过循环的时间,我想添加另一个。消息。我似乎找不到办法做到这一点。
谢谢,蕾妮
Each time through the loop, I want to add another " ." to the message. I can't seem to find a way to do that.
Thanks, Renee
推荐答案
这篇关于使用GalaSoft MvvmLight消息传递类,如何将字符附加到现有消息的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文