mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-13 18:58:09 +00:00
Issue #21: Added function Print to MtApi (MT5)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user