class MyClass
{
public mCore.SMS objSMS = new mCore.SMS();
public MyClass()
{
try
{
SetCommParameters();
objSMS.NewMessageIndication =
true;
objSMS.NewMessageConcatenate =
true;
objSMS.AutoDeleteNewMessage =
true;
}
catch (mCore.GeneralException e)
{
MessageBox.Show(e.ToString());
}
objSMS.NewMessageReceived +=
new
mCore.SMS.NewMessageReceivedHandler(objSMS_NewMessageReceived);
}
//New Message Event Handling
//A message box will pop-up whenever
//a new message is received
private void objSMS_NewMessageReceived
(object sender, mCore.NewMessageReceivedEventArgs e)
{
MessageBox.Show("NEW MESSAGE RECEIVED" + "\r\n" +
"FROM: " + e.Phone + "\r\n" +
"DATE/TIME: " + e.TimeStampRFC
+ "\r\n" +
"MESSAGE:" + "\r\n" +
e.TextMessage);
}
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)
{
}
}
} |