예제 #1
0
 public VcardIq(IqType type, Jid to, Jid from, Vcard vcard)
     : this(type, to, from)
 {
     this.Vcard = vcard;
 }
예제 #2
0
 public VcardIq(IqType type, Jid to, Vcard vcard)
     : this(type, to)
 {
     this.Vcard = vcard;
 }
예제 #3
0
        /// <summary>
        /// 回调保存基本资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="iq"></param>
        /// <param name="data"></param>
        private void SaveVcardResult(object sender, IQ iq, object data)
        {
            if (InvokeRequired)
            {
                // Windows Forms are not Thread Safe, we need to invoke this :(
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new IqCB(SaveVcardResult), new object[] { sender, iq, data });
                return;
            }

            if (iq.Type == IqType.result)
            {
                //this.tab_state.Text = "";
                Util.vcard = SaveVcard;
                SaveVcard = null;

                GetVcardResult();

                Util.VcardChangeEventMethod();//通知名片更新事件

                MsgBox.Show(this, "CSS&IM", "基本资料保存成功!", MessageBoxButtons.OK);
            }
            else
            {
                //this.tab_state.Text = "";
                MsgBox.Show(this, "CSS&IM", "基本资料保存失败", MessageBoxButtons.OK);
            }
        }
예제 #4
0
 public VcardIq(IqType type, Vcard vcard)
     : this(type)
 {
     this.Vcard = vcard;
 }
예제 #5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_save_Click(object sender, EventArgs e)
        {
            //if (txt_name.Texts.Trim().Length == 0)
            //{
            //    MsgBox.Show(this, "CSS&IM", "名字不能为空!", MessageBoxButtons.OK);
            //    return;
            //}

            if (txt_nickname.Texts.Trim().Length == 0)
            {
                txt_nickname.Texts = "";
                //MsgBox.Show(this, "CSS&IM", "名字不能为空!", MessageBoxButtons.OK);
                //return;
            }

            if (txt_desc.Texts.Trim().Length == 0)
            {
                txt_desc.Texts = "";
                //MsgBox.Show(this, "CSS&IM", "名字不能为空!", MessageBoxButtons.OK);
                //return;
            }

            //this.tab_state.Text = "数据更新中请等待……!";

            SaveVcard = new Vcard();
            SaveVcard.SetTag("sex", txt_sex.SelectText);//性别
            SaveVcard.Fullname = txt_name.Texts.ToString();//名字
            SaveVcard.Nickname = txt_nickname.Texts.ToString();//昵称
            SaveVcard.Birthday = txt_bar.Value;//生日

            Telephone telephone1 = new Telephone(TelephoneLocation.HOME, TelephoneType.VOICE, txt_phone1.Texts);//电话
            SaveVcard.AddTelephoneNumber(telephone1);
            Telephone telephone2 = new Telephone(TelephoneLocation.HOME, TelephoneType.CELL, txt_phone2.Texts);//手机
            SaveVcard.AddTelephoneNumber(telephone2);
            Email email = new Email(EmailType.HOME, txt_email.Texts, true);//邮箱
            SaveVcard.AddEmailAddress(email);
            Telephone telephone3 = new Telephone(TelephoneLocation.HOME, TelephoneType.FAX, txt_fox.Texts);//传真
            SaveVcard.AddTelephoneNumber(telephone3);
            SaveVcard.Title = txt_job.Texts;//职务
            SaveVcard.Description = txt_desc.Texts.ToString();//个人签名

            Organization org = new Organization(txt_companyName.Texts, txt_depar.Texts);//公司名称
            SaveVcard.Organization = org;

            Address address1=new Address(AddressLocation.WORK,"",txt_county.Texts,"",txt_province.Texts,txt_postalCode.Texts,txt_companyAddress.Texts,true);
            SaveVcard.AddAddress(address1);
            SaveVcard.Url = txt_companyDefault.Texts;

            Address address2 = new Address(AddressLocation.HOME, "", txt_meMarsk.Texts, "", txt_meDefault.Texts, "", "", true);
            SaveVcard.AddAddress(address2);

            Photo po = new Photo(pic_top.Image, ImageFormat.Jpeg);
            SaveVcard.Photo = po;

            VcardIq viq = new VcardIq(IqType.set, null, new Jid(XmppConn.MyJID.User), SaveVcard);
            XmppConn.IqGrabber.SendIq(viq, new IqCB(SaveVcardResult), null);
        }