当前位置: 首页>>代码示例>>C#>>正文


C# MessageBuilder.AppendEventPrefix方法代码示例

本文整理汇总了C#中Smuxi.Engine.MessageBuilder.AppendEventPrefix方法的典型用法代码示例。如果您正苦于以下问题:C# MessageBuilder.AppendEventPrefix方法的具体用法?C# MessageBuilder.AppendEventPrefix怎么用?C# MessageBuilder.AppendEventPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smuxi.Engine.MessageBuilder的用法示例。


在下文中一共展示了MessageBuilder.AppendEventPrefix方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Populate

        public virtual void Populate()
        {
            Trace.Call();

            Name = SyncedName;

            // sync messages
            // cleanup, be sure the output is empty
            _OutputMessageTextView.Clear();

            if (!Frontend.IsLocalEngine && Frontend.UseLowBandwidthMode) {
                var msg = new MessageBuilder();
                msg.AppendEventPrefix();
                msg.AppendMessage(_("Low Bandwidth Mode is active: no messages synced."));
                AddMessage(msg.ToMessage());
            } else {
                if (SyncedMessages != null) {
                    // TODO: push messages in batches and give back control to
                    // GTK+ in between for blocking the GUI thread less
                    foreach (MessageModel msg in SyncedMessages) {
                        AddMessage(msg);
                    }
                }
            }

            // as we don't track which messages were already seen it would
            // show all chats with message activity after the frontend connect
            if (!HasHighlight) {
                HasActivity = false;
                HasEvent = false;
            }

            // let the user know at which position new messages start
            _OutputMessageTextView.UpdateMarkerline();

            // reset tab icon to normal
            TabImage.Pixbuf = DefaultTabImage.Pixbuf;
            OnStatusChanged(EventArgs.Empty);

            SyncedMessages = null;
            _IsSynced = true;
        }
开发者ID:Jaykul,项目名称:smuxi,代码行数:42,代码来源:ChatView.cs

示例2: InitDatabase

        private void InitDatabase()
        {
            ConfigureDatabase();
            try {
                OpenDatabase();
            } catch (Exception ex) {
            #if LOG4NET
                Logger.Error("InitDatabase(): failed to open message " +
                             "database: " + DatabaseFile, ex);
            #endif
                FixDatabase(ex);
                // WORXNOWPLX
                OpenDatabase();

                var builder = new MessageBuilder();
                builder.AppendEventPrefix();
                builder.AppendErrorText(
                    _("Your chat history is no longer available because of " +
                      "an error but will be preserved from now on.")
                );
                Add(builder.ToMessage());
            }
        }
开发者ID:grendello,项目名称:smuxi,代码行数:23,代码来源:Db4oMessageBuffer.cs

示例3: FormatUpload

        void FormatUpload(MessageBuilder bld, PersonModel person, ChatModel chat, Message message)
        {
            // Figure out what the user uploaded, we need to issue another call for this
            var upload = Client.Get<UploadWrapper>(String.Format("/room/{0}/messages/{1}/upload.json", chat.ID, message.Id)).Upload;

            bld.AppendEventPrefix();
            bld.AppendIdendityName(person).AppendSpace();
            bld.AppendText(_("has uploaded '{0}' ({1} B) {2}"), upload.Name, upload.Byte_Size, upload.Full_Url);
        }
开发者ID:glwu,项目名称:smuxi,代码行数:9,代码来源:CampfireProtocolManager.cs

