Issue #90: Added time functions: TimeCurrent, TimeTradeServer, TimeLocal, TimeGMT

This commit is contained in:
vdemydiuk
2018-02-19 18:48:31 +02:00
parent 83776f8b7a
commit 5c6751de9b
6 changed files with 155 additions and 6 deletions
@@ -389,6 +389,15 @@
<Button Command="{Binding iCustomCommand}" Content="iCustom" Margin="2"/>
</WrapPanel>
</TabItem>
<TabItem Header="Time and Date">
<WrapPanel VerticalAlignment="Top" Margin="5">
<Button Command="{Binding TimeCurrentCommand}" Content="TimeCurrent" Margin="2"/>
<Button Command="{Binding TimeTradeServerCommand}" Content="TimeTradeServer" Margin="2"/>
<Button Command="{Binding TimeLocalCommand}" Content="TimeLocal" Margin="2"/>
<Button Command="{Binding TimeGMTCommand}" Content="TimeGMT" Margin="2"/>
</WrapPanel>
</TabItem>
</TabControl>
<Expander Grid.Row="2" Header="Console" IsExpanded="True">
+34
View File
@@ -60,6 +60,11 @@ namespace MtApi5TestClient
public DelegateCommand PrintCommand { get; private set; }
public DelegateCommand iCustomCommand { get; private set; }
public DelegateCommand TimeCurrentCommand { get; private set; }
public DelegateCommand TimeTradeServerCommand { get; private set; }
public DelegateCommand TimeLocalCommand { get; private set; }
public DelegateCommand TimeGMTCommand { get; private set; }
#endregion
#region Properties
@@ -246,6 +251,11 @@ namespace MtApi5TestClient
PrintCommand = new DelegateCommand(ExecutePrint);
iCustomCommand = new DelegateCommand(ExecuteICustom);
TimeCurrentCommand = new DelegateCommand(ExecuteTimeCurrent);
TimeTradeServerCommand = new DelegateCommand(ExecuteTimeTradeServer);
TimeLocalCommand = new DelegateCommand(ExecuteTimeLocal);
TimeGMTCommand = new DelegateCommand(ExecuteTimeGMT);
}
private bool CanExecuteConnect(object o)
@@ -866,6 +876,30 @@ namespace MtApi5TestClient
AddLog($"Custom Moving Average: result - {retVal}");
}
private async void ExecuteTimeCurrent(object o)
{
var retVal = await Execute(() => _mtApiClient.TimeCurrent());
AddLog($"TimeCurrent: {retVal}");
}
private async void ExecuteTimeTradeServer(object o)
{
var retVal = await Execute(() => _mtApiClient.TimeTradeServer());
AddLog($"TimeTradeServer: {retVal}");
}
private async void ExecuteTimeLocal(object o)
{
var retVal = await Execute(() => _mtApiClient.TimeLocal());
AddLog($"TimeLocal: {retVal}");
}
private async void ExecuteTimeGMT(object o)
{
var retVal = await Execute(() => _mtApiClient.TimeGMT());
AddLog($"TimeGMT: {retVal}");
}
private static void RunOnUiThread(Action action)
{
Application.Current?.Dispatcher.Invoke(action);