private void btnCloud_Click(object sender, RoutedEventArgs e) { // 取得目前所有有效的PNRP Cloud CloudCollection clouds = Cloud.GetAvailableClouds(); if (clouds.Count > 0) { lstCloud.Items.Clear(); } else { MessageBox.Show("No Clouds Found", "P2P", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (Cloud cloud in clouds) { // 取得PNRP Cloud的名稱與網路範圍 lstCloud.Items.Add(cloud.Name + ", " + cloud.Scope); } }
/// <summary> /// 显示群信息 /// </summary> public void ShowCloudList() { CloudCollection clouds = Cloud.GetAvailableClouds(); textBoxCloud.Text = String.Format("发现{0}个群\r\n\r\n", clouds.Count); String strSomeCloudInfo = ""; int index = 0; foreach (Cloud someCloud in clouds) { index++; strSomeCloudInfo += String.Format("第{0}个群\r\n", index); strSomeCloudInfo += String.Format("群名称:{0}\r\n", someCloud.Name); strSomeCloudInfo += String.Format("群编号:{0}\r\n", someCloud.ScopeId); strSomeCloudInfo += String.Format("群范围:{0}\r\n\r\n", someCloud.Scope); textBoxCloud.Text += strSomeCloudInfo; strSomeCloudInfo = ""; } }