System.Globalization.Message.ToString C# (CSharp) Method

ToString() public method

Return the translated version of this message. If no translation is available, return the message itself
public ToString ( ) : string
return string
        public override string ToString()
        {
            return String.IsNullOrEmpty(MsgStr) ? MsgID : MsgStr;
        }

Usage Example

Esempio n. 1
0
 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());
 }
All Usage Examples Of System.Globalization.Message::ToString