示例4: _CommandHelp

        private void _CommandHelp(CommandModel cd)
        {
            var chatView = ChatViewManager.GetChat(cd.Chat);
            var builder = new MessageBuilder();
            // TRANSLATOR: this line is used as a label / category for a
            // list of commands below
            builder.AppendHeader(_("Frontend Commands"));
            chatView.AddMessage(builder.ToMessage());

            string[] help = {
            "window (number|channelname|queryname|close)",
            "sync",
            "sort",
            "clear",
            "echo data",
            "exec command",
            "detach",
            "list [search key]",
            };

            foreach (string line in help) {
                builder = new MessageBuilder();
                builder.AppendEventPrefix();
                builder.AppendText(line);
                chatView.AddMessage(builder.ToMessage());
            }
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:27,代码来源:Entry.cs

示例5: CommandHelp

        void CommandHelp(CommandModel cmd)
        {
            var chatView = f_MainWindow.ChatViewManager.GetChat(cmd.Chat);
            var builder = new MessageBuilder();
            // TRANSLATOR: this line is used as a label / category for a
            // list of commands below
            builder.AppendHeader(_("Frontend Commands"));
            chatView.AddMessage(builder.ToMessage());

            string[] help = {
                "help",
                "window number",
                "exit",
            };

            foreach (string line in help) {
                builder = new MessageBuilder();
                builder.AppendEventPrefix();
                builder.AppendText(line);
                chatView.AddMessage(builder.ToMessage());
            }
        }
开发者ID:vith,项目名称:smuxi,代码行数:22,代码来源:Entry.cs

示例6: FormatEvent

 void FormatEvent(MessageBuilder bld, PersonModel person, string action)
 {
     bld.AppendEventPrefix();
     bld.AppendIdendityName(person).AppendSpace();
     bld.AppendText(action);
 }
开发者ID:glwu,项目名称:smuxi,代码行数:6,代码来源:CampfireProtocolManager.cs

示例7: Populate

        public virtual void Populate()
        {
            Trace.Call();

            Name = SyncedName;

            // sync messages
            // cleanup, be sure the output is empty
            _OutputMessageTextView.Clear();

            if (!Frontend.IsLocalEngine && Frontend.UseLowBandwidthMode) {
                var msg = new MessageBuilder();
                msg.AppendEventPrefix();
                msg.AppendMessage(_("Low Bandwidth Mode is active: no messages synced."));
                AddMessage(msg.ToMessage());
            } else {
                if (SyncedMessages != null) {
                    // TODO: push messages in batches and give back control to
                    // GTK+ in between for blocking the GUI thread less
                    foreach (MessageModel msg in SyncedMessages) {
                        AddMessage(msg);
                        if (msg.TimeStamp <= SyncedLastSeenMessage) {
                            // let the user know at which position new messages start
                            _OutputMessageTextView.UpdateMarkerline();
                        }
                    }
                }
            }

            // as we don't track which events have already been seen it would
            // show all chats with unseen events after the frontend connect
            if (!HasHighlight) {
                HasEvent = false;
                // Smuxi protocol < 0.13 does not support remembering seen
                // messages thus we mark all message as seen as we can't tell
                // which ones are new
                if (Frontend.EngineProtocolVersion < new Version(0, 13)) {
                    HasActivity = false;
                }
            }

            // reset tab icon to normal
            TabImage.Pixbuf = DefaultTabImage.Pixbuf;
            OnStatusChanged(EventArgs.Empty);

            SyncedMessages = null;
            IsSynced = true;
        }
开发者ID:meebey,项目名称:smuxi,代码行数:48,代码来源:ChatView.cs

示例8: InitMessageBuffer

        public void InitMessageBuffer(MessageBufferPersistencyType persistency)
        {
            Trace.Call(persistency);

            if (MessageBuffer != null) {
                return;
            }

            switch (persistency) {
                case MessageBufferPersistencyType.Volatile:
                    MessageBuffer = new ListMessageBuffer();
                    break;
                case MessageBufferPersistencyType.Persistent:
                    try {
                        var start = DateTime.UtcNow;
                        MessageBuffer = new Db4oMessageBuffer(
                            ProtocolManager.Session.Username,
                            ProtocolManager.Protocol,
                            ProtocolManager.NetworkID,
                            ID
                        );
                        var stop = DateTime.UtcNow;
            #if LOG4NET
                        _Logger.DebugFormat(
                            "InitMessageBuffer(): initializing " +
                            "Db4oMessageBuffer({0}, {1}, {2}, {3}) " +
                            "took: {4:0.00} ms",
                            ProtocolManager.Session.Username,
                            ProtocolManager.Protocol,
                            ProtocolManager.NetworkID,
                            ID,
                            (stop - start).TotalMilliseconds
                        );
            #endif
                    } catch (Exception ex) {
            #if LOG4NET
                        _Logger.Error(
                            "InitMessageBuffer(): Db4oMessageBuffer() threw " +
                            "exception, falling back to memory backend!", ex
                        );
            #endif
                        MessageBuffer = new ListMessageBuffer();

                        var builder = new MessageBuilder();
                        builder.AppendEventPrefix();
                        builder.AppendErrorText(
                            _("Failed to open chat history for writing. " +
                              "Your chat history will not be preserved. " +
                              "Reason: {0}"),
                            ex.Message
                        );
                        MessageBuffer.Add(builder.ToMessage());
                    }
                    break;
            }
        }
开发者ID:grendello,项目名称:smuxi,代码行数:56,代码来源:ChatModel.cs

示例9: CopyConstructor

        public void CopyConstructor()
        {
            var builder = new MessageBuilder();
            builder.AppendEventPrefix();
            builder.AppendUrl("http://example.com");
            builder.AppendText("foobar");
            var msg = builder.ToMessage();
            var copiedMsg = new MessageModel(msg);

            Assert.AreNotSame(msg, copiedMsg);
            Assert.IsNotNull(copiedMsg.MessageParts);
            Assert.AreNotSame(msg.MessageParts, copiedMsg.MessageParts);
            Assert.AreEqual(msg, copiedMsg);
        }
开发者ID:Jaykul,项目名称:smuxi,代码行数:14,代码来源:MessageModelTests.cs

示例10: CommandWindow

        private void CommandWindow(CommandModel cmd)
        {
            if (cmd.Parameter == "close") {
                f_ChatViewManager.CurrentChat.Close();
                return;
            } else if (cmd.Parameter == "list") {
                var thisChatView = f_MainWindow.ChatViewManager.GetChat(cmd.Chat);

                for (int i = 0;; ++i) {
                    ChatView availableChatView = f_MainWindow.ChatViewManager.GetChat(i);
                    if (availableChatView == null) {
                        break;
                    }

                    var builder = new MessageBuilder();
                    builder.AppendEventPrefix();
                    builder.AppendFormat("{0} - {1}", i + 1, availableChatView.Name ?? "");
                    thisChatView.AddMessage(builder.ToMessage());
                }
                return;
            }

            int window;
            if (!Int32.TryParse(cmd.Parameter, out window)) {
                return;
            }
            ChatView chat = f_ChatViewManager.GetChat(window - 1);
            if (chat == null) {
                return;
            }
            f_ChatViewManager.CurrentChat = chat;
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:32,代码来源:Entry.cs

示例11: CommandBenchmarkMessageBuilder

        public void CommandBenchmarkMessageBuilder(CommandModel cmd)
        {
            Trace.Call(cmd);

            var count = 1000;
            var showHelp = false;
            var appendMessage = false;
            var appendText = false;
            var appendEvent = false;
            var appendFormat = false;
            var toMessage = false;
            try {
                var opts = new NDesk.Options.OptionSet() {
                    { "c|count=", v => count = Int32.Parse(v) },
                    { "m|append-message", v => appendMessage = true },
                    { "t|append-text", v => appendText = true },
                    { "e|append-event", v => appendEvent = true },
                    { "f|append-format", v => appendFormat = true },
                    { "T|to-message", v => toMessage = true },
                };
                opts.Add("h|?|help", x => {
                    showHelp = true;
                    var writer = new StringWriter();
                    opts.WriteOptionDescriptions(writer);
                    AddMessageToFrontend(
                        cmd,
                        CreateMessageBuilder().
                            AppendHeader("{0} usage", cmd.Command).
                            AppendText("\n").
                            AppendText("Parameters:\n").
                            AppendText(writer.ToString()).
                            ToMessage()
                    );
                    return;
                });
                opts.Parse(cmd.Parameter.Split(' '));
                if (showHelp) {
                    return;
                }
            } catch (Exception ex) {
                AddMessageToFrontend(
                    cmd,
                    CreateMessageBuilder().
                        AppendErrorText("Invalid parameter: {0}", ex.Message).
                        ToMessage()
                );
                return;
            }

            DateTime start, stop;
            start = DateTime.UtcNow;
            MessageBuilder builder;
            for (var i = 0; i < count; i++) {
                builder = new MessageBuilder();
                if (appendMessage) {
                    builder.AppendMessage("This is message with a link to https://www.smuxi.org/.");
                }
                if (appendText) {
                    builder.AppendText("This is message with just text.");
                }
                if (appendEvent) {
                    builder.AppendEventPrefix();
                }
                if (appendFormat) {
                    builder.AppendFormat("{0} [{1}] has joined {2}",
                                         "meebey3",
                                         "[email protected]",
                                         "#smuxi-devel");
                }
                if (toMessage) {
                    var msg = builder.ToMessage();
                }
            }
            stop = DateTime.UtcNow;

            builder = new MessageBuilder();
            builder.AppendText("MessageBuilder().");
            if (appendMessage) {
                builder.AppendText("AppendMessage().");
            }
            if (appendText) {
                builder.AppendText("AppendText().");
            }
            if (appendEvent) {
                builder.AppendText("AppendEventPrefix().");
            }
            if (appendFormat) {
                builder.AppendText("AppendFormat().");
            }
            if (toMessage) {
                builder.AppendText("ToMessage()");
            }
            builder.AppendText(
                " count: {1} took: {2:0} ms avg: {3:0.00} ms",
                cmd.Data,
                count,
                (stop - start).TotalMilliseconds,
                (stop - start).TotalMilliseconds / count
            );
            AddMessageToFrontend(cmd, builder.ToMessage());
//.........这里部分代码省略.........
开发者ID:johansson,项目名称:smuxi,代码行数:101,代码来源:CommandManager.cs


注:本文中的Smuxi.Engine.MessageBuilder.AppendEventPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。