class MyClass
{
public mCore.SMS objSMS = new mCore.SMS();
public MyClass()
{
objSMS.QueueVCalendarSending +=
new mCore.SMS.QueueVCalendarSendingEventHandler
(objSMS_QueueVCalendarSending);
objSMS.QueueVCalendarSent +=
new mCore.SMS.QueueVCalendarSentEventHandler
(objSMS_QueueVCalendarSent);
}
public static void SendQueue()
{
mCore.vCalendar objVCAL = objSMS.vCalendar();
string strVCSFile = "c:\meeting.vcs";
string strKey = "";
try
{
SetCommParameters();
strKey = objVCAL.SendFileToQueue(strVCSFile, mCore.QueuePriority.High);
MessageBox.Show("vCalendar
message
added to queue.\r\n" +
"[Queue Key: " + strKey + "]");
objVCAL.Destination =
"+919810098765";
//Following message is sent with normal queue priority
strKey = objVCAL.SendFileToQueue(strVCSFile);
MessageBox.Show("vCalendar
message added
to queue.\r\n" +
"[Queue Key: " + strKey + "]");
objVCAL.Destination =
"+919811045678";
strKey = objVCAL.SendFileToQueue(strVCSFile, mCore.QueuePriority.Low);
MessageBox.Show("vCalendar
message 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
objVCAL.Destination =
"+919873012345";
strKey = objVCAL.SendFileToQueue(strVCSFile, mCore.QueuePriority.High);
MessageBox.Show("vCalendar
message 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
vCalendar message
private void objSMS_QueueVCalendarSending
(object sender, mCore.QueueVCalendarSendingEventArgs e)
{
MessageBox.Show("Sending vCalendar message to: " + e.DestinationNumber + "/r/n" +
"[Queue Key:
" + e.QueueMessageKey + "]");
}
//Event at the end of sending a queued
vCalendar message
private void objSMS_QueueVCalendarSent
(object sender, mCore.QueueVCalendarSentEventArgs e)
{
if (e.ErrorCode > 0)
{
MessageBox.Show("vCalendar
message sending FAILED to: " + e.DestinationNumber +
"/r/n" + "[ERROR: " + e.ErrorDescription + _
"]/r/n[Queue
Key: " & e.QueueMessageKey + "]");
}
else
{
MessageBox.Show("vCalendar
message 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)
{
}
}
} |