/// <summary>
 /// Method for processing a new <paramref name="logicalDeviceRemovedEvent"/>
 /// </summary>
 /// <param name="logicalDeviceRemovedEvent">
 /// Deserialized LogicalDeviceRemovedEvent in the xsd.exe object model.
 /// </param>
 protected virtual void ProcessLogicalDeviceRemovedEvent(LDRE.Jetstream logicalDeviceRemovedEvent)
 {
 }
        /// <summary>
        /// Event handler for the NewWindow event.
        /// </summary>
        /// <param name="sender">Events Service</param>
        /// <param name="e">The NewWindow event args</param>
        private void JetstreamService_NewWindow(object sender, NewWindowEventArgs e)
        {
            // lock so we process all events in order
            lock (_newWindowLock)
            {
                foreach (TersoSolutions.Jetstream.SDK.Application.Messages.JetstreamEvent m in e.Messages)
                {
                    try
                    {
                        Debug.WriteLine("Jetstream Message: " + m.EventType);

                        // now we can deserialize the XML message into the appropriate message
                        switch (m.EventType.Trim().ToLower())
                        {
                        case "aggregateevent":
                        {
                            AE.Jetstream message = (AE.Jetstream)m;
                            ProcessAggregateEvent(message);
                            break;
                        }

                        case "commandcompletionevent":
                        {
                            CCE.Jetstream message = (CCE.Jetstream)m;
                            ProcessCommandCompletionEvent(message);
                            break;
                        }

                        case "commandqueuedevent":
                        {
                            CQE.Jetstream message = (CQE.Jetstream)m;
                            ProcessCommandQueuedEvent(message);
                            break;
                        }

                        case "devicefailureevent":
                        {
                            DFE.Jetstream message = (DFE.Jetstream)m;
                            ProcessDeviceFailureEvent(message);
                            break;
                        }

                        case "devicerestoreevent":
                        {
                            DRE.Jetstream message = (DRE.Jetstream)m;
                            ProcessDeviceRestoreEvent(message);
                            break;
                        }

                        case "heartbeatevent":
                        {
                            HE.Jetstream message = (HE.Jetstream)m;
                            ProcessHeartbeatEvent(message);
                            break;
                        }

                        case "logentryevent":
                        {
                            LEE.Jetstream message = (LEE.Jetstream)m;
                            ProcessLogEntryEvent(message);
                            break;
                        }

                        case "logicaldeviceaddedevent":
                        {
                            LDAE.Jetstream message = (LDAE.Jetstream)m;
                            ProcessLogicalDeviceAddedEvent(message);
                            break;
                        }

                        case "logicaldeviceremovedevent":
                        {
                            LDRE.Jetstream message = (LDRE.Jetstream)m;
                            ProcessLogicalDeviceRemovedEvent(message);
                            break;
                        }

                        case "objectevent":
                        {
                            OE.Jetstream message = (OE.Jetstream)m;
                            ProcessObjectEvent(message);
                            break;
                        }

                        case "sensorreadingevent":
                        {
                            SRE.Jetstream message = (SRE.Jetstream)m;
                            ProcessSensorReadingEvent(message);
                            break;
                        }

                        default:
                        {
                            ProcessUnknownMessage(m.ToString());
                            break;
                        }
                        }
                    }
                    catch (Exception ex)
                    {
                        EventLog.WriteEntry("JetstreamSDK",
                                            ex.Message + "\n" + ex.StackTrace);
                    }
                }
            }
        }