Issue #100: implemented functions GetLastError, ResetLastError() in MtApi (MT5)

This commit is contained in:
vdemydiuk
2018-03-09 19:18:54 +02:00
parent ec6c71607b
commit cab2de6d24
7 changed files with 113 additions and 13 deletions
+23 -9
View File
@@ -294,15 +294,6 @@
Command="{Binding AccountInfoStringCommand}"
Content="AccountInfoString" HorizontalAlignment="Left" />
</Grid>
<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" Content="Print" Command="{Binding PrintCommand}" Margin="5"/>
</Grid>
</Grid>
</TabItem>
@@ -433,6 +424,29 @@
<Button Command="{Binding TimeGMTCommand}" Content="TimeGMT" Margin="2"/>
</WrapPanel>
</TabItem>
<TabItem Header="Checkup and Common Functions">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<WrapPanel VerticalAlignment="Top" Margin="5">
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
</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>
</Grid>
</TabItem>
</TabControl>
<Expander Grid.Row="2" Header="Console" IsExpanded="True">
+16
View File
@@ -60,6 +60,8 @@ namespace MtApi5TestClient
public DelegateCommand PositionOpenCommand { get; private set; }
public DelegateCommand GetLastErrorCommand { get; private set; }
public DelegateCommand ResetLastErrorCommand { get; private set; }
public DelegateCommand PrintCommand { get; private set; }
public DelegateCommand iCustomCommand { get; private set; }
@@ -257,6 +259,8 @@ namespace MtApi5TestClient
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PrintCommand = new DelegateCommand(ExecutePrint);
GetLastErrorCommand = new DelegateCommand(ExecuteGetLastError);
ResetLastErrorCommand = new DelegateCommand(ExecuteResetLastError);
iCustomCommand = new DelegateCommand(ExecuteICustom);
@@ -926,6 +930,18 @@ namespace MtApi5TestClient
AddLog($"Print: message print in MetaTrader - {retVal}");
}
private async void ExecuteGetLastError(object obj)
{
var retVal = await Execute(() => _mtApiClient.GetLastError());
AddLog($"GetLastError: last error = {retVal}");
}
private void ExecuteResetLastError(object obj)
{
_mtApiClient.ResetLastError();
AddLog("GetLastError: executed.");
}
private async void ExecuteICustom(object o)
{
const string symbol = "EURUSD";