Issue #21: Added function Print to MtApi (MT5)

This commit is contained in:
vdemydiuk
2016-10-21 17:52:54 +03:00
parent 094cdcc448
commit 05452e3b90
6 changed files with 78 additions and 12 deletions
+23
View File
@@ -47,6 +47,8 @@ namespace MtApi5TestClient
public DelegateCommand MarketBookGetCommand { get; private set; }
public DelegateCommand PositionOpenCommand { get; private set; }
public DelegateCommand PrintCommand { get; private set; }
#endregion
#region Properties
@@ -131,6 +133,17 @@ namespace MtApi5TestClient
public ObservableCollection<string> TimeSeriesResults { get; } = new ObservableCollection<string>();
private string _messageText = "Print some text in MetaTrader expert console";
public string MessageText
{
get { return _messageText; }
set
{
_messageText = value;
OnPropertyChanged("MessageText");
}
}
#endregion
#region Public Methods
@@ -210,6 +223,8 @@ namespace MtApi5TestClient
MarketBookGetCommand = new DelegateCommand(ExecuteMarketBookGet);
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PrintCommand = new DelegateCommand(ExecutePrint);
}
private bool CanExecuteConnect(object o)
@@ -711,6 +726,14 @@ namespace MtApi5TestClient
AddLog($"PositionOpen: symbol EURUSD result = {retVal}");
}
private async void ExecutePrint(object obj)
{
var message = MessageText;
var retVal = await Execute(() => _mtApiClient.Print(message));
AddLog($"Print: message print in MetaTrader - {retVal}");
}
private static void RunOnUiThread(Action action)
{
Application.Current?.Dispatcher.Invoke(action);