Click or drag to resize

Level1

GUI Leve1Grid

Level1Grid is the table for displaying the Level1 fields. This table uses the data as Level1ChangeMessage messages.

Main properties

Below is the code snippet with its use.

XAML
<Window x:Class="Membrane02.Level1Window"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:sx="http://schemas.stocksharp.com/xaml"
        xmlns:local="clr-namespace:Membrane02"
        mc:Ignorable="d"
        Title="Level1Window" Height="300" Width="300" Closing="Window_Closing">
    <Grid>
        <sx:Level1Grid x:Name="Level1Grid" />
    </Grid>
</Window>
C#
public Level1Window()
{
    InitializeComponent();

    _connector = MainWindow.This.Connector;

    _connector.NewMessage += OnNewMessage;

    if (!_connector.RegisteredSecurities.Contains(MainWindow.This.SelectedSecurity))
                _connector.SubscribeLevel1(MainWindow.This.SelectedSecurity);

}

private void OnNewMessage(Message message)
{
    if (message.Type == MessageTypes.Level1Change)
    {
        var level1Mes = (Level1ChangeMessage)message;
        if (level1Mes.SecurityId != MainWindow.This.SelectedSecurity.ToSecurityId())
            return;
        Level1Grid.Messages.Add(level1Mes);
    }
}