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

📄 groupsmsform.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace Imps.Client.Pc
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.BizControls.Conversation;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class GroupSMSForm : XIMDialog
    {
        private int _alreadySendCount;
        private SendSMSItem _currentSendingItem;
        private IFrameworkWindow _frameworkWin;
        private GroupSMSFailedForm _groupSMSFailedForm;
        private ChatEditCtrlManager _historyChatManager;
        private bool _sendFrequent;
        private Queue<SendSMSItem> _stackSMSItems;
        private XButton btnAddMyMobileNo;
        private XButton btnCancel;
        private SendMessageButton btnSend;
        private IContainer components;
        private InviteControl inviteControl;
        private HtmlLabel lblInputInfo;
        private Label lblSendInfo;
        private bool m_fIsProcessKey;
        private menu_widget menuSendType;
        private AsyncBizOperation op;
        private Panel panel1;
        private Panel panel2;
        private Panel panel3;
        private Panel panel4;
        private Panel plInviteContacts;
        private Panel pnlMain;
        private bool sending;
        private SplitContainer splitContainer1;
        private ToolStripMenuItem tsSendCtrlEnter;
        private ToolStripMenuItem tsSendEnter;
        private ChatRichTextBox txtHistory;
        private TextBox txtSendContent;

        public GroupSMSForm(IFrameworkWindow frameworkWin) : this(frameworkWin, null)
        {
        }

        public GroupSMSForm(IFrameworkWindow frameworkWin, List<Imps.Client.Core.Contact> list)
        {
            EventHandler<SplitterEventArgs> handler = null;
            EventHandler handler2 = null;
            EventHandler handler3 = null;
            this._stackSMSItems = new Queue<SendSMSItem>();
            this.InitializeComponent();
            this._frameworkWin = frameworkWin;
            this.initComponentRegion();
            try
            {
                this.inviteControl = new InviteControl(frameworkWin, list);
                this.inviteControl.Message = StringTable.Conversation.MsgSelectSMSContacts;
                this.inviteControl.MaxSelectedCount = this.CurrentUser.Configuration.SystemSetting.SysSmsSetting.MaxFriendsNumBatchSms;
                this.inviteControl.OnlyShowOnline = false;
                this.inviteControl.ShowSMSOnline = true;
                this.inviteControl.ShowGroup = true;
                this.inviteControl.ShowSelf = true;
                this.inviteControl.ShowMobileBuddy = true;
                this.inviteControl.ShowSMSOffline = false;
                this.inviteControl.Dock = DockStyle.Fill;
                this.inviteControl.MessageLabelHeight = 20;
                this.plInviteContacts.Controls.Add(this.inviteControl);
                if (handler == null)
                {
                    handler = delegate {
                        this.txtSendContent.Focus();
                    };
                }
                this.inviteControl.SplitterMoved += handler;
                if (handler2 == null)
                {
                    handler2 = delegate {
                        this.txtSendContent.Focus();
                    };
                }
                base.Shown += handler2;
                if (handler3 == null)
                {
                    handler3 = delegate {
                        this.txtSendContent.Focus();
                    };
                }
                base.Activated += handler3;
                this.lblInputInfo.Text = string.Format(StringTable.Conversation.MsgSMSInputInfo, this.MaxInputLength.ToString());
                base.ShowIcon = true;
                base.Icon = ImpsIcons.Logo;
                this.btnSend.Disabled = true;
                this.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this.CurrentUser_StatusChanged);
                this.btnSend.ToolTipText = StringTable.Conversation.MsgSendMessageTip;
                ControlHelper.ForceControlImeHangul(this.txtSendContent);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            this._historyChatManager = new ChatEditCtrlManager(this.txtHistory, true);
            this._historyChatManager.LinkButtonClick += new ChatEditClickEventHandler(this._historyChatManager_LinkButtonClick);
            this._historyChatManager.DefaultTextFont = this.CurrentUser.Configuration.UserSetting.ConversationSetting.DefaultFont;
            this._historyChatManager.SelectionFont = this.CurrentUser.Configuration.UserSetting.ConversationSetting.DefaultFont;
            this._historyChatManager.ForeColor = SystemColors.ControlText;
        }

        private int _historyChatManager_LinkButtonClick(object sender, ChatEditClickEventArgs e)
        {
            try
            {
                if ((e.EventType == ChatEditEventType.LinkButton) && (e.Command == "frequent"))
                {
                    if (this._groupSMSFailedForm == null)
                    {
                        if (this._currentSendingItem != null)
                        {
                            this._stackSMSItems.Enqueue(this._currentSendingItem);
                        }
                        this._groupSMSFailedForm = new GroupSMSFailedForm(this._stackSMSItems);
                    }
                    this._groupSMSFailedForm.Location = base.Location;
                    this._groupSMSFailedForm.Show();
                }
            }
            catch
            {
            }
            return 1;
        }

        private void btnAddMyMobileNo_Click(object sender, EventArgs e)
        {
            if (((this.txtSendContent.Text.Length + 11) + 2) > this.MaxInputLength)
            {
                this._frameworkWin.UnifiedMessageBox.ShowInfo(string.Format("您一条信息最多只能输入{0}个字符", this.MaxInputLength));
            }
            else
            {
                this.txtSendContent.SelectionStart = this.txtSendContent.Text.Length;
                if (string.IsNullOrEmpty(this.CurrentUser.MobileNo))
                {
                    ClientLogger.WriteGeneral("群发短信的时候,尝试加入手机号失败,MobileNo属性为空!");
                }
                if (this.txtSendContent.Text != "")
                {
                    this.txtSendContent.AppendText("\r\n" + this.CurrentUser.MobileNo);
                }
                else
                {
                    this.txtSendContent.AppendText(this.CurrentUser.MobileNo);
                }
            }
        }

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

        private void btnSend_Click(object sender, EventArgs e)
        {
            this.SendSMS();
        }

        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
        {
            if ((e.NewStatus == UserAccountStatus.Logoff) || (e.NewStatus == UserAccountStatus.Disconnected))
            {
                base.Close();
            }
        }

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

        private void FormatSendInfo()
        {
            this.lblSendInfo.Text = string.Format(StringTable.Conversation.MsgAlreadySends, this._alreadySendCount);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(GroupSMSForm));
            this.plInviteContacts = new Panel();
            this.panel2 = new Panel();
            this.splitContainer1 = new SplitContainer();
            this.panel1 = new Panel();
            this.txtHistory = new ChatRichTextBox();
            this.lblSendInfo = new Label();
            this.lblInputInfo = new HtmlLabel();
            this.panel3 = new Panel();
            this.panel4 = new Panel();
            this.txtSendContent = new TextBox();
            this.btnSend = new SendMessageButton();
            this.menuSendType = new menu_widget(this.components);
            this.tsSendEnter = new ToolStripMenuItem();
            this.tsSendCtrlEnter = new ToolStripMenuItem();
            this.btnCancel = new XButton();
            this.btnAddMyMobileNo = new XButton();
            this.pnlMain = new Panel();
            this.panel2.SuspendLayout();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.panel1.SuspendLayout();
            this.panel3.SuspendLayout();
            this.panel4.SuspendLayout();
            this.menuSendType.SuspendLayout();
            this.pnlMain.SuspendLayout();
            base.SuspendLayout();
            base.menubar.Location = new Point(3, 30);
            this.plInviteContacts.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.plInviteContacts.Location = new Point(4, 10);
            this.plInviteContacts.Name = "plInviteContacts";
            this.plInviteContacts.Size = new Size(0xf3, 0x1c0);
            this.plInviteContacts.TabIndex = 0;
            this.panel2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.panel2.Controls.Add(this.splitContainer1);
            this.panel2.Location = new Point(0xfb, 0x11);
            this.panel2.Name = "panel2";
            this.panel2.RightToLeft = RightToLeft.No;
            this.panel2.Size = new Size(0x16c, 440);
            this.panel2.TabIndex = 2;
            this.splitContainer1.Dock = DockStyle.Fill;
            this.splitContainer1.IsSplitterFixed = true;
            this.splitContainer1.Location = new Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = Orientation.Horizontal;
            this.splitContainer1.Panel1.Controls.Add(this.panel1);
            this.splitContainer1.Panel1.Controls.Add(this.lblSendInfo);
            this.splitContainer1.Panel1.RightToLeft = RightToLeft.No;
            this.splitContainer1.Panel1MinSize = 120;
            this.splitContainer1.Panel2.Controls.Add(this.lblInputInfo);
            this.splitContainer1.Panel2.Controls.Add(this.panel3);
            this.splitContainer1.Panel2.RightToLeft = RightToLeft.No;
            this.splitContainer1.RightToLeft = RightToLeft.No;
            this.splitContainer1.Size = new Size(0x16c, 440);
            this.splitContainer1.SplitterDistance = 330;
            this.splitContainer1.TabIndex = 0;
            this.splitContainer1.TabStop = false;
            this.splitContainer1.SplitterMoved += new SplitterEventHandler(this.splitContainer1_SplitterMoved);
            this.panel1.BackColor = Color.FromArgb(0xa4, 170, 220);
            this.panel1.Controls.Add(this.txtHistory);
            this.panel1.Dock = DockStyle.Fill;
            this.panel1.Location = new Point(0, 13);
            this.panel1.Name = "panel1";
            this.panel1.Padding = new Padding(1);
            this.panel1.Size = new Size(0x16c, 0x13d);
            this.panel1.TabIndex = 1;
            this.txtHistory.BackColor = Color.White;
            this.txtHistory.BorderColor = Color.Empty;
            this.txtHistory.BorderStyle = BorderStyle.None;
            this.txtHistory.Dock = DockStyle.Fill;
            this.txtHistory.Location = new Point(1, 1);
            this.txtHistory.MinimumSize = new Size(4, 100);
            this.txtHistory.Name = "txtHistory";
            this.txtHistory.ReadOnly = true;
            this.txtHistory.RightToLeft = RightToLeft.No;
            this.txtHistory.ScrollBars = RichTextBoxScrollBars.Vertical;
            this.txtHistory.Size = new Size(0x16a, 0x13b);
            this.txtHistory.TabIndex = 4;
            this.txtHistory.TabStop = false;
            this.txtHistory.Text = "";
            this.txtHistory.KeyDown += new KeyEventHandler(this.txtHistory_KeyDown);
            this.lblSendInfo.AutoSize = true;
            this.lblSendInfo.Dock = DockStyle.Top;
            this.lblSendInfo.ForeColor = Color.MediumBlue;
            this.lblSendInfo.Location = new Point(0, 0);
            this.lblSendInfo.Name = "lblSendInfo";
            this.lblSendInfo.Size = new Size(0x9c, 13);
            this.lblSendInfo.TabIndex = 0;
            this.lblSendInfo.Text = "您已经发送短信{0}条,如下:";
            this.lblInputInfo.ForeColor = Color.MediumBlue;
            this.lblInputInfo.LinkColor = Color.Blue;
            this.lblInputInfo.Location = new Point(0, 0);
            this.lblInputInfo.Name = "label1";
            this.lblInputInfo.ShowBackgroundImage = false;
            this.lblInputInfo.Size = new Size(0xce, 15);
            this.lblInputInfo.TabIndex = 8;
            this.lblInputInfo.Text = "123";
            this.panel3.BackColor = Color.FromArgb(0xa4, 170, 220);
            this.panel3.Controls.Add(this.panel4);
            this.panel3.Dock = DockStyle.Bottom;
            this.panel3.Location = new Point(0, 0x1b);
            this.panel3.Name = "panel3";
            this.panel3.Padding = new Padding(1);
            this.panel3.Size = new Size(0x16c, 0x4f);
            this.panel3.TabIndex = 7;
            this.panel4.BackColor = Color.White;
            this.panel4.Controls.Add(this.txtSendContent);
            this.panel4.Dock = DockStyle.Fill;
            this.panel4.Location = new Point(1, 1);
            this.panel4.Name = "panel4";
            this.panel4.Padding = new Padding(4, 4, 1, 1);
            this.panel4.Size = new Size(0x16a, 0x4d);
            this.panel4.TabIndex = 0;
            this.txtSendContent.BackColor = Color.White;
            this.txtSendContent.BorderStyle = BorderStyle.None;
            this.txtSendContent.Dock = DockStyle.Fill;
            this.txtSendContent.Location = new Point(4, 4);
            this.txtSendContent.MinimumSize = new Size(2, 40);
            this.txtSendContent.Multiline = true;
            this.txtSendContent.Name = "txtSendContent";
            this.txtSendContent.RightToLeft = RightToLeft.No;
            this.txtSendContent.ScrollBars = ScrollBars.Vertical;
            this.txtSendContent.Size = new Size(0x165, 0x48);
            this.txtSendContent.TabIndex = 0;
            this.txtSendContent.TextChanged += new EventHandler(this.txtSendContent_TextChanged);
            this.txtSendContent.KeyDown += new KeyEventHandler(this.txtSendContent_KeyDown);

⌨️ 快捷键说明

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