/// <summary> /// Instantiates the table widget. /// </summary> /// <param name="presenter">reference to the vessel presenter</param> /// <param name="tableContainer">container GUI element of the table</param> /// <param name="sortAscendingDisplay">icon to display in column header when sorting ascending</param> /// <param name="sortDescendingDisplay">icon to display in column header when sorting descending</param> public TableWidget(VesselPresenter presenter, ListView tableContainer, DataTemplate sortAscendingDisplay, DataTemplate sortDescendingDisplay) { Debug.Assert(presenter != null && tableContainer != null && sortAscendingDisplay != null && sortDescendingDisplay != null, "TableWidget : null arguments"); // Store arguments sortAscendingArrowDisplay = sortAscendingDisplay; sortDescendingArrowDisplay = sortDescendingDisplay; vesselPresenter = presenter; vesselListContainer = tableContainer; // Link the list view with the filtered vessels list. displayedVessels = new ObservableCollection <Vessel>(); vesselListContainer.ItemsSource = displayedVessels; // Register callback when a column header is clicked to do sorting. vesselListContainer.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnColumnHeaderClick)); // Register callback when the simulation updates to refresh our list. vesselPresenter.AddUpdateAction(OnSimulationUpdate); // Register callback when item container status changes to be able to change style colors for alarms. vesselListContainer.ItemContainerGenerator.StatusChanged += new EventHandler(OnItemContainerStatusChanged); }
public VesselView() { vesselPresenter = new VesselPresenter(); }