namespace AsiaINFO.SMS.APPCMPP2 { using AsiaINFO.SMS.CMPP2; using AsiaINFO.SMS.Entity; using MyControls; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; public class SmsForm : Form { private SyncEvents _submitEvents; private Queue _submitQueue; private IContainer components; private GroupBox DebugBox; private Label label1; private Label label2; private Label label3; private Label label4; private Label label5; private TextBoxExNumOnly LONG_SERV_NO; private TextBoxExNumOnly MOBILE_NO; private Button SendSms; private TextBox SERVCODE; private TextBox SMS_CONTENT; private TextBox WAPURL; public SmsForm(Queue submitQueue, SyncEvents submitEvents) { if ((submitQueue == null) || (submitEvents == null)) { throw new Exception("SmsForm参数不能为空"); } this.InitializeComponent(); this._submitQueue = submitQueue; this._submitEvents = submitEvents; } protected override void Dispose(bool disposing) { if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.DebugBox = new GroupBox(); this.WAPURL = new TextBox(); this.label4 = new Label(); this.LONG_SERV_NO = new TextBoxExNumOnly(); this.MOBILE_NO = new TextBoxExNumOnly(); this.SMS_CONTENT = new TextBox(); this.label3 = new Label(); this.SendSms = new Button(); this.label2 = new Label(); this.label1 = new Label(); this.label5 = new Label(); this.SERVCODE = new TextBox(); this.DebugBox.SuspendLayout(); base.SuspendLayout(); this.DebugBox.Controls.Add(this.SERVCODE); this.DebugBox.Controls.Add(this.label5); this.DebugBox.Controls.Add(this.WAPURL); this.DebugBox.Controls.Add(this.label4); this.DebugBox.Controls.Add(this.LONG_SERV_NO); this.DebugBox.Controls.Add(this.MOBILE_NO); this.DebugBox.Controls.Add(this.SMS_CONTENT); this.DebugBox.Controls.Add(this.label3); this.DebugBox.Controls.Add(this.SendSms); this.DebugBox.Controls.Add(this.label2); this.DebugBox.Controls.Add(this.label1); this.DebugBox.Location = new Point(12, 12); this.DebugBox.Name = "DebugBox"; this.DebugBox.Size = new Size(0x16f, 220); this.DebugBox.TabIndex = 0x21; this.DebugBox.TabStop = false; this.WAPURL.Location = new Point(0x41, 0x7a); this.WAPURL.Multiline = true; this.WAPURL.Name = "WAPURL"; this.WAPURL.Size = new Size(0x120, 0x25); this.WAPURL.TabIndex = 40; this.label4.AutoSize = true; this.label4.Location = new Point(6, 0x7d); this.label4.Name = "label4"; this.label4.Size = new Size(0x29, 12); this.label4.TabIndex = 0x27; this.label4.Text = "WAPURL"; this.LONG_SERV_NO.Location = new Point(0xf1, 0x1a); this.LONG_SERV_NO.Name = "LONG_SERV_NO"; this.LONG_SERV_NO.Size = new Size(100, 0x15); this.LONG_SERV_NO.TabIndex = 0; this.MOBILE_NO.Location = new Point(0x41, 0x1a); this.MOBILE_NO.Name = "MOBILE_NO"; this.MOBILE_NO.Size = new Size(100, 0x15); this.MOBILE_NO.TabIndex = 0x22; this.SMS_CONTENT.Location = new Point(0x41, 0x40); this.SMS_CONTENT.Multiline = true; this.SMS_CONTENT.Name = "SMS_CONTENT"; this.SMS_CONTENT.Size = new Size(0x120, 0x34); this.SMS_CONTENT.TabIndex = 2; this.SMS_CONTENT.Text = "测试test"; this.label3.AutoSize = true; this.label3.Location = new Point(6, 0x40); this.label3.Name = "label3"; this.label3.Size = new Size(0x1d, 12); this.label3.TabIndex = 0x24; this.label3.Text = "内容"; this.SendSms.AutoSize = true; this.SendSms.Location = new Point(290, 0xab); this.SendSms.Name = "SendSms"; this.SendSms.Size = new Size(0x3f, 0x17); this.SendSms.TabIndex = 3; this.SendSms.Text = "发送短信"; this.SendSms.UseVisualStyleBackColor = true; this.SendSms.Click += new EventHandler(this.SendSms_Click); this.label2.AutoSize = true; this.label2.Location = new Point(0xc2, 0x1d); this.label2.Name = "label2"; this.label2.Size = new Size(0x29, 12); this.label2.TabIndex = 0x22; this.label2.Text = "长号码"; this.label1.AutoSize = true; this.label1.Location = new Point(6, 0x1d); this.label1.Name = "label1"; this.label1.Size = new Size(0x35, 12); this.label1.TabIndex = 0x20; this.label1.Text = "手机号码"; this.label5.AutoSize = true; this.label5.Location = new Point(6, 0xb0); this.label5.Name = "label5"; this.label5.Size = new Size(0x35, 12); this.label5.TabIndex = 0x29; this.label5.Text = "业务代码"; this.SERVCODE.Location = new Point(0x41, 0xab); this.SERVCODE.Name = "SERVCODE"; this.SERVCODE.Size = new Size(100, 0x15); this.SERVCODE.TabIndex = 0x2a; this.SERVCODE.Text = "HELP"; base.AutoScaleDimensions = new SizeF(6f, 12f); //base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x189, 0xf4); base.Controls.Add(this.DebugBox); base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "SmsForm"; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "测试"; this.DebugBox.ResumeLayout(false); this.DebugBox.PerformLayout(); base.ResumeLayout(false); } private void SendSms_Click(object sender, EventArgs e) { try { if (((this.MOBILE_NO.Text.Length <= 0) || (this.SMS_CONTENT.Text.Length <= 0)) || (this.LONG_SERV_NO.Text.Length <= 0)) { MessageBox.Show("参数不能为空"); } else { MTWaitInfo mtwait = new MTWaitInfo("0", this.LONG_SERV_NO.Text, this.SERVCODE.Text, this.MOBILE_NO.Text, 1, "01", "0", this.SMS_CONTENT.Text, "", this.WAPURL.Text, 1, 1); SubmitInfo info2 = new SubmitInfo(mtwait, ShareData.SeqID, 1); this._submitData = info2; this._submitEvents.NewItemEvent.Set(); } } catch (Exception exception) { MessageBox.Show("错误:" + exception.Message); } } private int _submitCount { get { lock (((ICollection) this._submitQueue).SyncRoot) { return this._submitQueue.Count; } } } private SubmitInfo _submitData { get { lock (((ICollection) this._submitQueue).SyncRoot) { if (this._submitQueue.Count > 0) { return this._submitQueue.Dequeue(); } } return null; } set { lock (((ICollection) this._submitQueue).SyncRoot) { this._submitQueue.Enqueue(value); } } } } }