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

📄 sendrequestform.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 5 页
字号:
                            string str7 = string.Empty;
                            foreach (int num3 in contact2.BelongToGroups)
                            {
                                Imps.Client.Core.ContactGroup group2 = this._user.ContactList.Groups[new int?(num3)] as Imps.Client.Core.ContactGroup;
                                if (group2 != null)
                                {
                                    str7 = group2.Name;
                                    if (str7.Length > 20)
                                    {
                                        str7 = str7.Substring(0, 20) + "...";
                                    }
                                    break;
                                }
                            }
                            if (str7.Length > 0)
                            {
                                str8 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy_WithGroup, contact2.DisplayName, str7);
                            }
                            else
                            {
                                str8 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy, contact2.DisplayName);
                            }
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, str8);
                            return;
                        }
                        isByMobileNo = false;
                        id = uri2.Sid.ToString();
                    }
                    targetGroupId = nullable;
                    localName = (this._lastContactNickname == this.xTextBoxNickname.Text.Trim()) ? string.Empty : this.xTextBoxNickname.Text.Trim();
                    extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
                    extraData.WhoAmI = this.textBoxMyName.Text.Trim();
                    sendRequestAgain = true;
                    copyWhenExist = false;
                    invite = null;
                }
                else if (this.tabControlAddBuddy.SelectedIndex == 1)
                {
                    domain = "vodafone";
                    if (this.radioButtonMobileNoV.Checked)
                    {
                        if (this.xTextBoxMobileNoV.Text.Trim().Length == 0)
                        {
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.AddBuddy_MobileNoEmpty);
                            this.xTextBoxMobileNoV.Focus();
                            return;
                        }
                        if (!this.xTextBoxMobileNoV.Text.Trim().StartsWith("+"))
                        {
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.InvalidInternalMobileNo);
                            this.xTextBoxMobileNoV.Focus();
                            return;
                        }
                        string str9 = this.xTextBoxMobileNoV.Text.Trim();
                        if (str9 == this._user.PersonalInfo.MobileNo)
                        {
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.CannotAddYouself);
                            return;
                        }
                        Imps.Client.Core.Contact contact3 = this._user.ContactList.FindContactByMsisdnEx(str9.ToString());
                        if ((contact3 != null) && (contact3.RelationStatus == 1))
                        {
                            string str11;
                            string str10 = string.Empty;
                            foreach (int num4 in contact3.BelongToGroups)
                            {
                                Imps.Client.Core.ContactGroup group3 = this._user.ContactList.Groups[new int?(num4)] as Imps.Client.Core.ContactGroup;
                                if (group3 != null)
                                {
                                    str10 = group3.Name;
                                    if (str10.Length > 20)
                                    {
                                        str10 = str10.Substring(0, 20) + "...";
                                    }
                                    break;
                                }
                            }
                            if (str10.Length > 0)
                            {
                                str11 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy_WithGroup, contact3.DisplayName.Replace("&", "&&"), str10);
                            }
                            else
                            {
                                str11 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy, contact3.DisplayName.Replace("&", "&&"));
                            }
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, str11);
                            return;
                        }
                        isByMobileNo = true;
                        id = this.xTextBoxMobileNoV.Text.Trim();
                        targetGroupId = nullable;
                        localName = string.Empty;
                        extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
                        extraData.WhoAmI = string.Empty;
                        sendRequestAgain = true;
                        copyWhenExist = false;
                        invite = null;
                    }
                    else
                    {
                        if (this.xTextBoxSIDV.Text.Trim().Length == 0)
                        {
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.PlsInputVodafoneMessengerID);
                            this.xTextBoxSIDV.Focus();
                            return;
                        }
                        long sid = Convert.ToInt64(this.xTextBoxSIDV.Text);
                        if (sid == this._user.Sid)
                        {
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, StringTable.Contact.CannotAddYouself);
                            return;
                        }
                        IicUri uri3 = IicUri.CreateSidUri(sid, "vodafone");
                        Imps.Client.Core.Contact contact4 = this._user.ContactList.Contacts[uri3.Raw];
                        if ((contact4 != null) && (contact4.RelationStatus == 1))
                        {
                            string str13;
                            string str12 = string.Empty;
                            foreach (int num6 in contact4.BelongToGroups)
                            {
                                Imps.Client.Core.ContactGroup group4 = this._user.ContactList.Groups[new int?(num6)] as Imps.Client.Core.ContactGroup;
                                if (group4 != null)
                                {
                                    str12 = group4.Name;
                                    if (str12.Length > 20)
                                    {
                                        str12 = str12.Substring(0, 20) + "...";
                                    }
                                    break;
                                }
                            }
                            if (str12.Length > 0)
                            {
                                str13 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy_WithGroup, contact4.DisplayName, str12);
                            }
                            else
                            {
                                str13 = string.Format(StringTable.Contact.ContactAlreadyExistInBuddy, contact4.DisplayName);
                            }
                            this._frameworkWindow.UnifiedMessageBox.ShowWarning(this, str13);
                            return;
                        }
                        isByMobileNo = false;
                        id = uri3.Sid.ToString();
                        targetGroupId = nullable;
                        localName = string.Empty;
                        extraData = new Imps.Client.Core.ContactList.AddBuddyExtraData();
                        extraData.WhoAmI = string.Empty;
                        sendRequestAgain = true;
                        copyWhenExist = false;
                        invite = null;
                    }
                    localName = this.xTextBoxNicknameV.Text.Trim();
                }
                op.Successed += new EventHandler(this.op_Successed);
                op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this.op_ImpsError);
                this._user.ContactList.AsyncAddBuddy(isByMobileNo, id, domain, targetGroupId, localName, extraData, sendRequestAgain, copyWhenExist, invite, op);
                this.buttonCancel.Enabled = true;
                this.tabControlAddBuddy.Enabled = false;
                this.buttonOK.Enabled = false;
            }
            catch
            {
            }
        }

        private void clearContactInfo()
        {
            this.xTextBoxNickname.Text = string.Empty;
            this.pictureBoxPortrait.Visible = false;
            this.pictureBoxPortrait.Image = ImpsPortrait.GetDefaultPortrait(0x40, 0x40);
            this.linkLabelDetail.Visible = false;
            this.labelAlert.Visible = false;
            this.labelSetNickname.Text = StringTable.AddBuddy.SetNickname;
        }

        private void contactInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
        {
            if (e.ContainsProperty("nickname"))
            {
                this._lastContactNickname = ((Imps.Client.Core.ContactInfo) sender).Owner.PersonalInfo.Nickname.Value;
                this.showContactInfo(((Imps.Client.Core.ContactInfo) sender).Owner.PersonalInfo);
            }
            else if (e.ContainsProperty("Provision"))
            {
                this.showContactInfo(((Imps.Client.Core.ContactInfo) sender).Owner.PersonalInfo);
            }
        }

        private void ContactList_ContactGroupChanged(object sender, ContactGroupChangedEventArgs e)
        {
            if (e.Type == ContactGroupEventType.Added)
            {
                this._initTargetGroupId = new int?(e.ContactGroup.Id);
                this._initTargetGroupIdV = new int?(e.ContactGroup.Id);
            }
            else if (e.Type == ContactGroupEventType.Deleted)
            {
                if (e.ContactGroup.Id == this._initTargetGroupId)
                {
                    this._initTargetGroupId = null;
                }
                if (e.ContactGroup.Id == this._initTargetGroupIdV)
                {
                    this._initTargetGroupIdV = null;
                }
            }
            else
            {
                if (e.Type == ContactGroupEventType.ContactCountChanged)
                {
                    return;
                }
                ContactGroupEventType type = e.Type;
            }
            this.initGroup();
            this.initGroupVodafone();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void findContactByMobileNoVodafone()
        {
        }

        private void findContactByMobileOrSid(bool isMobileNo)
        {
            IicUri uri;
            Imps.Client.Core.Contact contact;
            this.LastContact = null;
            AsyncBizOperation op = new AsyncBizOperation();
            op.IsImpsErrorHandled = true;
            if (isMobileNo)
            {
                if (this.textBoxMobileNo.Text.Length != 11)
                {
                    return;
                }
                uri = IicUri.CreateTelUri(this.textBoxMobileNo.Text.Trim());
                contact = this._user.ContactList.FindContactByMsisdnEx(uri.MobileNo);
                if (contact == null)

⌨️ 快捷键说明

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