Esempio n. 1
0
        private void ShowCurrentShipEvents()
        {
            this._eventsTextBox.Text = string.Empty;

            // show the events for the selected ship
            try
            {
                // first get the selected ship

                Ship currentShip = (Ship)this._shipsBindingSource.Current;

                if (currentShip != null)
                {
                    // get the event logs
                    List <ShippingEvent> events = _eventProcessor.GetEvents() as List <ShippingEvent>;

                    // filter events for the current ship
                    var filterByShip = events.Where(ev => ev.Ship.ShipId == currentShip.ShipId);

                    foreach (ShippingEvent ev in filterByShip)
                    {
                        this._eventsTextBox.Text += ev.ToString() + "\r\n";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }