⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchform.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label4.Text = "年龄";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(40, 104);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 23);
			this.label3.TabIndex = 12;
			this.label3.Text = "城市";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(40, 80);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 23);
			this.label2.TabIndex = 11;
			this.label2.Text = "省份";
			// 
			// cbcam
			// 
			this.cbcam.Location = new System.Drawing.Point(216, 45);
			this.cbcam.Name = "cbcam";
			this.cbcam.Size = new System.Drawing.Size(88, 24);
			this.cbcam.TabIndex = 9;
			this.cbcam.Text = "有摄像头";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(88, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(184, 16);
			this.label1.TabIndex = 8;
			this.label1.Text = "选择查询条件";
			// 
			// cbonline
			// 
			this.cbonline.Location = new System.Drawing.Point(80, 45);
			this.cbonline.Name = "cbonline";
			this.cbonline.Size = new System.Drawing.Size(80, 24);
			this.cbonline.TabIndex = 7;
			this.cbonline.Text = "在线用户";
			// 
			// pictureBox2
			// 
			this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
			this.pictureBox2.Location = new System.Drawing.Point(24, 24);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(32, 32);
			this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.pictureBox2.TabIndex = 6;
			this.pictureBox2.TabStop = false;
			// 
			// presult
			// 
			this.presult.Controls.Add(this.btnclose);
			this.presult.Controls.Add(this.btnshowprofile);
			this.presult.Controls.Add(this.btnadd);
			this.presult.Controls.Add(this.lstUsers);
			this.presult.Location = new System.Drawing.Point(4, 21);
			this.presult.Name = "presult";
			this.presult.Size = new System.Drawing.Size(344, 204);
			this.presult.TabIndex = 1;
			this.presult.Text = "高级查找";
			// 
			// btnclose
			// 
			this.btnclose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btnclose.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.btnclose.IsRound = true;
			this.btnclose.Location = new System.Drawing.Point(280, 180);
			this.btnclose.Name = "btnclose";
			this.btnclose.Size = new System.Drawing.Size(60, 20);
			this.btnclose.TabIndex = 11;
			this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
			// 
			// btnshowprofile
			// 
			this.btnshowprofile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btnshowprofile.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.btnshowprofile.IsRound = true;
			this.btnshowprofile.Location = new System.Drawing.Point(152, 180);
			this.btnshowprofile.Name = "btnshowprofile";
			this.btnshowprofile.Size = new System.Drawing.Size(60, 20);
			this.btnshowprofile.TabIndex = 10;
			this.btnshowprofile.Click += new System.EventHandler(this.btnshowprofile_Click);
			// 
			// btnadd
			// 
			this.btnadd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.btnadd.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnadd.BackgroundImage")));
			this.btnadd.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.btnadd.IsRound = true;
			this.btnadd.Location = new System.Drawing.Point(216, 180);
			this.btnadd.Name = "btnadd";
			this.btnadd.Size = new System.Drawing.Size(60, 20);
			this.btnadd.TabIndex = 9;
			this.btnadd.Click += new System.EventHandler(this.btnadd_Click);
			// 
			// lstUsers
			// 
			this.lstUsers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																					   this.cjid,
																					   this.cnick,
																					   this.cgender,
																					   this.cage,
																					   this.cfrom,
																					   this.cvideo});
			this.lstUsers.Dock = System.Windows.Forms.DockStyle.Top;
			this.lstUsers.FullRowSelect = true;
			this.lstUsers.GridLines = true;
			this.lstUsers.Location = new System.Drawing.Point(0, 0);
			this.lstUsers.Name = "lstUsers";
			this.lstUsers.Size = new System.Drawing.Size(344, 176);
			this.lstUsers.TabIndex = 8;
			this.lstUsers.View = System.Windows.Forms.View.Details;
			this.lstUsers.DoubleClick += new System.EventHandler(this.lstUsers_DoubleClick);
			// 
			// cjid
			// 
			this.cjid.Text = "jid";
			this.cjid.Width = 107;
			// 
			// cnick
			// 
			this.cnick.Text = "昵称";
			this.cnick.Width = 65;
			// 
			// cgender
			// 
			this.cgender.Text = "性别";
			this.cgender.Width = 38;
			// 
			// cage
			// 
			this.cage.Text = "年龄";
			this.cage.Width = 42;
			// 
			// cfrom
			// 
			this.cfrom.Text = "来自";
			// 
			// cvideo
			// 
			this.cvideo.Text = "视频";
			this.cvideo.Width = 36;
			// 
			// gTooltipEX1
			// 
			this.gTooltipEX1.MaxTipWidth = 200;
			// 
			// SearchForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(352, 229);
			this.Controls.Add(this.tc);
			this.Name = "SearchForm";
			this.Text = "gowk查找添加好友";
			this.tc.ResumeLayout(false);
			this.pcondition.ResumeLayout(false);
			this.presult.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		#endregion
		private void tabPage1_Click(object sender, System.EventArgs e)
		{
		
		}
		private void Notify(string txt)
		{
			int x=this.Left+this.tc.GetTabRect(1).Right;
			int y=this.Top+SystemInformation.CaptionHeight+SystemInformation.FrameBorderSize.Height;
			this.gTooltipEX1.Show(txt,new Point(x,y));
		}
		private void SearchCallback(gowk.core.JabberEventArgs jea)
		{
			this.BeginInvoke(new JabberCallBack(this.SearchCallback2),new object[]{jea});
		}
		private void SearchCallback2(gowk.core.JabberEventArgs jea)
		{
			this.btnsearch.Enabled=true;
			if(jea.ReplyPacket==null)
			{
				this.Notify("超时");
			}
			else if(jea.ReplyPacket.Type==gowk.core.packets.PacketType.result)
			{
				IQ iq=(IQ)jea.ReplyPacket;
				System.Diagnostics.Debug.Assert(iq.Query!=null);
				SearchQuery sq=(SearchQuery)iq.Query;
				SearchQuery.item[] itms=sq.Item;
				if(itms==null ||itms.Length<1)
				{
					this.Notify("查不到记录");
				}
				else
				{
					//	this.BeginInvoke(new ShowResultDeleagate(this.ShowResult),new object[]{itms});
					this.ShowResult(itms);
					this.Notify("找到"+itms.Length +"条记录");
				}
			}
			else
			{
				this.Notify("错误");
			}
		}
		//private delegate void ShowResultDeleagate(SearchQuery.item[] itms);
		private void ShowResult(SearchQuery.item[] itms)
		{
			this.lstUsers.Items.Clear();
			foreach(SearchQuery.item itm in itms)
			{
				string gender=itm.gender;
				if(gender=="female")gender="女";
				else if(gender=="male")gender="男";
				ListViewItem lvi=this.lstUsers.Items.Add(itm.jid);
				lvi.SubItems.AddRange(new string[]{itm.nick,gender,null,null,null});
		/*		this.cjid,
																					   this.cnick,
																					   this.cgender,
																					   this.cage,
																					   this.cfrom,
																					   this.cvideo*/
			}
			if(this.tc.SelectedIndex!=1)
			{
				this.tc.SelectedIndex=1;
			}
		}
		private void btnsearch_Click(object sender, System.EventArgs e)
		{
			this.btnsearch.Enabled=false;
			string gender=this.cmbgender.Text;
			if(this.cmbgender.Text.Trim()=="男")
			{
				gender="male";
			}
			else if(this.cmbgender.Text=="女")
			{
				gender="female";
			}
			this.sm.Search(
				null,
				null,
				this.txtnick.Text.Trim(),
				gender,
				this.txtemail.Text.Trim(),
				new JabberCallBack(this.SearchCallback),
				30000);
		}

		private void btnshowprofile_Click(object sender, System.EventArgs e)
		{
			this.ShowProfile();
		}
		private void ShowProfile()
		{
			if(this.lstUsers.SelectedItems.Count<1)return;
			string jid=this.lstUsers.SelectedItems[0].Text;
			string bare=Jid.GetBareJid(jid);
			string id=bare+"profileForm";
			ProfileForm pf=null;
			if(this._fs.ContainsKey(id))
			{
				pf=(ProfileForm)this._fs[id];
				if(!pf.Visible)pf.Visible=true;
				pf.Activate();
			}
			else
			{
				pf=new ProfileForm(this.jc,bare);
				this._fs.Add(id,pf);
				pf.Show();
			}
		}
		protected override void OnClosed(EventArgs e)
		{
			base.OnClosed (e);
			foreach(Form f in this._fs.Values)
			{
				f.Close();
			}
		}

		private void lstUsers_DoubleClick(object sender, System.EventArgs e)
		{
			this.ShowProfile();
		}

		
		private void btnadd_Click(object sender, System.EventArgs e)
		{
			if(this.lstUsers.SelectedItems.Count<1)return;
			ListViewItem item=this.lstUsers.SelectedItems[0];
			string jid=item.Text.Trim();
			string nick=item.SubItems[1].Text;

		PresenceForm2 f2=	new PresenceForm2(this.jc,jid,nick);
			f2.ShowDialog(this);
		/*	DialogResult ret=MessageBox.Show(this,"你确定要加以下用户:\n"+nick+"("+jid+")\n为好友吗","确认",MessageBoxButtons.OKCancel);
			if(ret!=DialogResult.OK)return;

			RosterManager rm=(RosterManager)this.jc.Managers[typeof(RosterManager)];
			rm.AddContact(jid,nick,"我的好友",null,0);
			PresenceManager pm=(PresenceManager)this.jc.Managers[typeof(PresenceManager)];
			/////////////////////////简直就是土牛,请求人家加你也不加一点附言~_~////////////////////////////
			pm.DoSubcribe(jid,null,0);			*/
		//	this.Notify("添加"+nick+"("+jid+")的请求已经发出,请等候回复");
		}

		private void btnclose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -