| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/SMSC client .NET/samples/cs-net/CIMD2/ |
Upload File : |
//------------------------------------------------------------------------------
// SMSC client .NET components CIMD2 sample application
//
// $Header: $
// Copyright (c) 2003-2013 Tops. All rights reserved.
//------------------------------------------------------------------------------
using System;
using System.Windows.Forms;
using smscc;
using smscc.CIMD2;
namespace sampleCIMD2
{
public class fmMain : System.Windows.Forms.Form
{
public System.Windows.Forms.CheckBox chkStatusReport;
public System.Windows.Forms.TextBox txtUDH;
public System.Windows.Forms.ComboBox cbEncoding;
public System.Windows.Forms.TextBox txtOriginator;
public System.Windows.Forms.TextBox txtPassword;
public System.Windows.Forms.Button cmdInitialize;
public System.Windows.Forms.TextBox txtUserID;
public System.Windows.Forms.TextBox txtDestination;
public System.Windows.Forms.TextBox txtLog;
public System.Windows.Forms.Button cmdSubmit;
public System.Windows.Forms.Button cmdDisconnect;
public System.Windows.Forms.TextBox txtPort;
public System.Windows.Forms.TextBox txtHost;
public System.Windows.Forms.Button cmdConnect;
public System.Windows.Forms.Label Label10;
public System.Windows.Forms.Label Line1;
public System.Windows.Forms.Label Line4;
public System.Windows.Forms.Label Line2;
public System.Windows.Forms.Label Label8;
public System.Windows.Forms.Label Label9;
public System.Windows.Forms.Label Label5;
public System.Windows.Forms.Label Label4;
public System.Windows.Forms.Label Label7;
public System.Windows.Forms.Label Label6;
public System.Windows.Forms.Label Label3;
public System.Windows.Forms.Label Label2;
public System.Windows.Forms.Label Label1;
public System.Windows.Forms.CheckBox chkDirectDisplay;
public System.Windows.Forms.TextBox txtSubmit;
private SMSCclientCIMD2 SMSCclientCIMD2;
private System.ComponentModel.Container components = null;
public fmMain()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chkStatusReport = new System.Windows.Forms.CheckBox();
this.txtUDH = new System.Windows.Forms.TextBox();
this.cbEncoding = new System.Windows.Forms.ComboBox();
this.txtOriginator = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.cmdInitialize = new System.Windows.Forms.Button();
this.txtUserID = new System.Windows.Forms.TextBox();
this.txtDestination = new System.Windows.Forms.TextBox();
this.txtLog = new System.Windows.Forms.TextBox();
this.cmdSubmit = new System.Windows.Forms.Button();
this.txtSubmit = new System.Windows.Forms.TextBox();
this.cmdDisconnect = new System.Windows.Forms.Button();
this.txtPort = new System.Windows.Forms.TextBox();
this.txtHost = new System.Windows.Forms.TextBox();
this.cmdConnect = new System.Windows.Forms.Button();
this.Label10 = new System.Windows.Forms.Label();
this.Line1 = new System.Windows.Forms.Label();
this.Line4 = new System.Windows.Forms.Label();
this.Line2 = new System.Windows.Forms.Label();
this.Label8 = new System.Windows.Forms.Label();
this.Label9 = new System.Windows.Forms.Label();
this.Label5 = new System.Windows.Forms.Label();
this.Label4 = new System.Windows.Forms.Label();
this.Label7 = new System.Windows.Forms.Label();
this.Label6 = new System.Windows.Forms.Label();
this.Label3 = new System.Windows.Forms.Label();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.chkDirectDisplay = new System.Windows.Forms.CheckBox();
this.SMSCclientCIMD2 = new smscc.CIMD2.SMSCclientCIMD2();
this.SuspendLayout();
//
// chkStatusReport
//
this.chkStatusReport.BackColor = System.Drawing.SystemColors.Control;
this.chkStatusReport.Checked = true;
this.chkStatusReport.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkStatusReport.Cursor = System.Windows.Forms.Cursors.Default;
this.chkStatusReport.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkStatusReport.Location = new System.Drawing.Point(100, 332);
this.chkStatusReport.Name = "chkStatusReport";
this.chkStatusReport.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkStatusReport.Size = new System.Drawing.Size(220, 17);
this.chkStatusReport.TabIndex = 13;
this.chkStatusReport.Text = "Request status report for the message";
this.chkStatusReport.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkStatusReport.UseVisualStyleBackColor = false;
//
// txtUDH
//
this.txtUDH.AcceptsReturn = true;
this.txtUDH.BackColor = System.Drawing.SystemColors.Window;
this.txtUDH.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtUDH.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtUDH.Location = new System.Drawing.Point(100, 260);
this.txtUDH.MaxLength = 0;
this.txtUDH.Multiline = true;
this.txtUDH.Name = "txtUDH";
this.txtUDH.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtUDH.Size = new System.Drawing.Size(201, 33);
this.txtUDH.TabIndex = 11;
//
// cbEncoding
//
this.cbEncoding.BackColor = System.Drawing.SystemColors.Window;
this.cbEncoding.Cursor = System.Windows.Forms.Cursors.Default;
this.cbEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbEncoding.ForeColor = System.Drawing.SystemColors.WindowText;
this.cbEncoding.Items.AddRange(new object[] {
"7 bit encoded text",
"8 bit encoded data",
"UCS2 encoded text"});
this.cbEncoding.Location = new System.Drawing.Point(100, 296);
this.cbEncoding.Name = "cbEncoding";
this.cbEncoding.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cbEncoding.Size = new System.Drawing.Size(201, 21);
this.cbEncoding.TabIndex = 12;
//
// txtOriginator
//
this.txtOriginator.AcceptsReturn = true;
this.txtOriginator.BackColor = System.Drawing.SystemColors.Window;
this.txtOriginator.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtOriginator.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtOriginator.Location = new System.Drawing.Point(100, 156);
this.txtOriginator.MaxLength = 0;
this.txtOriginator.Name = "txtOriginator";
this.txtOriginator.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtOriginator.Size = new System.Drawing.Size(201, 20);
this.txtOriginator.TabIndex = 8;
//
// txtPassword
//
this.txtPassword.AcceptsReturn = true;
this.txtPassword.BackColor = System.Drawing.SystemColors.Window;
this.txtPassword.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPassword.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtPassword.Location = new System.Drawing.Point(100, 112);
this.txtPassword.MaxLength = 0;
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPassword.Size = new System.Drawing.Size(201, 20);
this.txtPassword.TabIndex = 7;
//
// cmdInitialize
//
this.cmdInitialize.BackColor = System.Drawing.SystemColors.Control;
this.cmdInitialize.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdInitialize.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdInitialize.Location = new System.Drawing.Point(320, 88);
this.cmdInitialize.Name = "cmdInitialize";
this.cmdInitialize.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdInitialize.Size = new System.Drawing.Size(69, 23);
this.cmdInitialize.TabIndex = 2;
this.cmdInitialize.Text = "Initialize";
this.cmdInitialize.UseVisualStyleBackColor = false;
this.cmdInitialize.Click += new System.EventHandler(this.cmdInitialize_Click);
//
// txtUserID
//
this.txtUserID.AcceptsReturn = true;
this.txtUserID.BackColor = System.Drawing.SystemColors.Window;
this.txtUserID.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtUserID.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtUserID.Location = new System.Drawing.Point(100, 88);
this.txtUserID.MaxLength = 0;
this.txtUserID.Name = "txtUserID";
this.txtUserID.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtUserID.Size = new System.Drawing.Size(201, 20);
this.txtUserID.TabIndex = 6;
//
// txtDestination
//
this.txtDestination.AcceptsReturn = true;
this.txtDestination.BackColor = System.Drawing.SystemColors.Window;
this.txtDestination.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtDestination.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtDestination.Location = new System.Drawing.Point(100, 180);
this.txtDestination.MaxLength = 0;
this.txtDestination.Name = "txtDestination";
this.txtDestination.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtDestination.Size = new System.Drawing.Size(201, 20);
this.txtDestination.TabIndex = 9;
//
// txtLog
//
this.txtLog.AcceptsReturn = true;
this.txtLog.BackColor = System.Drawing.SystemColors.Window;
this.txtLog.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtLog.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtLog.Location = new System.Drawing.Point(20, 396);
this.txtLog.MaxLength = 0;
this.txtLog.Multiline = true;
this.txtLog.Name = "txtLog";
this.txtLog.ReadOnly = true;
this.txtLog.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtLog.Size = new System.Drawing.Size(373, 101);
this.txtLog.TabIndex = 15;
this.txtLog.WordWrap = false;
//
// cmdSubmit
//
this.cmdSubmit.BackColor = System.Drawing.SystemColors.Control;
this.cmdSubmit.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdSubmit.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdSubmit.Location = new System.Drawing.Point(320, 156);
this.cmdSubmit.Name = "cmdSubmit";
this.cmdSubmit.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdSubmit.Size = new System.Drawing.Size(69, 23);
this.cmdSubmit.TabIndex = 3;
this.cmdSubmit.Text = "Submit";
this.cmdSubmit.UseVisualStyleBackColor = false;
this.cmdSubmit.Click += new System.EventHandler(this.cmdSubmit_Click);
//
// txtSubmit
//
this.txtSubmit.AcceptsReturn = true;
this.txtSubmit.BackColor = System.Drawing.SystemColors.Window;
this.txtSubmit.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtSubmit.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtSubmit.Location = new System.Drawing.Point(100, 204);
this.txtSubmit.MaxLength = 0;
this.txtSubmit.Multiline = true;
this.txtSubmit.Name = "txtSubmit";
this.txtSubmit.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtSubmit.Size = new System.Drawing.Size(201, 53);
this.txtSubmit.TabIndex = 10;
//
// cmdDisconnect
//
this.cmdDisconnect.BackColor = System.Drawing.SystemColors.Control;
this.cmdDisconnect.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdDisconnect.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdDisconnect.Location = new System.Drawing.Point(320, 44);
this.cmdDisconnect.Name = "cmdDisconnect";
this.cmdDisconnect.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdDisconnect.Size = new System.Drawing.Size(69, 23);
this.cmdDisconnect.TabIndex = 1;
this.cmdDisconnect.Text = "Disconnect";
this.cmdDisconnect.UseVisualStyleBackColor = false;
this.cmdDisconnect.Click += new System.EventHandler(this.cmdDisconnect_Click);
//
// txtPort
//
this.txtPort.AcceptsReturn = true;
this.txtPort.BackColor = System.Drawing.SystemColors.Window;
this.txtPort.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPort.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtPort.Location = new System.Drawing.Point(260, 12);
this.txtPort.MaxLength = 0;
this.txtPort.Name = "txtPort";
this.txtPort.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPort.Size = new System.Drawing.Size(41, 20);
this.txtPort.TabIndex = 5;
this.txtPort.Text = "0";
//
// txtHost
//
this.txtHost.AcceptsReturn = true;
this.txtHost.BackColor = System.Drawing.SystemColors.Window;
this.txtHost.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtHost.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtHost.Location = new System.Drawing.Point(100, 12);
this.txtHost.MaxLength = 0;
this.txtHost.Name = "txtHost";
this.txtHost.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtHost.Size = new System.Drawing.Size(117, 20);
this.txtHost.TabIndex = 4;
this.txtHost.Text = "0.0.0.0";
//
// cmdConnect
//
this.cmdConnect.BackColor = System.Drawing.SystemColors.Control;
this.cmdConnect.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdConnect.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdConnect.Location = new System.Drawing.Point(320, 12);
this.cmdConnect.Name = "cmdConnect";
this.cmdConnect.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdConnect.Size = new System.Drawing.Size(69, 23);
this.cmdConnect.TabIndex = 0;
this.cmdConnect.Text = "Connect";
this.cmdConnect.UseVisualStyleBackColor = false;
this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click);
//
// Label10
//
this.Label10.AutoSize = true;
this.Label10.BackColor = System.Drawing.SystemColors.Control;
this.Label10.Cursor = System.Windows.Forms.Cursors.Default;
this.Label10.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label10.Location = new System.Drawing.Point(20, 380);
this.Label10.Name = "Label10";
this.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label10.Size = new System.Drawing.Size(55, 13);
this.Label10.TabIndex = 56;
this.Label10.Text = "Event log:";
//
// Line1
//
this.Line1.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line1.Location = new System.Drawing.Point(16, 372);
this.Line1.Name = "Line1";
this.Line1.Size = new System.Drawing.Size(380, 1);
this.Line1.TabIndex = 57;
//
// Line4
//
this.Line4.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line4.Location = new System.Drawing.Point(16, 144);
this.Line4.Name = "Line4";
this.Line4.Size = new System.Drawing.Size(380, 1);
this.Line4.TabIndex = 58;
//
// Line2
//
this.Line2.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line2.Location = new System.Drawing.Point(16, 76);
this.Line2.Name = "Line2";
this.Line2.Size = new System.Drawing.Size(380, 1);
this.Line2.TabIndex = 59;
//
// Label8
//
this.Label8.BackColor = System.Drawing.SystemColors.Control;
this.Label8.Cursor = System.Windows.Forms.Cursors.Default;
this.Label8.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label8.Location = new System.Drawing.Point(20, 260);
this.Label8.Name = "Label8";
this.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label8.Size = new System.Drawing.Size(57, 29);
this.Label8.TabIndex = 55;
this.Label8.Text = "User Data Header:";
//
// Label9
//
this.Label9.AutoSize = true;
this.Label9.BackColor = System.Drawing.SystemColors.Control;
this.Label9.Cursor = System.Windows.Forms.Cursors.Default;
this.Label9.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label9.Location = new System.Drawing.Point(20, 296);
this.Label9.Name = "Label9";
this.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label9.Size = new System.Drawing.Size(55, 13);
this.Label9.TabIndex = 54;
this.Label9.Text = "Encoding:";
//
// Label5
//
this.Label5.AutoSize = true;
this.Label5.BackColor = System.Drawing.SystemColors.Control;
this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label5.Location = new System.Drawing.Point(20, 160);
this.Label5.Name = "Label5";
this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label5.Size = new System.Drawing.Size(55, 13);
this.Label5.TabIndex = 53;
this.Label5.Text = "Originator:";
//
// Label4
//
this.Label4.AutoSize = true;
this.Label4.BackColor = System.Drawing.SystemColors.Control;
this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label4.Location = new System.Drawing.Point(20, 116);
this.Label4.Name = "Label4";
this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label4.Size = new System.Drawing.Size(56, 13);
this.Label4.TabIndex = 52;
this.Label4.Text = "Password:";
//
// Label7
//
this.Label7.AutoSize = true;
this.Label7.BackColor = System.Drawing.SystemColors.Control;
this.Label7.Cursor = System.Windows.Forms.Cursors.Default;
this.Label7.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label7.Location = new System.Drawing.Point(20, 212);
this.Label7.Name = "Label7";
this.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label7.Size = new System.Drawing.Size(53, 13);
this.Label7.TabIndex = 51;
this.Label7.Text = "Message:";
//
// Label6
//
this.Label6.AutoSize = true;
this.Label6.BackColor = System.Drawing.SystemColors.Control;
this.Label6.Cursor = System.Windows.Forms.Cursors.Default;
this.Label6.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label6.Location = new System.Drawing.Point(20, 184);
this.Label6.Name = "Label6";
this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label6.Size = new System.Drawing.Size(63, 13);
this.Label6.TabIndex = 50;
this.Label6.Text = "Destination:";
//
// Label3
//
this.Label3.AutoSize = true;
this.Label3.BackColor = System.Drawing.SystemColors.Control;
this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label3.Location = new System.Drawing.Point(20, 92);
this.Label3.Name = "Label3";
this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label3.Size = new System.Drawing.Size(46, 13);
this.Label3.TabIndex = 49;
this.Label3.Text = "User ID:";
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.BackColor = System.Drawing.SystemColors.Control;
this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label2.Location = new System.Drawing.Point(224, 16);
this.Label2.Name = "Label2";
this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label2.Size = new System.Drawing.Size(29, 13);
this.Label2.TabIndex = 48;
this.Label2.Text = "Port:";
//
// Label1
//
this.Label1.AutoSize = true;
this.Label1.BackColor = System.Drawing.SystemColors.Control;
this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label1.Location = new System.Drawing.Point(20, 16);
this.Label1.Name = "Label1";
this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label1.Size = new System.Drawing.Size(80, 13);
this.Label1.TabIndex = 46;
this.Label1.Text = "SMSC address:";
//
// chkDirectDisplay
//
this.chkDirectDisplay.BackColor = System.Drawing.SystemColors.Control;
this.chkDirectDisplay.Cursor = System.Windows.Forms.Cursors.Default;
this.chkDirectDisplay.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkDirectDisplay.Location = new System.Drawing.Point(100, 348);
this.chkDirectDisplay.Name = "chkDirectDisplay";
this.chkDirectDisplay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkDirectDisplay.Size = new System.Drawing.Size(201, 17);
this.chkDirectDisplay.TabIndex = 14;
this.chkDirectDisplay.Text = "Direct display (Flash SMS)";
this.chkDirectDisplay.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkDirectDisplay.UseVisualStyleBackColor = false;
//
// SMSCclientCIMD2
//
this.SMSCclientCIMD2.ImmediateResponse = false;
this.SMSCclientCIMD2.KeepAliveInterval = 10;
this.SMSCclientCIMD2.ResponseTimeOut = 10;
this.SMSCclientCIMD2.OnTcpDisconnected += new smscc.tcpDisconnectedEvent(this.SMSCclientCIMD2_OnTcpDisconnected);
this.SMSCclientCIMD2.OnCimd2StatusReportReceived += new smscc.CIMD2.cimd2StatusReportReceivedEvent(this.SMSCclientCIMD2_OnCimd2StatusReportReceived);
this.SMSCclientCIMD2.OnCimd2MessageReceived += new smscc.CIMD2.cimd2MessageReceivedEvent(this.SMSCclientCIMD2_OnCimd2MessageReceived);
//
// fmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(414, 518);
this.Controls.Add(this.chkStatusReport);
this.Controls.Add(this.txtUDH);
this.Controls.Add(this.cbEncoding);
this.Controls.Add(this.txtOriginator);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.cmdInitialize);
this.Controls.Add(this.txtUserID);
this.Controls.Add(this.txtDestination);
this.Controls.Add(this.txtLog);
this.Controls.Add(this.cmdSubmit);
this.Controls.Add(this.txtSubmit);
this.Controls.Add(this.cmdDisconnect);
this.Controls.Add(this.txtPort);
this.Controls.Add(this.txtHost);
this.Controls.Add(this.cmdConnect);
this.Controls.Add(this.Label10);
this.Controls.Add(this.Line1);
this.Controls.Add(this.Line4);
this.Controls.Add(this.Line2);
this.Controls.Add(this.Label8);
this.Controls.Add(this.Label9);
this.Controls.Add(this.Label5);
this.Controls.Add(this.Label4);
this.Controls.Add(this.Label7);
this.Controls.Add(this.Label6);
this.Controls.Add(this.Label3);
this.Controls.Add(this.Label2);
this.Controls.Add(this.Label1);
this.Controls.Add(this.chkDirectDisplay);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "fmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SMSC client .NET CIMD2 sample";
this.Load += new System.EventHandler(this.fmMain_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private EventLog Log;
[STAThread]
static void Main()
{
Application.Run(new fmMain());
}
// Connect to SMSC
private void cmdConnect_Click(object sender, System.EventArgs e)
{
int Result;
txtLog.Text = "";
txtLog.Refresh();
Result = SMSCclientCIMD2.tcpConnect(txtHost.Text, int.Parse(txtPort.Text));
if(Result != 0)
Log.AddConnectionErrorEvent(Result);
else
Log.AddConnectedEvent();
}
// Disonnect from SMSC
private void cmdDisconnect_Click(object sender, System.EventArgs e)
{
SMSCclientCIMD2.tcpDisconnect();
}
// Initialize session with SMSC
private void cmdInitialize_Click(object sender, System.EventArgs e)
{
int Result;
Result = SMSCclientCIMD2.cimd2InitializeSession(txtUserID.Text, txtPassword.Text);
if(Result != 0)
Log.AddInitializationErrorEvent(Result);
else
Log.AddInitializedEvent();
}
// Submit message to the SMSC
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
int Result;
DateTime TimeStamp;
EncodingEnum Encoding;
int Options;
switch(cbEncoding.SelectedIndex)
{
case 2:
Encoding = EncodingEnum.etUCS2Text;
break;
case 1:
Encoding = EncodingEnum.et8BitHexadecimal;
break;
default:
Encoding = EncodingEnum.et7BitText;
break;
}
Options = 0;
if(chkStatusReport.CheckState == CheckState.Checked)
Options |= (int)SubmitOptionEnum.soRequestStatusReport;
if(chkDirectDisplay.CheckState == CheckState.Checked)
Options |= (int)SubmitOptionEnum.soDirectDisplay;
Result = SMSCclientCIMD2.cimd2SubmitMessage(txtDestination.Text,
txtOriginator.Text, txtSubmit.Text, Encoding,
txtUDH.Text, Options, "", out TimeStamp);
if(Result != 0)
Log.AddMessageSubmissionErrorEvent(Result);
else
Log.AddMessageSubmitedEvent(TimeStamp);
}
private void fmMain_Load(object sender, System.EventArgs e)
{
Log = new EventLog(txtLog);
cbEncoding.SelectedIndex = 0;
}
// Disconnected from SMSC
private void SMSCclientCIMD2_OnTcpDisconnected(object sender, tcpDisconnectedEventArgs e)
{
Log.AddDisconnectedEvent(e.Reason);
}
// Message received from SMSC
private void SMSCclientCIMD2_OnCimd2MessageReceived(object Sender, cimd2MessageReceivedEventArgs e)
{
Log.AddMessageReceivedEvent(e.Destination, e.Originator, e.Content, e.Encoding, e.UserDataHeader, e.TimeStamp);
}
// Status Report (SR) received from SMSC
private void SMSCclientCIMD2_OnCimd2StatusReportReceived(object Sender, cimd2StatusReportReceivedEventArgs e)
{
Log.AddStatusReportReceivedEvent(e.MessageTimeStamp, e.Destination, e.StatusCode, e.StatusErrorCode, e.TimeStamp);
}
}
}