📄 profileform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using gowk.core.managers;
using gowk.core.packets;
using gowk.core;
namespace gowk.forms
{
/// <summary>
/// ProfileForm 的摘要说明。
/// </summary>
public class ProfileForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tbasic;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TabPage pcontact;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label15;
private gowk.controls.GTextBox txtjid;
private gowk.controls.GTextBox txtnike;
private gowk.controls.GTextBox txtname;
private System.Windows.Forms.TextBox txtdesc;
private System.Windows.Forms.PictureBox pic;
private gowk.controls.GTextBox txtoccupation;
private gowk.controls.GTextBox txtsex;
private gowk.controls.GTextBox txtbday;
private gowk.controls.GTextBox txtcountry;
private gowk.controls.GTextBox txtprovince;
private gowk.controls.GTextBox txtcity;
private gowk.controls.GTextBox txtpostal;
private gowk.controls.GTextBox txthome;
private gowk.controls.GTextBox txtmobile;
private gowk.controls.GTextBox txtphone;
private gowk.controls.GTextBox txtemail;
private gowk.controls.GTextBox txtaddress;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
gowk.core.managers.vCardManager vm;
string jid;
public ProfileForm(gowk.core.JabberClient jc,string jid)
{
this.jid=jid;
this.vm=(vCardManager)jc.Managers[typeof(vCardManager)];
this.vm.GetVCard(jid,new gowk.core.JabberCallBack(this.GetVcardCallback),7000);
InitializeComponent();
this.txtjid.Text=this.jid;
}
private void GetVcardCallback(gowk.core.JabberEventArgs e)
{
if(e.ReplyPacket==null)return;
gowk.core.packets.VCardIQ iq=(VCardIQ)e.ReplyPacket;
VCard v=iq.vCard;
if(v==null)return;
if(v.PHOTO!=null && v.PHOTO.Length>0)
{
try
{
System.IO.MemoryStream ms=new System.IO.MemoryStream(v.PHOTO);
Image img=Image.FromStream(ms);
this.pic.Image=img;
ms.Close();
}
catch{}
}
this.txtnike.Text=v.NICKNAME;
/* if(v.N!=null)
{
this.txtname.Text=v.N.GIVEN+v.N.MIDDLE+v.N.FAMILY;
}*/
this.txtname.Text=v.FN;
this.txtoccupation.Text=v.TITLE;
this.txtsex.Text=v.GENDER;
this.txtbday.Text=v.BDAY;
this.txtdesc.Text=v.DESC;
// this.txtcountry.Text=
// this.txtcity.Text=
// this.txtprovince.Text=
// this.txtpostal=v.
// this.txtaddress.Text=
this.txthome.Text=v.URL;
// this.txtmobile.Text=
if(v.EMAILs!=null && v.EMAILs.Length>0)
{
this.txtemail.Text=v.EMAILs[0].USERID;
}
}
/// <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.tabControl1 = new System.Windows.Forms.TabControl();
this.tbasic = new System.Windows.Forms.TabPage();
this.txtdesc = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pcontact = new System.Windows.Forms.TabPage();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.pic = new System.Windows.Forms.PictureBox();
this.label15 = new System.Windows.Forms.Label();
this.txtjid = new gowk.controls.GTextBox();
this.txtnike = new gowk.controls.GTextBox();
this.txtname = new gowk.controls.GTextBox();
this.txtoccupation = new gowk.controls.GTextBox();
this.txtsex = new gowk.controls.GTextBox();
this.txtbday = new gowk.controls.GTextBox();
this.txtcountry = new gowk.controls.GTextBox();
this.txtprovince = new gowk.controls.GTextBox();
this.txtcity = new gowk.controls.GTextBox();
this.txtpostal = new gowk.controls.GTextBox();
this.txtaddress = new gowk.controls.GTextBox();
this.txthome = new gowk.controls.GTextBox();
this.txtmobile = new gowk.controls.GTextBox();
this.txtphone = new gowk.controls.GTextBox();
this.txtemail = new gowk.controls.GTextBox();
this.tabControl1.SuspendLayout();
this.tbasic.SuspendLayout();
this.pcontact.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tbasic);
this.tabControl1.Controls.Add(this.pcontact);
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(376, 269);
this.tabControl1.TabIndex = 0;
//
// tbasic
//
this.tbasic.Controls.Add(this.txtbday);
this.tbasic.Controls.Add(this.txtsex);
this.tbasic.Controls.Add(this.txtoccupation);
this.tbasic.Controls.Add(this.txtname);
this.tbasic.Controls.Add(this.txtnike);
this.tbasic.Controls.Add(this.txtjid);
this.tbasic.Controls.Add(this.pic);
this.tbasic.Controls.Add(this.label15);
this.tbasic.Controls.Add(this.txtdesc);
this.tbasic.Controls.Add(this.label8);
this.tbasic.Controls.Add(this.label6);
this.tbasic.Controls.Add(this.label5);
this.tbasic.Controls.Add(this.label4);
this.tbasic.Controls.Add(this.label3);
this.tbasic.Controls.Add(this.label2);
this.tbasic.Controls.Add(this.label1);
this.tbasic.Location = new System.Drawing.Point(4, 21);
this.tbasic.Name = "tbasic";
this.tbasic.Size = new System.Drawing.Size(368, 244);
this.tbasic.TabIndex = 0;
this.tbasic.Text = "基本资料";
//
// txtdesc
//
this.txtdesc.Anchor = System.Windows.Forms.AnchorStyles.None;
this.txtdesc.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtdesc.Location = new System.Drawing.Point(76, 155);
this.txtdesc.Multiline = true;
this.txtdesc.Name = "txtdesc";
this.txtdesc.Size = new System.Drawing.Size(256, 72);
this.txtdesc.TabIndex = 10;
this.txtdesc.Text = "";
//
// label8
//
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label8.Location = new System.Drawing.Point(36, 155);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 23);
this.label8.TabIndex = 9;
this.label8.Text = "说明";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.Location = new System.Drawing.Point(36, 120);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(32, 23);
this.label6.TabIndex = 7;
this.label6.Text = "职业";
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label5.Location = new System.Drawing.Point(188, 120);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 24);
this.label5.TabIndex = 6;
this.label5.Text = "生日";
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label4.Location = new System.Drawing.Point(36, 88);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 24);
this.label4.TabIndex = 5;
this.label4.Text = "姓名";
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label3.Location = new System.Drawing.Point(188, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 16);
this.label3.TabIndex = 4;
this.label3.Text = "性别";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.Location = new System.Drawing.Point(36, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(40, 16);
this.label2.TabIndex = 3;
this.label2.Text = "昵称";
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.Location = new System.Drawing.Point(36, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 16);
this.label1.TabIndex = 2;
this.label1.Text = "JID";
//
// pcontact
//
this.pcontact.Controls.Add(this.txtemail);
this.pcontact.Controls.Add(this.txtphone);
this.pcontact.Controls.Add(this.txtmobile);
this.pcontact.Controls.Add(this.txthome);
this.pcontact.Controls.Add(this.txtaddress);
this.pcontact.Controls.Add(this.txtpostal);
this.pcontact.Controls.Add(this.txtcity);
this.pcontact.Controls.Add(this.txtprovince);
this.pcontact.Controls.Add(this.txtcountry);
this.pcontact.Controls.Add(this.label7);
this.pcontact.Controls.Add(this.label22);
this.pcontact.Controls.Add(this.label21);
this.pcontact.Controls.Add(this.label20);
this.pcontact.Controls.Add(this.label19);
this.pcontact.Controls.Add(this.label16);
this.pcontact.Controls.Add(this.label14);
this.pcontact.Controls.Add(this.label13);
this.pcontact.Controls.Add(this.label12);
this.pcontact.Location = new System.Drawing.Point(4, 21);
this.pcontact.Name = "pcontact";
this.pcontact.Size = new System.Drawing.Size(368, 244);
this.pcontact.TabIndex = 1;
this.pcontact.Text = "联系方式";
//
// label22
//
this.label22.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label22.Location = new System.Drawing.Point(73, 208);
this.label22.Name = "label22";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -