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


C# UserModel.Clear方法代码示例

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


在下文中一共展示了UserModel.Clear方法的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");
	}
开发者ID:GuardianRG,项目名称:Animus,代码行数:61,代码来源:MainWindow.cs


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