📄 presenceform.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.forms
{
/// <summary>
/// PresenceForm 的摘要说明。
/// </summary>
public class PresenceForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label notify;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
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;
Presence p;
gowk.core.managers.PresenceManager pm;
public PresenceForm(gowk.core.JabberClient jc,gowk.core.packets.Presence p)
{
InitializeComponent();
this.p=p;
this.jc=jc;
this.txtMessage.Text=p.Status;
this.notify.Text="以下用户请求加您:\n"+p.From;
pm=(PresenceManager)jc.Managers[typeof(PresenceManager)];
}
/// <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(PresenceForm));
this.txtMessage = new System.Windows.Forms.RichTextBox();
this.notify = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.button4 = 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;
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 168);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(40, 23);
this.button1.TabIndex = 3;
this.button1.Text = "接受";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(280, 168);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(40, 23);
this.button2.TabIndex = 4;
this.button2.Text = "拒绝";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(328, 168);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(48, 23);
this.button3.TabIndex = 5;
this.button3.Text = "取消";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// 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(16, 168);
this.button4.Name = "button4";
this.button4.TabIndex = 7;
this.button4.Text = "加为好友";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// PresenceForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(384, 197);
this.Controls.Add(this.button4);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.notify);
this.Controls.Add(this.txtMessage);
this.Name = "PresenceForm";
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
this.pm.DoSubcribed(p.From,null,0);
}
private void button4_Click(object sender, System.EventArgs e)
{
this.pm.DoSubcribe(p.From,null,null,0);
}
private void button2_Click(object sender, System.EventArgs e)
{
this.pm.DoUnsubcribed(p.From,null,0);
}
private void button3_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -