本文整理汇总了C#中UserModel.AppendValues方法的典型用法代码示例。如果您正苦于以下问题:C# UserModel.AppendValues方法的具体用法?C# UserModel.AppendValues怎么用?C# UserModel.AppendValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel.AppendValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow () : base (Gtk.WindowType.Toplevel) {
Build ();
textbuf = new ConcurrentQueue<string> ();
server_model = new ServerModel ();
user_model = new UserModel ();
client = new IrcClient ();
var col_servers = new TreeViewColumn { Title = "Servers" };
var server_renderer = new CellRendererText ();
col_servers.PackStart (server_renderer, true);
treeview_servers.AppendColumn (col_servers);
col_servers.AddAttribute (server_renderer, "text", 0);
treeview_servers.Model = server_model;
var col_users = new TreeViewColumn { Title = "Users" };
var user_renderer = new CellRendererText ();
col_users.PackStart (user_renderer, true);
treeview_users.AppendColumn (col_users);
col_users.AddAttribute (user_renderer, "text", 0);
treeview_users.Model = user_model;
client.Connected += (hostname, port) => server_model.AppendValues (hostname);
client.LoggedIn += (sender, e) => {
};
client.ChannelJoined += channel => {
lbl_topic.Text = channel;
TreeIter iter;
server_model.GetIter (out iter, new TreePath ("0"));
server_model.AppendValues (iter, channel);
};
client.NamesObtained += names => {
user_model.Clear ();
foreach (var name in names)
user_model.AppendValues (name);
};
client.ChannelMessage += async (message, sender) => {
textbuf.Enqueue (string.Format ("[{0}] {1}\n", sender, message));
if (updating)
return;
updating = true;
await Task.Factory.StartNew (() => {
Application.Invoke (delegate {
var iter = txt_chat.Buffer.EndIter;
while (textbuf.Count > 0) {
string value;
if (textbuf.TryDequeue (out value))
txt_chat.Buffer.Insert (ref iter, value);
}
});
});
updating = false;
};
client.Connect ("int0x10.com", 6697, true);
client.LogIn ("spl1tty", "spl1tty", "spl1tty");
}