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

📄 form1.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;using System.Xml.Serialization;
using System.Net.Sockets;using System.Xml;


using gowk.core.packets;
using gowk.core.managers;
namespace gowk.core
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			/*jc=new JabberClient();
			jc.Logined+=new JabberEventHandler(jc_Logined);
			jc.Roster+=new JabberEventHandler(jc_Roster);
			jc.Password="waxmgp541";
			jc.Jid=new Jid("gowhcy","jabber.org","gowk");
			jc.Port=5222;
			jc.Password="gow";
			jc.Jid=new Jid("gow","localhost","gowk");
			jc.Port=5222;
			jc.Proxy=new gowk.net.Proxy();
			jc.Proxy.Port=555;
			jc.Proxy.Host="192.168.0.1";
			jc.Control=this;
			jc.MessageManager.ChatMessageReceived+=new JabberEventHandler(MessageManager_ChatMessageReceived);*/
			jc=new JabberClient();
			jc.Password="waxmgp541";
			jc.Jid=new Jid("gowhcy","jabber.org","gowk");
			jc.Port=5222;
			/*jc.Password="gow";
			jc.Jid=new Jid("gow","localhost","gowk");
			jc.Port=5222;*/
			jc.Proxy=new gowk.net.Proxy();
			jc.Proxy.Port=555;
			jc.Proxy.Host="192.168.0.1";
			jc.Control=this;		
			
			AuthenticateManager am=new AuthenticateManager(jc);
			am.LoginResult+=new JabberEventHandler(am_LoginResult);
			jc.Managers.Add(typeof(AuthenticateManager),am);
			this.jc.Connect();
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.button3 = new System.Windows.Forms.Button();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.button2 = new System.Windows.Forms.Button();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.treeView1 = new System.Windows.Forms.TreeView();
			this.button1 = new System.Windows.Forms.Button();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			this.SuspendLayout();
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(72, 184);
			this.button3.Name = "button3";
			this.button3.TabIndex = 3;
			this.button3.Text = "login";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.tabControl1.Location = new System.Drawing.Point(0, 0);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(292, 273);
			this.tabControl1.TabIndex = 6;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.button1);
			this.tabPage1.Controls.Add(this.button2);
			this.tabPage1.Controls.Add(this.button3);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(284, 248);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "tabPage1";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(192, 104);
			this.button2.Name = "button2";
			this.button2.TabIndex = 4;
			this.button2.Text = "button2";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// tabPage2
			// 
			this.tabPage2.Controls.Add(this.splitter1);
			this.tabPage2.Controls.Add(this.treeView1);
			this.tabPage2.Location = new System.Drawing.Point(4, 21);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(284, 248);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "tabPage2";
			// 
			// splitter1
			// 
			this.splitter1.Location = new System.Drawing.Point(136, 0);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(3, 248);
			this.splitter1.TabIndex = 3;
			this.splitter1.TabStop = false;
			// 
			// treeView1
			// 
			this.treeView1.Dock = System.Windows.Forms.DockStyle.Left;
			this.treeView1.ImageIndex = -1;
			this.treeView1.Location = new System.Drawing.Point(0, 0);
			this.treeView1.Name = "treeView1";
			this.treeView1.SelectedImageIndex = -1;
			this.treeView1.Size = new System.Drawing.Size(136, 248);
			this.treeView1.TabIndex = 2;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(216, 176);
			this.button1.Name = "button1";
			this.button1.TabIndex = 5;
			this.button1.Text = "button1";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Controls.Add(this.tabControl1);
			this.Name = "Form1";
			this.Text = "Form1";
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.TreeView treeView1;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button1;

		JabberClient jc;
		private void button3_Click(object sender, System.EventArgs e)
		{
			AuthenticateManager am=(AuthenticateManager)this.jc.Managers[typeof(gowk.core.managers.AuthenticateManager)];
			am.Login();
		}

		protected override void OnClosed(EventArgs e)
		{
			this.jc.Disconnect();
			base.OnClosed (e);
		}

		private void am_LoginResult(JabberEventArgs e)
		{

		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			this.jc.Disconnect();
			this.jc.Connect();
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
		
			gowk.core.packets.IQ iq=new gowk.core.packets.IQ();
			gowk.core.packets.querys.RosterQuery rq=new gowk.core.packets.querys.RosterQuery();
			gowk.core.packets.querys.Item itm=new gowk.core.packets.querys.Item();
			itm.Jid="gowhcy@jjj.com";
			iq.Query=rq;
			rq.Items=new gowk.core.packets.querys.Item[]{itm};
			string s=gowk.core.serizlize.JabberSerizlizer.Instance.Serialize(iq);
		}
	}
}

⌨️ 快捷键说明

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