Public Class MyClass
Public WithEvents objSMS As New mCore.SMS
Public Sub SendQueue()
Dim objPicSMS As mCore.PictureSMS =
objSMS.PictureSMS
Dim strKey As String
Try
SetCommParameters()
objPicSMS.Destination =
"+919873094767"
objPicSMS.BitmapFile = "C:\newyear.bmp"
objPicSMS.Text = "Happy
New Year"
strKey = objPicSMS.SendToQueue(mCore.QueuePriority.High)
MsgBox("Picture SMS added to
queue." & vbCrLf & _
"[Queue Key: " & strKey & "]")
objPicSMS.Destination =
"+919810098765"
'Following message is sent with normal queue priority
strKey = objPicSMS.SendToQueue()
MsgBox("Picture SMS added to
queue." & vbCrLf & _
"[Queue Key: " & strKey & "]")
objPicSMS.Destination =
"+919811045678"
strKey =
objPicSMS.SendToQueue(mCore.QueuePriority.Low)
MsgBox("Picture SMS added to
queue." & vbCrLf & _
"[Queue Key: " & strKey & "]")
'Message queue is enabled
objSMS.Queue.Enabled = True
'Messages can be added to the queue even
'when the Message queue is
enabled
objPicSMS.Destination =
"+919873012345"
strKey = objPicSMS.SendToQueue(mCore.QueuePriority.High)
MsgBox("Picture SMS added to
queue." & vbCrLf & _
"[Queue Key: " & strKey & "]")
Catch ex As mCore.GeneralException
MsgBox(ex.Message,
MsgBoxStyle.Critical, "mCore Demo")
Catch ex As Exception
End Try
End Sub
'Event at the start of sending a queued
Picture SMS
Private Sub objSMS_QueuePictureSMSSending(ByVal sender As Object, _
ByVal e As mCore.QueuePictureSMSSendingEventArgs) _
Handles objSMS.QueuePictureSMSSending
MsgBox("Sending Picture SMS to: " &
e.DestinationNumber & vbCrLf & _
"[Queue Key:
" & e.QueueMessageKey & _
"]", MsgBoxStyle.Information, "SENDING PICTURE SMS")
End Sub
'Event at the end of sending a queued
Picture SMS
Private Sub objSMS_QueuePictureSMSSent(ByVal sender As Object, _
ByVal e As mCore.QueuePictureSMSSentEventArgs) _
Handles objSMS.QueuePictureSMSSent
If e.ErrorCode > 0 Then
MsgBox("Picture SMS sending
FAILED to: " & e.DestinationNumber & _
vbCrLf & "[ERROR: " & e.ErrorDescription & _
"]"
& vbCrLf & "[Queue Key: " & e.QueueMessageKey & _
"]", MsgBoxStyle.Critical, "PICTURE SMS FAILED")
Else
MsgBox("Picture SMS SENT to: " & e.DestinationNumber & vbCrLf & _
"[Queue Key: " & e.QueueMessageKey & _
"]", MsgBoxStyle.Information, "PICTURE SMS SENT")
End If
End Sub
Public Sub SetCommParameters()
Try
objSMS.Port = "COM1"
objSMS.BaudRate =
mCore.BaudRate.BaudRate_19200
objSMS.DataBits =
mCore.DataBits.Eight
objSMS.StopBits =
mCore.StopBits.One
objSMS.Parity =
mCore.Parity.None
objSMS.FlowControl =
mCore.FlowControl.RTS_CTS
Catch ex As mCore.GeneralException
MsgBox(ex.Message)
Catch ex As Exception
End Try
End Function
End Class
|
class MyClass
{
public mCore.SMS objSMS = new mCore.SMS();
public MyClass() {
objSMS.QueuePictureSMSSending +=
new mCore.SMS.QueuePictureSMSSendingEventHandler
(objSMS_QueuePictureSMSSending);
objSMS.QueuePictureSMSSent +=
new mCore.SMS.QueuePictureSMSSentEventHandler
(objSMS_QueuePictureSMSSent);
}
public static void SendQueue()
{
mCore.PictureSMS objPicSMS = objSMS.PictureSMS();
string strKey = "";
try
{ SetCommParameters();
objPicSMS.Destination =
"+919873094767";
objPicSMS.BitmapFile = "C:\\newyear.bmp";
objPicSMS.Text = "Happy
New Year";
strKey = objPicSMS.SendToQueue(mCore.QueuePriority.High);
MessageBox.Show("Picture
SMS
added to queue.\r\n" +
"[Queue Key: " + strKey + "]");
objPicSMS.Destination =
"+919810098765";
//Following message is sent with normal queue priority
strKey = objPicSMS.SendToQueue();
MessageBox.Show("Picture
SMS added
to queue.\r\n" +
"[Queue Key: " + strKey + "]");
objPicSMS.Destination =
"+919811045678";
strKey = objPicSMS.SendToQueue(mCore.QueuePriority.Low);
MessageBox.Show("Picture
SMS added
to queue.\r\n" +
"[Queue Key: " + strKey + "]");
//Message queue is enabled
objSMS.Queue.Enabled = true;
//Messages can be added to the queue even
//when the Message queue is
enabled
objPicSMS.Destination =
"+919873012345";
strKey = objPicSMS.SendToQueue(mCore.QueuePriority.High);
MessageBox.Show("Picture
SMS added
to queue.\r\n" +
"[Queue Key: " + strKey + "]");
} catch
(mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
catch (Exception e)
{
}
}
//Event at the start of sending a queued
Picture SMS
private void objSMS_QueuePictureSMSSending
(object sender, mCore.QueuePictureSMSSendingEventArgs e)
{
MessageBox.Show("Sending Picture SMS to: " + e.DestinationNumber + "/r/n" +
"[Queue Key:
" + e.QueueMessageKey + "]");
}
//Event at the end of sending a queued
Picture SMS
private void objSMS_QueuePictureSMSSent
(object sender, mCore.QueuePictureSMSSentEventArgs e)
{
if (e.ErrorCode > 0)
{
MessageBox.Show("Picture
SMS
sending FAILED to: " + e.DestinationNumber +
"/r/n" + "[ERROR: " + e.ErrorDescription + _
"]/r/n[Queue
Key: " & e.QueueMessageKey + "]");
}
else
{
MessageBox.Show("Picture
SMS
SENT to: " + e.DestinationNumber +
"/r/n" + "[ERROR: " + e.ErrorDescription + _
"]/r/n[Queue
Key: " & e.QueueMessageKey + "]");
}
}
public static void SetCommParameters()
{
try
{
objSMS.Port = "COM1";
objSMS.BaudRate =
mCore.BaudRate.BaudRate_19200;
objSMS.DataBits =
mCore.DataBits.Eight;
objSMS.StopBits =
mCore.StopBits.One;
objSMS.Parity =
mCore.Parity.None;
objSMS.FlowControl =
mCore.FlowControl.RTS_CTS;
} catch
(mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
catch (Exception e)
{
}
}
}
|