Esempio n. 1
0
        private void Receive()
        {
            try
            {
                var bytes = new Byte[1024];
                var data  = string.Empty;


                while (this.isStarted)
                {
                    var i = stream.Read(bytes, 0, bytes.Length);
                    if (MMSVariable.TryGetMmsVariables(bytes, out var result))
                    {
                        var receivedMmsData = new List <MMSVariable>(result.Count);

                        foreach (var variable in result)
                        {
                            receivedMmsData.Add(variable);
                        }

                        var newMessage = new NewMessageEventArgs();
                        newMessage.MmsVariables = receivedMmsData;
                        this.OnNewMessage(newMessage);
                    }
                }

                client.Close();
            }
            catch (Exception e)
            {
                throw;
            }
        }
Esempio n. 2
0
        protected virtual void OnNewMessage(NewMessageEventArgs e)
        {
            EventHandler <NewMessageEventArgs> handler = this.NewMessage;

            if (handler != null)
            {
                handler(this, e);
            }
        }