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

📄 inviteiicform.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.UIContactList
{
    using Imps.Client.Core;
    using Imps.Client.Pc;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Pc.Utils;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Utils;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    public class InviteIICForm : XIMDialog
    {
        private bool _hasDisplayTip;
        private IFrameworkWindow _iFrameworkWindow;
        private string _mobileNo = string.Empty;
        private Imps.Client.Core.User _user;
        private XButton buttonCancel;
        private XButton buttonOK;
        private IContainer components;
        private XLabel labelMobileNo;
        private XLabel labelMyName;
        private Panel panel1;
        private XTextBox textBoxMobileNo;
        private XTextBox textBoxMyName;

        public InviteIICForm(IFrameworkWindow iFrameworWindow, string mobileNo)
        {
            this.InitializeComponent();
            this._iFrameworkWindow = iFrameworWindow;
            this._user = this._iFrameworkWindow.AccountManager.CurrentUser;
            this._mobileNo = mobileNo ?? string.Empty;
            this.Init();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (this.textBoxMobileNo.Text.Trim().Length == 0)
            {
                BalloonHelper.ShowBallon(this.textBoxMobileNo, StringTable.Contact.AddBuddy_MobileNoEmpty, "错误!", 3, 0x7d0);
            }
            else if (!ImpsHelper.IsCmccMobileNo(Convert.ToInt64(this.textBoxMobileNo.Text)))
            {
                BalloonHelper.ShowBallon(this.textBoxMobileNo, StringTable.Contact.InvalidCmccMobileNo, "错误!", 3, 0x7d0);
            }
            else if (this.textBoxMyName.Text.Trim().Length == 0)
            {
                this._iFrameworkWindow.UnifiedMessageBox.ShowInfo(StringTable.Contact.AddBuddy_MyNameEmptyMobileNo);
            }
            else if (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text) > 10)
            {
                BalloonHelper.ShowBallon(this.textBoxMyName, StringTable.Contact.AddBuddy_MyNameTooLong, "请注意!", 1, 0xbb8);
                this.textBoxMyName.Focus();
            }
            else
            {
                this._mobileNo = this.textBoxMobileNo.Text;
                AsyncBizOperation op = new AsyncBizOperation();
                op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
                op.Successed += new EventHandler(this.op_Successed);
                this._user.ContactList.AsyncInviteMobileOpenIMPSService(this._mobileNo, this.textBoxMyName.Text.Trim(), op);
            }
        }

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

        private void Init()
        {
            ControlHelper.SetAcceptDigitOnly(this.textBoxMobileNo, true);
        }

        private void InitializeComponent()
        {
            this.labelMobileNo = new XLabel();
            this.textBoxMobileNo = new XTextBox();
            this.labelMyName = new XLabel();
            this.textBoxMyName = new XTextBox();
            this.buttonCancel = new XButton();
            this.buttonOK = new XButton();
            this.panel1 = new Panel();
            this.panel1.SuspendLayout();
            base.SuspendLayout();
            this.labelMobileNo.set_AutoSize(true);
            this.labelMobileNo.BackColor = Color.Transparent;
            this.labelMobileNo.BorderColor = Color.Empty;
            this.labelMobileNo.ButtonBorderStyle = ButtonBorderStyle.None;
            this.labelMobileNo.Location = new System.Drawing.Point(0x22, 0x30);
            this.labelMobileNo.Name = "labelMobileNo";
            this.labelMobileNo.Size = new Size(70, 13);
            this.labelMobileNo.TabIndex = 0;
            this.labelMobileNo.Text = "对方手机号:";
            this.textBoxMobileNo.BackColor = Color.White;
            this.textBoxMobileNo.BorderStyle = BorderStyle.FixedSingle;
            this.textBoxMobileNo.EmptyTextTip = "";
            this.textBoxMobileNo.EmptyTextTipColor = Color.DarkGray;
            this.textBoxMobileNo.Location = new System.Drawing.Point(110, 0x2e);
            this.textBoxMobileNo.MaxLength = 11;
            this.textBoxMobileNo.Name = "textBoxMobileNo";
            this.textBoxMobileNo.Size = new Size(0x9d, 20);
            this.textBoxMobileNo.TabIndex = 1;
            this.labelMyName.set_AutoSize(true);
            this.labelMyName.BorderColor = Color.Empty;
            this.labelMyName.ButtonBorderStyle = ButtonBorderStyle.None;
            this.labelMyName.Location = new System.Drawing.Point(0x2e, 0x53);
            this.labelMyName.Name = "labelMyName";
            this.labelMyName.Size = new Size(0x3a, 13);
            this.labelMyName.TabIndex = 2;
            this.labelMyName.Text = "您的姓名:";
            this.textBoxMyName.BackColor = Color.White;
            this.textBoxMyName.BorderStyle = BorderStyle.FixedSingle;
            this.textBoxMyName.EmptyTextTip = "";
            this.textBoxMyName.EmptyTextTipColor = Color.DarkGray;
            this.textBoxMyName.Location = new System.Drawing.Point(110, 0x51);
            this.textBoxMyName.MaxLength = 10;
            this.textBoxMyName.Name = "textBoxMyName";
            this.textBoxMyName.Size = new Size(0x9d, 20);
            this.textBoxMyName.TabIndex = 3;
            this.textBoxMyName.Enter += new EventHandler(this.textBoxMyName_Enter);
            this.textBoxMyName.KeyPress += new KeyPressEventHandler(this.textBoxMyName_KeyPress);
            this.buttonCancel.AutoArrangementX = false;
            this.buttonCancel.AutoSizeToImage = false;
            this.buttonCancel.BackColor = Color.Transparent;
            this.buttonCancel.BackgroundImageDisable = null;
            this.buttonCancel.BackgroundImageDown = null;
            this.buttonCancel.BackgroundImageHover = null;
            this.buttonCancel.ChangeSkin = true;
            this.buttonCancel.DialogResult = DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(0xd6, 0xa4);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new Size(0x4b, 0x17);
            this.buttonCancel.TabIndex = 5;
            this.buttonCancel.Text = "取消";
            this.buttonCancel.set_UseVisualStyleBackColor(false);
            this.buttonCancel.Click += new EventHandler(this.buttonCancel_Click);
            this.buttonOK.AutoArrangementX = false;
            this.buttonOK.AutoSizeToImage = false;
            this.buttonOK.BackColor = Color.Transparent;
            this.buttonOK.BackgroundImageDisable = null;
            this.buttonOK.BackgroundImageDown = null;
            this.buttonOK.BackgroundImageHover = null;
            this.buttonOK.ChangeSkin = true;
            this.buttonOK.Location = new System.Drawing.Point(0x85, 0xa4);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new Size(0x4b, 0x17);
            this.buttonOK.TabIndex = 4;
            this.buttonOK.Text = "确定";
            this.buttonOK.set_UseVisualStyleBackColor(false);
            this.buttonOK.Click += new EventHandler(this.buttonOK_Click);
            this.panel1.BackColor = Color.Transparent;
            this.panel1.Controls.Add(this.labelMobileNo);
            this.panel1.Controls.Add(this.textBoxMobileNo);
            this.panel1.Controls.Add(this.labelMyName);
            this.panel1.Controls.Add(this.textBoxMyName);
            this.panel1.Location = new System.Drawing.Point(8, 8);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x13d, 150);
            this.panel1.TabIndex = 0;
            base.AcceptButton = this.buttonOK;
            base.set_AutoScaleDimensions(new SizeF(6f, 13f));
            base.set_AutoScaleMode(1);
            base.BaseHeight = 0xd9;
            base.BaseWidth = 0x162;
            base.CancelButton = this.buttonCancel;
            base.ClientSize = new Size(0x15c, 0xbf);
            base.Controls.Add(this.panel1);
            base.Controls.Add(this.buttonCancel);
            base.Controls.Add(this.buttonOK);
            base.DisplayLocation = new System.Drawing.Point(0x12, 0x26);
            base.MinimizeBox = false;
            base.Name = "InviteIICForm";
            base.set_Padding(new Padding(8));
            base.StartPosition = FormStartPosition.CenterScreen;
            base.Text = "邀请好友开通飞信";
            base.Load += new EventHandler(this.InviteIICForm_Load);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            base.ResumeLayout(false);
        }

        private void InviteIICForm_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this._mobileNo))
            {
                this.textBoxMobileNo.Text = "";
                this.textBoxMobileNo.ReadOnly = false;
            }
            else
            {
                this.textBoxMobileNo.Text = Convert.ToString(this._mobileNo);
                this.textBoxMobileNo.ReadOnly = true;
            }
            this.textBoxMyName.MaxLength = Imps.Client.Core.FixedClientSetting.Instance.MaxInviteIICNameLength;
            this.textBoxMyName.Text = string.Empty;
            if (this._user.PersonalInfo.Name.Value.Length != 0)
            {
                if (this._user.PersonalInfo.Name.Value.Length > this.textBoxMyName.MaxLength)
                {
                    this.textBoxMyName.Text = this._user.PersonalInfo.Name.Value.Substring(0, this.textBoxMyName.MaxLength);
                }
                else
                {
                    this.textBoxMyName.Text = this._user.PersonalInfo.Name.Value;
                }
            }
            else if (this._user.PersonalInfo.Nickname.Value.Length != 0)
            {
                if (this._user.PersonalInfo.Nickname.Value.Length > this.textBoxMyName.MaxLength)
                {
                    this.textBoxMyName.Text = this._user.PersonalInfo.Nickname.Value.Substring(0, this.textBoxMyName.MaxLength);
                }
                else
                {
                    this.textBoxMyName.Text = this._user.PersonalInfo.Nickname.Value;
                }
            }
        }

        protected override void OnShown(EventArgs e)
        {
            this.textBoxMobileNo.Focus();
        }

        private void op_ImpsError(object sender, ImpsErrorEventArgs e)
        {
            try
            {
                if (base.IsHandleCreated)
                {
                    if (e.Summary.Length == 0)
                    {
                        this._iFrameworkWindow.UnifiedMessageBox.ShowError(this, "邀请好友开通失败,请稍后重试。");
                    }
                    else
                    {
                        this._iFrameworkWindow.UnifiedMessageBox.ShowError(this, e.Summary);
                    }
                }
            }
            catch
            {
            }
        }

        private void op_Successed(object sender, EventArgs e)
        {
            this._iFrameworkWindow.UnifiedMessageBox.ShowError(this, "邀请已成功发出。");
            base.Close();
        }

        private void textBoxMyName_Enter(object sender, EventArgs e)
        {
            if (!this._hasDisplayTip)
            {
                BalloonHelper.ShowBallon(this.textBoxMyName, "限5个中文字符或10个英文字符", 0xbb8);
            }
            this._hasDisplayTip = true;
        }

        private void textBoxMyName_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if ((e.KeyChar >= ' ') && (Encoding.GetEncoding(0x3a8).GetByteCount(this.textBoxMyName.Text + e.KeyChar) > 10))
                {
                    e.Handled = true;
                }
            }
            catch
            {
            }
        }

        public string MobileNo
        {
            get
            {
                return this._mobileNo;
            }
            set
            {
                this._mobileNo = value ?? string.Empty;
            }
        }
    }
}

⌨️ 快捷键说明

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