本文整理汇总了C#中System.Globalization.Message.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Message.ToString方法的具体用法?C# Message.ToString怎么用?C# Message.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.Message
的用法示例。
在下文中一共展示了Message.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMucMessage
void OnMucMessage(Message msg)
{
User user = msg.MucUser;
string text;
if (user.Invite != null) {
if (user.Invite.Reason != null && user.Invite.Reason.Trim().Length > 0) {
text = String.Format(_("You have been invited to {2} by {0} because {1}"),
user.Invite.From,
user.Invite.Reason,
msg.From
);
} else {
text = String.Format(_("You have been invited to {1} by {0}"),
user.Invite.From,
msg.From
);
}
} else {
text = msg.ToString();
}
var builder = CreateMessageBuilder();
builder.AppendEventPrefix();
var txt = builder.CreateText(text);
txt.IsHighlight = true;
builder.AppendText(txt);
Session.AddMessageToChat(NetworkChat, builder.ToMessage());
builder = CreateMessageBuilder();
string url;
if (!String.IsNullOrEmpty(user.Password)) {
url = String.Format("xmpp:{0}?join;password={1}", msg.From, user.Password);
} else {
url = String.Format("xmpp:{0}?join", msg.From);
}
builder.AppendUrl(url, _("Accept invite (join room)"));
Session.AddMessageToChat(NetworkChat, builder.ToMessage());
}
示例2: SendMessage
public void SendMessage(Message message)
{
IPAddress Ip = GetIPAddress();
Console.WriteLine("SendMessage:" + message.ToString());
if (Ip != null)
{
EthernetSocket eth = new EthernetSocket(Ip);
eth.SendMessage(message);
}
}