本文整理汇总了C#中Smuxi.Engine.MessageBuilder.CreateText方法的典型用法代码示例。如果您正苦于以下问题:C# MessageBuilder.CreateText方法的具体用法?C# MessageBuilder.CreateText怎么用?C# MessageBuilder.CreateText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smuxi.Engine.MessageBuilder
的用法示例。
在下文中一共展示了MessageBuilder.CreateText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendHtmlMessageBold
public void AppendHtmlMessageBold()
{
var builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
var textPart = builder.CreateText("Test");
textPart.Bold = true;
builder.Append(textPart);
var expectedMsg = builder.ToMessage();
builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
builder.AppendHtmlMessage("<b>Test</b>");
var actualMsg = builder.ToMessage();
Assert.AreEqual(expectedMsg, actualMsg);
}
示例2: AppendHtmlMessageCssFgRed
public void AppendHtmlMessageCssFgRed()
{
var builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
var textPart = builder.CreateText("Test");
textPart.ForegroundColor = new TextColor(255, 0, 0);
builder.Append(textPart);
var expectedMsg = builder.ToMessage();
builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
builder.AppendHtmlMessage("<div style=\"color: #FF0000\">Test</div>");
var actualMsg = builder.ToMessage();
Assert.AreEqual(expectedMsg, actualMsg);
}
示例3: AppendHtmlMessageCssFgRedBgBlue
public void AppendHtmlMessageCssFgRedBgBlue()
{
var builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
var textPart = builder.CreateText("Test");
textPart.ForegroundColor = new TextColor(255, 0, 0);
textPart.BackgroundColor = new TextColor(0, 0, 255);
builder.Append(textPart);
var expectedMsg = builder.ToMessage();
builder = new MessageBuilder();
builder.TimeStamp = DateTime.MinValue;
builder.AppendHtmlMessage(
"<div style=\"" +
"color: #FF0000; " +
"background: #0000FF url('smiley.gif') no-repeat fixed center" +
"\">Test</div>");
var actualMsg = builder.ToMessage();
Assert.AreEqual(expectedMsg, actualMsg);
}
示例4: CommandGenerateMessages
public void CommandGenerateMessages(CommandModel cmd, IChatView chat)
{
Trace.Call(cmd, chat);
var count = 0;
Int32.TryParse(cmd.Parameter, out count);
var builder = new MessageBuilder();
var sender = new ContactModel("msg-tester", "msg-tester", "test", "test");
builder.AppendMessage(sender, "time for a messsage generator command so I can test speed and memory usage");
var text = builder.CreateText(" *formatted text* ");
text.Bold = true;
builder.Append(text);
builder.AppendUrl("https://www.smuxi.org/");
var msgs = new List<MessageModel>(count);
for (var i = 0; i < count; i++) {
var msg = builder.ToMessage();
msgs.Add(msg);
}
DateTime start, stop;
start = DateTime.UtcNow;
foreach (var msg in msgs) {
chat.AddMessage(msg);
}
stop = DateTime.UtcNow;
builder = new MessageBuilder();
builder.AppendText(
"IChatView.AddMessage(): count: {0} took: {1:0} ms avg: {2:0.00} ms",
count,
(stop - start).TotalMilliseconds,
(stop - start).TotalMilliseconds / count
);
chat.AddMessage(builder.ToMessage());
}