Example #1
0
        public void RecordTracking(EventProcessor <ShippingEvent> eProc)
        {
            // Create event depending on TrackingType
            Port          OldLocation = TrackedShip.Location;
            ShippingEvent ev;

            if (TrackingType == TrackingType.Arrival)
            {
                ev = new ArrivalEvent(DateTime.Now, SetPort, TrackedShip, TrackingType);
            }
            else
            {
                ev = new DepartureEvent(DateTime.Now, SetPort, TrackedShip, TrackingType);
            }

            // send the event to the event handler (ship) which will update it's status on the provided event data
            eProc.ProcessEvent(ev);

            // notify the UI Tracking List so it can update itself
            ShipTrackedEventArgs args = new ShipTrackedEventArgs()
            {
                TrackingServiceId = TrackingServiceId,
                Recorded          = Recorded,
                TrackingType      = TrackingType,
                TrackedShip       = TrackedShip,
                OldLocation       = OldLocation,
                NewLocation       = SetPort,
            };

            // notify subscribers ...
            OnShipTracked(args);
        }
Example #2
0
 // Notify the (UI) Subscribders that a Ship has been tracked
 protected virtual void OnShipTracked(ShipTrackedEventArgs args)
 {
     if (ShipTracked != null)
     {
         ShipTracked(this, args);
     }
 }