mCore™ .NET SMS Library 1.2

Inbox.Concatenate Property

Description:

The Inbox.Concatenate property gets or sets a Boolean value to define whether parts of received Concatenated messages will be stored as separated messages or Concatenated message parts will be joined together and stored as one single message in the Inbox (instance of mCore.Inbox type collection class returned by mCore.SMS.Inbox method).


Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)
Implements: System.Collections.IEnumerable

Remarks:

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS
   Public Sub ReadInbox()
      Dim Msg As mCore.Message, objInbox As mCore.Inbox
      Try
         SetCommParameters()
         objSMS.MessageMemory = mCore.MessageMemory.ME
         objInbox.Concatenate = True
         Try
            objInbox.Refresh()

         Catch ex As mCore.SMSReadException
            MsgBox("Error reading Inbox!" & vbCrLf & ex.Message)
         End Try

         If objInbox.HasMessages Then
            MsgBox("Total " & objInbox.Count.ToString() & " messages")
            For Each Msg In objInbox
               MsgBox("From:" & Msg.Phone & vbCrLf & Msg.Text)
            Next
         End If
      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 ReadInbox()
   {
      mCore.Message Msg;
      mCore.Inbox objInbox = objSMS.Inbox();
      try
      {

         SetCommParameters();
         objSMS.MessageMemory = mCore.MessageMemory.ME;
         objInbox.Concatenate = true;
         try
         {
            objInbox.Refresh();
         }
         catch (mCore.SMSReadException ex)
         {
            MessageBox.Show("Error reading Inbox!" + "\r\n" + ex.ToString());;
         }
         if (objSMS.Inbox().HasMessages)
         {
            MessageBox.Show("Total " + objInbox.Count.ToString() + " messages");
            foreach (mCore.Message Msg in objInbox)
            {
               MessageBox.Show("From: " + Msg.Phone + "\r\n" + Msg.Text);
            }
         }
      }

      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:

Inbox.Refresh Method
Inbox.IsEmpty Property
Inbox.HasMessages Property
Inbox.Count Property

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved