📄 presenceform2.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using gowk.core.packets;
using gowk.core;
using gowk.core.managers;
namespace gowk
{
/// <summary>
/// PresenceForm 的摘要说明。
/// </summary>
public class PresenceForm2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label notify;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.RichTextBox txtMessage;
JabberClient jc;
string to;
private System.Windows.Forms.Button button1;
string nick;
public PresenceForm2(gowk.core.JabberClient jc,string to,string nick)
{
InitializeComponent();
this.nick=nick;
this.to=to;
this.jc=jc;
this.notify.Text="您要添加以下用户吗?:\n"+to;
}
/// <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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PresenceForm2));
this.txtMessage = new System.Windows.Forms.RichTextBox();
this.notify = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.button4 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtMessage
//
this.txtMessage.Location = new System.Drawing.Point(16, 64);
this.txtMessage.Name = "txtMessage";
this.txtMessage.Size = new System.Drawing.Size(360, 96);
this.txtMessage.TabIndex = 0;
this.txtMessage.Text = "";
//
// notify
//
this.notify.Location = new System.Drawing.Point(56, 16);
this.notify.Name = "notify";
this.notify.Size = new System.Drawing.Size(248, 40);
this.notify.TabIndex = 1;
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(16, 16);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(24, 24);
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Location = new System.Drawing.Point(328, 8);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(48, 48);
this.pictureBox2.TabIndex = 6;
this.pictureBox2.TabStop = false;
//
// button4
//
this.button4.Location = new System.Drawing.Point(224, 168);
this.button4.Name = "button4";
this.button4.TabIndex = 7;
this.button4.Text = "加为好友";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(304, 168);
this.button1.Name = "button1";
this.button1.TabIndex = 8;
this.button1.Text = "取消";
this.button1.Click += new System.EventHandler(this.button3_Click);
//
// PresenceForm2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(384, 197);
this.Controls.Add(this.button1);
this.Controls.Add(this.button4);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.notify);
this.Controls.Add(this.txtMessage);
this.Name = "PresenceForm2";
this.ResumeLayout(false);
}
#endregion
private void button4_Click(object sender, System.EventArgs e)
{
RosterManager rm=(RosterManager)this.jc.Managers[typeof(RosterManager)];
rm.AddContact(to,this.nick,"我的好友",null,0);
PresenceManager pm=(PresenceManager)this.jc.Managers[typeof(PresenceManager)];
pm.DoSubcribe(to,this.txtMessage.Text,null,0);
this.Close();
}
private void button3_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -