In this section, we'll look at ways of presenting information in a GUI which is updated on a regular basis. We'll use the MVC pattern to update the data.
In .NET, in general, the interface INotifyPropertyChanged
is used when the notification of an update is needed in the model. In this example, we'll use a DataGridView
control and a DataSource
that consists of a list with items of a custom type implementing the INotifyPropertyChanged
interface.
The updates to the model are handled by the controller and then the GUI is updated from the DataSource
itself. Let's start by looking at the list of orders and how to present that list of orders in the DataGridView
control. Add the following code to the GUI.fs
file:
let initOrderList() = let modelList = new BindingList<Model.Order>() let buyOrder = Model.Order(Model.OrderSide.Buy, Model.OrderType.Limit, 54.50, Model.Tif.FillorKill, 100, "MSFT", 0.0) modelList.Add(buyOrder) dataGridView.DataSource...