Implemented function Alert (MT5)

This commit is contained in:
vdemydiuk
2018-03-13 18:24:40 +02:00
parent 16f454ca61
commit 9afd30e463
6 changed files with 63 additions and 15 deletions
+10 -6
View File
@@ -526,12 +526,16 @@
</WrapPanel>
<Grid Margin="10" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Text="{Binding MessageText}" Margin="5"/>
<Button Grid.Column="1" Command="{Binding PrintCommand}" Content="Print" Margin="5"/>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Text="{Binding MessageText}" Margin="2"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Command="{Binding PrintCommand}" Content="Print" Margin="2" />
<Button Command="{Binding AlertCommand}" Content="Alert" Margin="2" />
</StackPanel>
</Grid>
</Grid>
</TabItem>
+10
View File
@@ -70,6 +70,7 @@ namespace MtApi5TestClient
public DelegateCommand GetLastErrorCommand { get; private set; }
public DelegateCommand ResetLastErrorCommand { get; private set; }
public DelegateCommand PrintCommand { get; private set; }
public DelegateCommand AlertCommand { get; private set; }
public DelegateCommand iCustomCommand { get; private set; }
@@ -425,6 +426,7 @@ namespace MtApi5TestClient
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PrintCommand = new DelegateCommand(ExecutePrint);
AlertCommand = new DelegateCommand(ExecuteAlert);
GetLastErrorCommand = new DelegateCommand(ExecuteGetLastError);
ResetLastErrorCommand = new DelegateCommand(ExecuteResetLastError);
@@ -1136,6 +1138,14 @@ namespace MtApi5TestClient
AddLog($"Print: message print in MetaTrader - {retVal}");
}
private void ExecuteAlert(object obj)
{
var message = MessageText;
_mtApiClient.Alert(message);
AddLog($"Alert: send alert to MetaTrader - {message}.");
}
private async void ExecuteGetLastError(object obj)
{
var retVal = await Execute(() => _mtApiClient.GetLastError());