mCore™ .NET SMS Library 1.2

WapPush.Text Property

Description:

The Text property gets or sets the WAP Push text message that will be displayed on the recipients phone screen.

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)

Exceptions:

mCore.WapPushException
mCore.GeneralException

Remarks:

When sending WAP Push message using mCore™ the total maximum allowed length of Text and URL property can be roughly estimated using the following thumb rule:

You can use the IsLengthOK property to check if the length of URL and Text is within permissible length to send the WAP Push message. However, using this method before sending every WAP Push message will reduce the throughput of messages.

Usage Example:

Visual Basic
Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
   Public Sub SendWapPush()
      Dim objWP As mCore.WapPush = objSMS.WapPush
      Try
         SetCommParameters()
         objWP.Destination = "+919873094767"
         objWP.Text = "Check your emails online"
         objWP.URL = "http://www.mobulus.com/mobile"
         objWP.Action = mCore.WapPushAction.SignalMedium
         objWP.Created = DateTime.Now
         objWP.Expiry = "1W"

         If objWP.IsLengthOK Then
            objWP.Send()
            MsgBox("WAP Push Sent!")
         Else
            MsgBox("WAP Push message length exceeds the length of a SMS")
         End If

      Catch ex As mCore.WapPushException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")
      Catch ex As Exception
      End Try
   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
 
C#
class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void SendWapPush()
   {
      mCore.WapPush objWP = objSMS.WapPush();
      try
      {

         SetCommParameters();
         objWP.Destination = "+919873094767";
         objWP.Text = "Check your emails online";
         objWP.URL = "http://www.mobulus.com/mobile";
         objWP.Action = mCore.WapPushAction.SignalMedium;
         objWP.Created = DateTime.Now;
         objWP.Expiry = "1W";

         If (objWP.IsLengthOK)
         {
            objWP.Send();
            MessageBox.Show("WAP Push Sent!");
         }
         else
         {
            MessageBox.Show("WAP Push message length exceeds the length of a SMS")
         }
      }

      catch (mCore.WapPushException e)
      {
         MessageBox.Show(e.ToString());
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }

   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)
      {
      }
   }
}

See Also:

mCore.SMS.WapPush Method
WapPush.Destination Property
WapPush.URL Property
WapPush.Action Property
WapPush.Created Property
WapPush.Expiry Property
WapPush.IsLengthOK Property
WapPush.Send Method

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved