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

📄 inviteiicform.cs

📁 飞信的收发使用csharp进行开发
💻 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.Windows.Forms;

    public class InviteIICForm : XIMDialog
    {
        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;
            ControlHelper.ForceControlImeHangul(this.textBoxMyName);
            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, "错误!", ToolTipIcon.Error, 0x7d0);
            }
            else if (!ImpsHelper.IsCmccMobileNo(Convert.ToInt64(this.textBoxMobileNo.Text)))
            {
                BalloonHelper.ShowBallon(this.textBoxMobileNo, StringTable.Contact.InvalidCmccMobileNo, "错误!", ToolTipIcon.Error, 0x7d0);
            }
            else if (this.textBoxMyName.Text.Trim().Length == 0)
            {
                this._iFrameworkWindow.UnifiedMessageBox.ShowInfo(StringTable.Contact.AddBuddy_MyNameEmptyMobileNo);
            }
            else
            {
                this._mobileNo = this.textBoxMobileNo.Text;
                AsyncBizOperation op = new AsyncBizOperation();
                if (Imps.Client.Core.Contact.AsyncInviteMobileOpenIMPSService(this._mobileNo, this.textBoxMyName.Text.Trim(), this._user, op))
                {
                    base.Close();
                }
            }
        }

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

        private void Init()
        {
            base.Text = string.Format(base.Text, AppDictionary.ShortEnglishName);
            ControlHelper.SetAcceptDigitOnly(this.textBoxMobileNo, true);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(InviteIICForm));
            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();
            base.menubar.Location = new Point(3, 30);
            this.labelMobileNo.AutoSize = true;
            this.labelMobileNo.BackColor = Color.Transparent;
            this.labelMobileNo.Location = new Point(20, 15);
            this.labelMobileNo.Name = "labelMobileNo";
            this.labelMobileNo.Size = new Size(0x43, 13);
            this.labelMobileNo.TabIndex = 0;
            this.labelMobileNo.Text = "对方手机号";
            this.textBoxMobileNo.Location = new Point(0x2d, 0x1f);
            this.textBoxMobileNo.MaxLength = 11;
            this.textBoxMobileNo.Name = "textBoxMobileNo";
            this.textBoxMobileNo.Size = new Size(0xba, 20);
            this.textBoxMobileNo.TabIndex = 1;
            this.labelMyName.AutoSize = true;
            this.labelMyName.Location = new Point(20, 0x3f);
            this.labelMyName.Name = "labelMyName";
            this.labelMyName.Size = new Size(0x99, 13);
            this.labelMyName.TabIndex = 2;
            this.labelMyName.Text = "输入您的名称(限{0}个字)";
            this.textBoxMyName.Location = new Point(0x2f, 0x4f);
            this.textBoxMyName.Name = "textBoxMyName";
            this.textBoxMyName.Size = new Size(0xba, 20);
            this.textBoxMyName.TabIndex = 3;
            this.buttonCancel.DialogResult = DialogResult.Cancel;
            this.buttonCancel.Location = new Point(0xdf, 0x74);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new Size(0x4b, 0x17);
            this.buttonCancel.TabIndex = 5;
            this.buttonCancel.Text = "取消";
            this.buttonCancel.UseVisualStyleBackColor = true;
            this.buttonCancel.Click += new EventHandler(this.buttonCancel_Click);
            this.buttonOK.Location = new Point(0x8e, 0x74);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new Size(0x4b, 0x17);
            this.buttonOK.TabIndex = 4;
            this.buttonOK.Text = "确定";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new EventHandler(this.buttonOK_Click);
            this.panel1.BackColor = Color.Transparent;
            this.panel1.Controls.Add(this.labelMobileNo);
            this.panel1.Controls.Add(this.buttonCancel);
            this.panel1.Controls.Add(this.textBoxMobileNo);
            this.panel1.Controls.Add(this.buttonOK);
            this.panel1.Controls.Add(this.labelMyName);
            this.panel1.Controls.Add(this.textBoxMyName);
            this.panel1.Dock = DockStyle.Fill;
            this.panel1.Location = new Point(8, 8);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x146, 0xc5);
            this.panel1.TabIndex = 0;
            base.AcceptButton = this.buttonOK;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.CancelButton = this.buttonCancel;
            base.ClientSize = new Size(0x156, 0xd5);
            base.Controls.Add(this.panel1);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MinimizeBox = false;
            base.Name = "InviteIICForm";
            base.Padding = new Padding(8, 8, 8, 8);
            base.StartPosition = FormStartPosition.CenterScreen;
            base.Text = "邀请好友开通{0}";
            base.Load += new EventHandler(this.InviteIICForm_Load);
            base.Controls.SetChildIndex(this.panel1, 0);
            base.Controls.SetChildIndex(base.menubar, 0);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            base.ResumeLayout(false);
        }

        private void InviteIICForm_Load(object sender, EventArgs e)
        {
            this.labelMyName.Text = string.Format(this.labelMyName.Text, Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength);
            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.MaxInviteRequestNameLength;
            this.textBoxMyName.Text = "";
            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();
        }

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

⌨️ 快捷键说明

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