public ChatViewManager(QuasselClient client, ChatView debug) : base() { Client = client; if (debug == null) { throw new ArgumentException("debug"); } Client.BufferSyncer.ActiveChanged += (obj) => { //Application.Refresh(); }; Client.BufferSyncer.Synced += delegate(Buffer[] buffers) { foreach (var buffer in buffers) { Get(buffer.Id); } }; Client.BufferSyncer.Message += (buffer, message) => { Get(buffer.Id).Add(new IrcMessageChatViewEntry(message)); }; DebugChatView = debug; DebugChatView.Add(new CenterChatViewEntry("Debug console")); }
ChatView Get(int id) { ChatView chatView; if (!chatviews.TryGetValue(id, out chatView)) { chatView = new ChatView(); chatView.SetDim(X, Y, Width, Height); chatView.Container = this; chatviews[id] = chatView; } return chatView; }