mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-15 19:58:10 +00:00
Issue #32: Added function ChartRedraw
This commit is contained in:
@@ -12,7 +12,8 @@ namespace MTApiService
|
|||||||
{
|
{
|
||||||
static IEnumerable<Type> GetKnownTypes()
|
static IEnumerable<Type> GetKnownTypes()
|
||||||
{
|
{
|
||||||
return new Type[] { typeof(MtResponseInt), typeof(MtResponseDouble),
|
return new Type[] { typeof(MtResponseObject),
|
||||||
|
typeof(MtResponseInt), typeof(MtResponseDouble),
|
||||||
typeof(MtResponseString), typeof(MtResponseBool),
|
typeof(MtResponseString), typeof(MtResponseBool),
|
||||||
typeof(MtResponseLong), typeof(MtResponseULong),
|
typeof(MtResponseLong), typeof(MtResponseULong),
|
||||||
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
||||||
@@ -22,6 +23,28 @@ namespace MTApiService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract object GetValue();
|
public abstract object GetValue();
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
|
public int ErrorCode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[DataContract]
|
||||||
|
public class MtResponseObject : MtResponse
|
||||||
|
{
|
||||||
|
public MtResponseObject(object value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
|
public object Value { get; private set; }
|
||||||
|
|
||||||
|
public override object GetValue() { return Value; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Value?.ToString() ?? string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataContract]
|
[DataContract]
|
||||||
|
|||||||
+108
-186
@@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
#include "MT4Handler.h"
|
#include "MT4Handler.h"
|
||||||
#include "Windows.h"
|
#include "Windows.h"
|
||||||
#include < vcclr.h >
|
#include <vcclr.h>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
using namespace System;
|
using namespace System;
|
||||||
using namespace MTApiService;
|
using namespace MTApiService;
|
||||||
@@ -17,6 +18,8 @@ using namespace System::IO;
|
|||||||
using namespace System::Collections::Generic;
|
using namespace System::Collections::Generic;
|
||||||
using namespace System::Diagnostics;
|
using namespace System::Diagnostics;
|
||||||
|
|
||||||
|
#define _DLLAPI extern "C" __declspec(dllexport)
|
||||||
|
|
||||||
void convertSystemString(wchar_t* dest, String^ src)
|
void convertSystemString(wchar_t* dest, String^ src)
|
||||||
{
|
{
|
||||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||||
@@ -24,264 +27,183 @@ void convertSystemString(wchar_t* dest, String^ src)
|
|||||||
dest[wcslen(wch)] = '\0';
|
dest[wcslen(wch)] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default_value)
|
||||||
{
|
{
|
||||||
|
T result = default_value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
result = func();
|
||||||
|
}
|
||||||
|
catch (Exception^ e)
|
||||||
|
{
|
||||||
|
convertSystemString(err, e->Message);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
_DLLAPI bool _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||||
|
{
|
||||||
|
return Execute<bool>([&expertHandle, &port, symbol, &bid, &ask]() {
|
||||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||||
|
|
||||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
convertSystemString(err, e->Message);
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
_DLLAPI bool _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
convertSystemString(err, e->Message);
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
_DLLAPI bool _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, symbol, &bid, &ask]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
convertSystemString(err, e->Message);
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int _stdcall sendEvent(int expertHandle, int eventType, wchar_t* payload, wchar_t* err)
|
_DLLAPI bool _stdcall sendEvent(int expertHandle, int eventType, wchar_t* payload, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &eventType, payload]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendEvent(expertHandle, eventType, gcnew String(payload));
|
MtServerInstance::GetInstance()->SendEvent(expertHandle, eventType, gcnew String(payload));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
convertSystemString(err, e->Message);
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:updateTimeBar(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendIntResponse(int expertHandle, int response)
|
_DLLAPI bool _stdcall sendIntResponse(int expertHandle, int response, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &response]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendIntResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendBooleanResponse(int expertHandle, int response)
|
_DLLAPI bool _stdcall sendBooleanResponse(int expertHandle, bool response, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &response]() {
|
||||||
{
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(response));
|
||||||
bool value = (response != 0) ? true : false;
|
return true;
|
||||||
|
}, err, false);
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
|
||||||
}
|
|
||||||
catch (Exception^ e)
|
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendBooleanResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendDoubleResponse(int expertHandle, double response)
|
_DLLAPI bool _stdcall sendDoubleResponse(int expertHandle, double response, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &response]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendStringResponse(int expertHandle, wchar_t* response)
|
_DLLAPI bool _stdcall sendStringResponse(int expertHandle, wchar_t* response, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, response]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendStringResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendVoidResponse(int expertHandle)
|
_DLLAPI bool _stdcall sendErrorResponse(int expertHandle, int code, wchar_t* message, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &code, message]() {
|
||||||
{
|
MtResponseString^ res = gcnew MtResponseString(gcnew String(message));
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
res->ErrorCode = code;
|
||||||
}
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, res);
|
||||||
catch (Exception^ e)
|
return true;
|
||||||
{
|
}, err, false);
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendVoidResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size)
|
_DLLAPI bool _stdcall sendVoidResponse(int expertHandle, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle]() {
|
||||||
{
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseObject(nullptr));
|
||||||
|
return true;
|
||||||
|
}, err, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
_DLLAPI bool _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size, wchar_t* err)
|
||||||
|
{
|
||||||
|
return Execute<bool>([&expertHandle, values, &size]() {
|
||||||
array<double>^ list = gcnew array<double>(size);
|
array<double>^ list = gcnew array<double>(size);
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
for(int i = 0; i < size; i++)
|
|
||||||
{
|
{
|
||||||
list[i] = values[i];
|
list[i] = values[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleArrayResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
_DLLAPI bool _stdcall sendIntArrayResponse(int expertHandle, int* values, int size, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, values, &size]() {
|
||||||
{
|
|
||||||
array<int>^ list = gcnew array<int>(size);
|
array<int>^ list = gcnew array<int>(size);
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
for(int i = 0; i < size; i++)
|
|
||||||
{
|
{
|
||||||
list[i] = values[i];
|
list[i] = values[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendIntArrayResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall sendLongResponse(int expertHandle, __int64 response)
|
_DLLAPI bool _stdcall sendLongResponse(int expertHandle, __int64 response, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, &response]() {
|
||||||
{
|
|
||||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:sendLongResponse(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall getCommandType(int expertHandle, int* res)
|
_DLLAPI bool _stdcall getCommandType(int expertHandle, int* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, res]() {
|
||||||
{
|
|
||||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:getCommandType(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall getIntValue(int expertHandle, int paramIndex, int* res)
|
_DLLAPI bool _stdcall getIntValue(int expertHandle, int paramIndex, int* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, ¶mIndex, res]() {
|
||||||
{
|
|
||||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:getIntValue(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
|
_DLLAPI bool _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, ¶mIndex, res]() {
|
||||||
{
|
|
||||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:getDoubleValue(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res)
|
_DLLAPI bool _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, ¶mIndex, res]() {
|
||||||
{
|
|
||||||
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||||
}
|
return true;
|
||||||
catch (Exception^ e)
|
}, err, false);
|
||||||
{
|
|
||||||
Debug::WriteLine("[ERROR] MTConnector:getStringValue(): " + e->Message);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res)
|
_DLLAPI bool _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
try
|
return Execute<bool>([&expertHandle, ¶mIndex, res]() {
|
||||||
{
|
*res = (bool)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||||
bool val = (bool)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
return true;
|
||||||
*res = val == true ? 1 : 0;
|
}, err, false);
|
||||||
}
|
}
|
||||||
catch (Exception^ e)
|
|
||||||
{
|
_DLLAPI bool _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res, wchar_t* err)
|
||||||
Debug::WriteLine("[ERROR] MT5Connector:getBooleanValue(): " + e->Message);
|
{
|
||||||
return 0;
|
return Execute<bool>([&expertHandle, ¶mIndex, res]() {
|
||||||
}
|
*res = (__int64)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||||
return 1;
|
return true;
|
||||||
|
}, err, false);
|
||||||
}
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
LIBRARY MTConnector
|
|
||||||
|
|
||||||
EXPORTS initExpert
|
|
||||||
deinitExpert
|
|
||||||
updateQuote
|
|
||||||
sendEvent
|
|
||||||
sendIntResponse
|
|
||||||
sendBooleanResponse
|
|
||||||
sendDoubleResponse
|
|
||||||
sendStringResponse
|
|
||||||
sendVoidResponse
|
|
||||||
sendDoubleArrayResponse
|
|
||||||
sendIntArrayResponse
|
|
||||||
sendLongResponse
|
|
||||||
getCommandType
|
|
||||||
getIntValue
|
|
||||||
getDoubleValue
|
|
||||||
getStringValue
|
|
||||||
getBooleanValue
|
|
||||||
@@ -96,7 +96,6 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -109,7 +108,6 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -121,7 +119,6 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -133,7 +130,6 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>.\MTConnector.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -154,7 +150,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.ico" />
|
<None Include="app.ico" />
|
||||||
<None Include="MTConnector.def" />
|
|
||||||
<None Include="ReadMe.txt" />
|
<None Include="ReadMe.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
<None Include="app.ico">
|
<None Include="app.ico">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="MTConnector.def">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="app.rc">
|
<ResourceCompile Include="app.rc">
|
||||||
|
|||||||
@@ -1722,6 +1722,15 @@ namespace MtApi
|
|||||||
{
|
{
|
||||||
return SendCommand<long>(MtCommandType.ChartId, null);
|
return SendCommand<long>(MtCommandType.ChartId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///This function calls a forced redrawing of a specified chart.
|
||||||
|
///</summary>
|
||||||
|
public void ChartRedraw(long chartId = 0)
|
||||||
|
{
|
||||||
|
var commandParameters = new ArrayList { chartId };
|
||||||
|
SendCommand<object>(MtCommandType.ChartRedraw, commandParameters);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
@@ -1872,6 +1881,11 @@ namespace MtApi
|
|||||||
throw new MtExecutionException(MtErrorCode.MtApiCustomError, "Response from MetaTrader is null");
|
throw new MtExecutionException(MtErrorCode.MtApiCustomError, "Response from MetaTrader is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.ErrorCode != 0)
|
||||||
|
{
|
||||||
|
throw new MtExecutionException((MtErrorCode)response.ErrorCode, response.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
var responseValue = response.GetValue();
|
var responseValue = response.GetValue();
|
||||||
return responseValue != null ? (T)responseValue : default(T);
|
return responseValue != null ? (T)responseValue : default(T);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,6 +197,7 @@
|
|||||||
SymbolName = 201,
|
SymbolName = 201,
|
||||||
SymbolSelect = 202,
|
SymbolSelect = 202,
|
||||||
SymbolInfoInteger = 203,
|
SymbolInfoInteger = 203,
|
||||||
ChartId = 206
|
ChartId = 206,
|
||||||
|
ChartRedraw = 207
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+177
-176
@@ -113,6 +113,22 @@
|
|||||||
this.label22 = new System.Windows.Forms.Label();
|
this.label22 = new System.Windows.Forms.Label();
|
||||||
this.textBoxErrorCode = new System.Windows.Forms.TextBox();
|
this.textBoxErrorCode = new System.Windows.Forms.TextBox();
|
||||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||||
|
this.button67 = new System.Windows.Forms.Button();
|
||||||
|
this.button66 = new System.Windows.Forms.Button();
|
||||||
|
this.button65 = new System.Windows.Forms.Button();
|
||||||
|
this.button64 = new System.Windows.Forms.Button();
|
||||||
|
this.button63 = new System.Windows.Forms.Button();
|
||||||
|
this.button62 = new System.Windows.Forms.Button();
|
||||||
|
this.button61 = new System.Windows.Forms.Button();
|
||||||
|
this.button60 = new System.Windows.Forms.Button();
|
||||||
|
this.button59 = new System.Windows.Forms.Button();
|
||||||
|
this.button58 = new System.Windows.Forms.Button();
|
||||||
|
this.button57 = new System.Windows.Forms.Button();
|
||||||
|
this.button56 = new System.Windows.Forms.Button();
|
||||||
|
this.button55 = new System.Windows.Forms.Button();
|
||||||
|
this.button54 = new System.Windows.Forms.Button();
|
||||||
|
this.button53 = new System.Windows.Forms.Button();
|
||||||
|
this.button3 = new System.Windows.Forms.Button();
|
||||||
this.comboBoxAccountInfoCmd = new System.Windows.Forms.ComboBox();
|
this.comboBoxAccountInfoCmd = new System.Windows.Forms.ComboBox();
|
||||||
this.textBoxAccountInfoVolume = new System.Windows.Forms.TextBox();
|
this.textBoxAccountInfoVolume = new System.Windows.Forms.TextBox();
|
||||||
this.label25 = new System.Windows.Forms.Label();
|
this.label25 = new System.Windows.Forms.Label();
|
||||||
@@ -179,22 +195,6 @@
|
|||||||
this.tabPage9 = new System.Windows.Forms.TabPage();
|
this.tabPage9 = new System.Windows.Forms.TabPage();
|
||||||
this.button38 = new System.Windows.Forms.Button();
|
this.button38 = new System.Windows.Forms.Button();
|
||||||
this.button37 = new System.Windows.Forms.Button();
|
this.button37 = new System.Windows.Forms.Button();
|
||||||
this.button3 = new System.Windows.Forms.Button();
|
|
||||||
this.button53 = new System.Windows.Forms.Button();
|
|
||||||
this.button54 = new System.Windows.Forms.Button();
|
|
||||||
this.button55 = new System.Windows.Forms.Button();
|
|
||||||
this.button56 = new System.Windows.Forms.Button();
|
|
||||||
this.button57 = new System.Windows.Forms.Button();
|
|
||||||
this.button58 = new System.Windows.Forms.Button();
|
|
||||||
this.button59 = new System.Windows.Forms.Button();
|
|
||||||
this.button60 = new System.Windows.Forms.Button();
|
|
||||||
this.button61 = new System.Windows.Forms.Button();
|
|
||||||
this.button62 = new System.Windows.Forms.Button();
|
|
||||||
this.button63 = new System.Windows.Forms.Button();
|
|
||||||
this.button64 = new System.Windows.Forms.Button();
|
|
||||||
this.button65 = new System.Windows.Forms.Button();
|
|
||||||
this.button66 = new System.Windows.Forms.Button();
|
|
||||||
this.button67 = new System.Windows.Forms.Button();
|
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.statusStrip1.SuspendLayout();
|
this.statusStrip1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
@@ -1129,6 +1129,166 @@
|
|||||||
this.tabPage3.Text = "Account Information";
|
this.tabPage3.Text = "Account Information";
|
||||||
this.tabPage3.UseVisualStyleBackColor = true;
|
this.tabPage3.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// button67
|
||||||
|
//
|
||||||
|
this.button67.Location = new System.Drawing.Point(157, 33);
|
||||||
|
this.button67.Name = "button67";
|
||||||
|
this.button67.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button67.TabIndex = 14;
|
||||||
|
this.button67.Text = "AccountStopoutMode";
|
||||||
|
this.button67.UseVisualStyleBackColor = true;
|
||||||
|
this.button67.Click += new System.EventHandler(this.button67_Click);
|
||||||
|
//
|
||||||
|
// button66
|
||||||
|
//
|
||||||
|
this.button66.Location = new System.Drawing.Point(157, 4);
|
||||||
|
this.button66.Name = "button66";
|
||||||
|
this.button66.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button66.TabIndex = 14;
|
||||||
|
this.button66.Text = "AccountStopoutLevel";
|
||||||
|
this.button66.UseVisualStyleBackColor = true;
|
||||||
|
this.button66.Click += new System.EventHandler(this.button66_Click);
|
||||||
|
//
|
||||||
|
// button65
|
||||||
|
//
|
||||||
|
this.button65.Location = new System.Drawing.Point(6, 350);
|
||||||
|
this.button65.Name = "button65";
|
||||||
|
this.button65.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button65.TabIndex = 14;
|
||||||
|
this.button65.Text = "AccountServer";
|
||||||
|
this.button65.UseVisualStyleBackColor = true;
|
||||||
|
this.button65.Click += new System.EventHandler(this.button65_Click);
|
||||||
|
//
|
||||||
|
// button64
|
||||||
|
//
|
||||||
|
this.button64.Location = new System.Drawing.Point(6, 321);
|
||||||
|
this.button64.Name = "button64";
|
||||||
|
this.button64.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button64.TabIndex = 14;
|
||||||
|
this.button64.Text = "AccountProfit";
|
||||||
|
this.button64.UseVisualStyleBackColor = true;
|
||||||
|
this.button64.Click += new System.EventHandler(this.button64_Click);
|
||||||
|
//
|
||||||
|
// button63
|
||||||
|
//
|
||||||
|
this.button63.Location = new System.Drawing.Point(6, 292);
|
||||||
|
this.button63.Name = "button63";
|
||||||
|
this.button63.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button63.TabIndex = 14;
|
||||||
|
this.button63.Text = "AccountNumber";
|
||||||
|
this.button63.UseVisualStyleBackColor = true;
|
||||||
|
this.button63.Click += new System.EventHandler(this.button63_Click);
|
||||||
|
//
|
||||||
|
// button62
|
||||||
|
//
|
||||||
|
this.button62.Location = new System.Drawing.Point(6, 263);
|
||||||
|
this.button62.Name = "button62";
|
||||||
|
this.button62.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button62.TabIndex = 14;
|
||||||
|
this.button62.Text = "AccountName";
|
||||||
|
this.button62.UseVisualStyleBackColor = true;
|
||||||
|
this.button62.Click += new System.EventHandler(this.button62_Click);
|
||||||
|
//
|
||||||
|
// button61
|
||||||
|
//
|
||||||
|
this.button61.Location = new System.Drawing.Point(6, 235);
|
||||||
|
this.button61.Name = "button61";
|
||||||
|
this.button61.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button61.TabIndex = 14;
|
||||||
|
this.button61.Text = "AccountMargin";
|
||||||
|
this.button61.UseVisualStyleBackColor = true;
|
||||||
|
this.button61.Click += new System.EventHandler(this.button61_Click);
|
||||||
|
//
|
||||||
|
// button60
|
||||||
|
//
|
||||||
|
this.button60.Location = new System.Drawing.Point(6, 206);
|
||||||
|
this.button60.Name = "button60";
|
||||||
|
this.button60.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button60.TabIndex = 14;
|
||||||
|
this.button60.Text = "AccountLeverage";
|
||||||
|
this.button60.UseVisualStyleBackColor = true;
|
||||||
|
this.button60.Click += new System.EventHandler(this.button60_Click);
|
||||||
|
//
|
||||||
|
// button59
|
||||||
|
//
|
||||||
|
this.button59.Location = new System.Drawing.Point(6, 177);
|
||||||
|
this.button59.Name = "button59";
|
||||||
|
this.button59.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button59.TabIndex = 14;
|
||||||
|
this.button59.Text = "AccountFreeMarginMode";
|
||||||
|
this.button59.UseVisualStyleBackColor = true;
|
||||||
|
this.button59.Click += new System.EventHandler(this.button59_Click);
|
||||||
|
//
|
||||||
|
// button58
|
||||||
|
//
|
||||||
|
this.button58.Location = new System.Drawing.Point(190, 159);
|
||||||
|
this.button58.Name = "button58";
|
||||||
|
this.button58.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button58.TabIndex = 14;
|
||||||
|
this.button58.Text = "AccountFreeMarginCheck";
|
||||||
|
this.button58.UseVisualStyleBackColor = true;
|
||||||
|
this.button58.Click += new System.EventHandler(this.button58_Click);
|
||||||
|
//
|
||||||
|
// button57
|
||||||
|
//
|
||||||
|
this.button57.Location = new System.Drawing.Point(6, 148);
|
||||||
|
this.button57.Name = "button57";
|
||||||
|
this.button57.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button57.TabIndex = 14;
|
||||||
|
this.button57.Text = "AccountFreeMargin";
|
||||||
|
this.button57.UseVisualStyleBackColor = true;
|
||||||
|
this.button57.Click += new System.EventHandler(this.button57_Click);
|
||||||
|
//
|
||||||
|
// button56
|
||||||
|
//
|
||||||
|
this.button56.Location = new System.Drawing.Point(6, 119);
|
||||||
|
this.button56.Name = "button56";
|
||||||
|
this.button56.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button56.TabIndex = 14;
|
||||||
|
this.button56.Text = "AccountEquity";
|
||||||
|
this.button56.UseVisualStyleBackColor = true;
|
||||||
|
this.button56.Click += new System.EventHandler(this.button56_Click);
|
||||||
|
//
|
||||||
|
// button55
|
||||||
|
//
|
||||||
|
this.button55.Location = new System.Drawing.Point(6, 90);
|
||||||
|
this.button55.Name = "button55";
|
||||||
|
this.button55.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button55.TabIndex = 13;
|
||||||
|
this.button55.Text = "AccountCurrency";
|
||||||
|
this.button55.UseVisualStyleBackColor = true;
|
||||||
|
this.button55.Click += new System.EventHandler(this.button55_Click);
|
||||||
|
//
|
||||||
|
// button54
|
||||||
|
//
|
||||||
|
this.button54.Location = new System.Drawing.Point(6, 62);
|
||||||
|
this.button54.Name = "button54";
|
||||||
|
this.button54.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button54.TabIndex = 12;
|
||||||
|
this.button54.Text = "AccountCompany";
|
||||||
|
this.button54.UseVisualStyleBackColor = true;
|
||||||
|
this.button54.Click += new System.EventHandler(this.button54_Click);
|
||||||
|
//
|
||||||
|
// button53
|
||||||
|
//
|
||||||
|
this.button53.Location = new System.Drawing.Point(6, 33);
|
||||||
|
this.button53.Name = "button53";
|
||||||
|
this.button53.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button53.TabIndex = 11;
|
||||||
|
this.button53.Text = "AccountCredit";
|
||||||
|
this.button53.UseVisualStyleBackColor = true;
|
||||||
|
this.button53.Click += new System.EventHandler(this.button53_Click);
|
||||||
|
//
|
||||||
|
// button3
|
||||||
|
//
|
||||||
|
this.button3.Location = new System.Drawing.Point(6, 4);
|
||||||
|
this.button3.Name = "button3";
|
||||||
|
this.button3.Size = new System.Drawing.Size(145, 23);
|
||||||
|
this.button3.TabIndex = 10;
|
||||||
|
this.button3.Text = "AccountBalance";
|
||||||
|
this.button3.UseVisualStyleBackColor = true;
|
||||||
|
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||||
|
//
|
||||||
// comboBoxAccountInfoCmd
|
// comboBoxAccountInfoCmd
|
||||||
//
|
//
|
||||||
this.comboBoxAccountInfoCmd.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxAccountInfoCmd.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
@@ -1808,6 +1968,7 @@
|
|||||||
this.button38.TabIndex = 1;
|
this.button38.TabIndex = 1;
|
||||||
this.button38.Text = "ChartRedraw";
|
this.button38.Text = "ChartRedraw";
|
||||||
this.button38.UseVisualStyleBackColor = true;
|
this.button38.UseVisualStyleBackColor = true;
|
||||||
|
this.button38.Click += new System.EventHandler(this.button38_Click);
|
||||||
//
|
//
|
||||||
// button37
|
// button37
|
||||||
//
|
//
|
||||||
@@ -1819,166 +1980,6 @@
|
|||||||
this.button37.UseVisualStyleBackColor = true;
|
this.button37.UseVisualStyleBackColor = true;
|
||||||
this.button37.Click += new System.EventHandler(this.button37_Click);
|
this.button37.Click += new System.EventHandler(this.button37_Click);
|
||||||
//
|
//
|
||||||
// button3
|
|
||||||
//
|
|
||||||
this.button3.Location = new System.Drawing.Point(6, 4);
|
|
||||||
this.button3.Name = "button3";
|
|
||||||
this.button3.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button3.TabIndex = 10;
|
|
||||||
this.button3.Text = "AccountBalance";
|
|
||||||
this.button3.UseVisualStyleBackColor = true;
|
|
||||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
|
||||||
//
|
|
||||||
// button53
|
|
||||||
//
|
|
||||||
this.button53.Location = new System.Drawing.Point(6, 33);
|
|
||||||
this.button53.Name = "button53";
|
|
||||||
this.button53.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button53.TabIndex = 11;
|
|
||||||
this.button53.Text = "AccountCredit";
|
|
||||||
this.button53.UseVisualStyleBackColor = true;
|
|
||||||
this.button53.Click += new System.EventHandler(this.button53_Click);
|
|
||||||
//
|
|
||||||
// button54
|
|
||||||
//
|
|
||||||
this.button54.Location = new System.Drawing.Point(6, 62);
|
|
||||||
this.button54.Name = "button54";
|
|
||||||
this.button54.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button54.TabIndex = 12;
|
|
||||||
this.button54.Text = "AccountCompany";
|
|
||||||
this.button54.UseVisualStyleBackColor = true;
|
|
||||||
this.button54.Click += new System.EventHandler(this.button54_Click);
|
|
||||||
//
|
|
||||||
// button55
|
|
||||||
//
|
|
||||||
this.button55.Location = new System.Drawing.Point(6, 90);
|
|
||||||
this.button55.Name = "button55";
|
|
||||||
this.button55.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button55.TabIndex = 13;
|
|
||||||
this.button55.Text = "AccountCurrency";
|
|
||||||
this.button55.UseVisualStyleBackColor = true;
|
|
||||||
this.button55.Click += new System.EventHandler(this.button55_Click);
|
|
||||||
//
|
|
||||||
// button56
|
|
||||||
//
|
|
||||||
this.button56.Location = new System.Drawing.Point(6, 119);
|
|
||||||
this.button56.Name = "button56";
|
|
||||||
this.button56.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button56.TabIndex = 14;
|
|
||||||
this.button56.Text = "AccountEquity";
|
|
||||||
this.button56.UseVisualStyleBackColor = true;
|
|
||||||
this.button56.Click += new System.EventHandler(this.button56_Click);
|
|
||||||
//
|
|
||||||
// button57
|
|
||||||
//
|
|
||||||
this.button57.Location = new System.Drawing.Point(6, 148);
|
|
||||||
this.button57.Name = "button57";
|
|
||||||
this.button57.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button57.TabIndex = 14;
|
|
||||||
this.button57.Text = "AccountFreeMargin";
|
|
||||||
this.button57.UseVisualStyleBackColor = true;
|
|
||||||
this.button57.Click += new System.EventHandler(this.button57_Click);
|
|
||||||
//
|
|
||||||
// button58
|
|
||||||
//
|
|
||||||
this.button58.Location = new System.Drawing.Point(190, 159);
|
|
||||||
this.button58.Name = "button58";
|
|
||||||
this.button58.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button58.TabIndex = 14;
|
|
||||||
this.button58.Text = "AccountFreeMarginCheck";
|
|
||||||
this.button58.UseVisualStyleBackColor = true;
|
|
||||||
this.button58.Click += new System.EventHandler(this.button58_Click);
|
|
||||||
//
|
|
||||||
// button59
|
|
||||||
//
|
|
||||||
this.button59.Location = new System.Drawing.Point(6, 177);
|
|
||||||
this.button59.Name = "button59";
|
|
||||||
this.button59.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button59.TabIndex = 14;
|
|
||||||
this.button59.Text = "AccountFreeMarginMode";
|
|
||||||
this.button59.UseVisualStyleBackColor = true;
|
|
||||||
this.button59.Click += new System.EventHandler(this.button59_Click);
|
|
||||||
//
|
|
||||||
// button60
|
|
||||||
//
|
|
||||||
this.button60.Location = new System.Drawing.Point(6, 206);
|
|
||||||
this.button60.Name = "button60";
|
|
||||||
this.button60.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button60.TabIndex = 14;
|
|
||||||
this.button60.Text = "AccountLeverage";
|
|
||||||
this.button60.UseVisualStyleBackColor = true;
|
|
||||||
this.button60.Click += new System.EventHandler(this.button60_Click);
|
|
||||||
//
|
|
||||||
// button61
|
|
||||||
//
|
|
||||||
this.button61.Location = new System.Drawing.Point(6, 235);
|
|
||||||
this.button61.Name = "button61";
|
|
||||||
this.button61.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button61.TabIndex = 14;
|
|
||||||
this.button61.Text = "AccountMargin";
|
|
||||||
this.button61.UseVisualStyleBackColor = true;
|
|
||||||
this.button61.Click += new System.EventHandler(this.button61_Click);
|
|
||||||
//
|
|
||||||
// button62
|
|
||||||
//
|
|
||||||
this.button62.Location = new System.Drawing.Point(6, 263);
|
|
||||||
this.button62.Name = "button62";
|
|
||||||
this.button62.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button62.TabIndex = 14;
|
|
||||||
this.button62.Text = "AccountName";
|
|
||||||
this.button62.UseVisualStyleBackColor = true;
|
|
||||||
this.button62.Click += new System.EventHandler(this.button62_Click);
|
|
||||||
//
|
|
||||||
// button63
|
|
||||||
//
|
|
||||||
this.button63.Location = new System.Drawing.Point(6, 292);
|
|
||||||
this.button63.Name = "button63";
|
|
||||||
this.button63.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button63.TabIndex = 14;
|
|
||||||
this.button63.Text = "AccountNumber";
|
|
||||||
this.button63.UseVisualStyleBackColor = true;
|
|
||||||
this.button63.Click += new System.EventHandler(this.button63_Click);
|
|
||||||
//
|
|
||||||
// button64
|
|
||||||
//
|
|
||||||
this.button64.Location = new System.Drawing.Point(6, 321);
|
|
||||||
this.button64.Name = "button64";
|
|
||||||
this.button64.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button64.TabIndex = 14;
|
|
||||||
this.button64.Text = "AccountProfit";
|
|
||||||
this.button64.UseVisualStyleBackColor = true;
|
|
||||||
this.button64.Click += new System.EventHandler(this.button64_Click);
|
|
||||||
//
|
|
||||||
// button65
|
|
||||||
//
|
|
||||||
this.button65.Location = new System.Drawing.Point(6, 350);
|
|
||||||
this.button65.Name = "button65";
|
|
||||||
this.button65.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button65.TabIndex = 14;
|
|
||||||
this.button65.Text = "AccountServer";
|
|
||||||
this.button65.UseVisualStyleBackColor = true;
|
|
||||||
this.button65.Click += new System.EventHandler(this.button65_Click);
|
|
||||||
//
|
|
||||||
// button66
|
|
||||||
//
|
|
||||||
this.button66.Location = new System.Drawing.Point(157, 4);
|
|
||||||
this.button66.Name = "button66";
|
|
||||||
this.button66.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button66.TabIndex = 14;
|
|
||||||
this.button66.Text = "AccountStopoutLevel";
|
|
||||||
this.button66.UseVisualStyleBackColor = true;
|
|
||||||
this.button66.Click += new System.EventHandler(this.button66_Click);
|
|
||||||
//
|
|
||||||
// button67
|
|
||||||
//
|
|
||||||
this.button67.Location = new System.Drawing.Point(157, 33);
|
|
||||||
this.button67.Name = "button67";
|
|
||||||
this.button67.Size = new System.Drawing.Size(145, 23);
|
|
||||||
this.button67.TabIndex = 14;
|
|
||||||
this.button67.Text = "AccountStopoutMode";
|
|
||||||
this.button67.UseVisualStyleBackColor = true;
|
|
||||||
this.button67.Click += new System.EventHandler(this.button67_Click);
|
|
||||||
//
|
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
|||||||
@@ -627,9 +627,9 @@ namespace TestApiClientUI
|
|||||||
listBoxEventLog.Items.Clear();
|
listBoxEventLog.Items.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<TResult> Execute<TResult>(Func<TResult> func)
|
private Task<TResult> Execute<TResult>(Func<TResult> func)
|
||||||
{
|
{
|
||||||
return await Task.Factory.StartNew(() =>
|
return Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
var result = default(TResult);
|
var result = default(TResult);
|
||||||
try
|
try
|
||||||
@@ -649,6 +649,25 @@ namespace TestApiClientUI
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task Execute(Action action)
|
||||||
|
{
|
||||||
|
return Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
catch (MtConnectionException ex)
|
||||||
|
{
|
||||||
|
PrintLog("MtExecutionException: " + ex.Message);
|
||||||
|
}
|
||||||
|
catch (MtExecutionException ex)
|
||||||
|
{
|
||||||
|
PrintLog("MtExecutionException: " + ex.Message + "; ErrorCode = " + ex.ErrorCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//OrderSend
|
//OrderSend
|
||||||
private async void button1_Click(object sender, EventArgs e)
|
private async void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -1100,17 +1119,10 @@ namespace TestApiClientUI
|
|||||||
_apiClient.ExecutorHandle = expertHandle;
|
_apiClient.ExecutorHandle = expertHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CharID
|
|
||||||
private async void button37_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var result = await Execute(() => _apiClient.ChartId());
|
|
||||||
PrintLog($"CharID: result = {result}");
|
|
||||||
}
|
|
||||||
|
|
||||||
//GetLastError
|
//GetLastError
|
||||||
private async void button40_Click(object sender, EventArgs e)
|
private async void button40_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.GetLastError());
|
var result = await Execute(_apiClient.GetLastError);
|
||||||
PrintLog($"GetLastError: result = {result}");
|
PrintLog($"GetLastError: result = {result}");
|
||||||
RunOnUiThread(() => { textBoxErrorCode.Text = result.ToString(); });
|
RunOnUiThread(() => { textBoxErrorCode.Text = result.ToString(); });
|
||||||
}
|
}
|
||||||
@@ -1140,131 +1152,131 @@ namespace TestApiClientUI
|
|||||||
//IsConnected
|
//IsConnected
|
||||||
private async void button41_Click(object sender, EventArgs e)
|
private async void button41_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsConnected());
|
var result = await Execute(_apiClient.IsConnected);
|
||||||
PrintLog($"IsConnected: result = {result}");
|
PrintLog($"IsConnected: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsDemo
|
//IsDemo
|
||||||
private async void button42_Click(object sender, EventArgs e)
|
private async void button42_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsDemo());
|
var result = await Execute(_apiClient.IsDemo);
|
||||||
PrintLog($"IsDemo: result = {result}");
|
PrintLog($"IsDemo: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsDllsAllowed
|
//IsDllsAllowed
|
||||||
private async void button43_Click(object sender, EventArgs e)
|
private async void button43_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsDllsAllowed());
|
var result = await Execute(_apiClient.IsDllsAllowed);
|
||||||
PrintLog($"IsDllsAllowed: result = {result}");
|
PrintLog($"IsDllsAllowed: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsExpertEnabled
|
//IsExpertEnabled
|
||||||
private async void button44_Click(object sender, EventArgs e)
|
private async void button44_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsExpertEnabled());
|
var result = await Execute(_apiClient.IsExpertEnabled);
|
||||||
PrintLog($"IsExpertEnabled: result = {result}");
|
PrintLog($"IsExpertEnabled: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsLibrariesAllowed
|
//IsLibrariesAllowed
|
||||||
private async void button45_Click(object sender, EventArgs e)
|
private async void button45_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsLibrariesAllowed());
|
var result = await Execute(_apiClient.IsLibrariesAllowed);
|
||||||
PrintLog($"IsLibrariesAllowed: result = {result}");
|
PrintLog($"IsLibrariesAllowed: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsOptimization
|
//IsOptimization
|
||||||
private async void button46_Click(object sender, EventArgs e)
|
private async void button46_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsOptimization());
|
var result = await Execute(_apiClient.IsOptimization);
|
||||||
PrintLog($"IsOptimization: result = {result}");
|
PrintLog($"IsOptimization: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsStopped
|
//IsStopped
|
||||||
private async void button47_Click(object sender, EventArgs e)
|
private async void button47_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsStopped());
|
var result = await Execute(_apiClient.IsStopped);
|
||||||
PrintLog($"IsStopped: result = {result}");
|
PrintLog($"IsStopped: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsTesting
|
//IsTesting
|
||||||
private async void button48_Click(object sender, EventArgs e)
|
private async void button48_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsTesting());
|
var result = await Execute(_apiClient.IsTesting);
|
||||||
PrintLog($"IsTesting: result = {result}");
|
PrintLog($"IsTesting: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsTradeAllowed
|
//IsTradeAllowed
|
||||||
private async void button49_Click(object sender, EventArgs e)
|
private async void button49_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsTradeAllowed());
|
var result = await Execute(_apiClient.IsTradeAllowed);
|
||||||
PrintLog($"IsTradeAllowed: result = {result}");
|
PrintLog($"IsTradeAllowed: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsTradeContextBusy
|
//IsTradeContextBusy
|
||||||
private async void button50_Click(object sender, EventArgs e)
|
private async void button50_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsTradeContextBusy());
|
var result = await Execute(_apiClient.IsTradeContextBusy);
|
||||||
PrintLog($"IsTradeContextBusy: result = {result}");
|
PrintLog($"IsTradeContextBusy: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//IsVisualMode
|
//IsVisualMode
|
||||||
private async void button51_Click(object sender, EventArgs e)
|
private async void button51_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.IsVisualMode());
|
var result = await Execute(_apiClient.IsVisualMode);
|
||||||
PrintLog($"IsVisualMode: result = {result}");
|
PrintLog($"IsVisualMode: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//UninitializeReason
|
//UninitializeReason
|
||||||
private async void button52_Click(object sender, EventArgs e)
|
private async void button52_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = await Execute(() => _apiClient.UninitializeReason());
|
var result = await Execute(_apiClient.UninitializeReason);
|
||||||
PrintLog($"UninitializeReason: result = {result}");
|
PrintLog($"UninitializeReason: result = {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountBalance
|
//AccountBalance
|
||||||
private void button3_Click(object sender, EventArgs e)
|
private async void button3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountBalance();
|
var result = await Execute(_apiClient.AccountBalance);
|
||||||
PrintLog($"AccountBalance result: {result}");
|
PrintLog($"AccountBalance result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountCredit
|
//AccountCredit
|
||||||
private void button53_Click(object sender, EventArgs e)
|
private async void button53_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountCredit();
|
var result = await Execute(_apiClient.AccountCredit);
|
||||||
PrintLog($"AccountCredit result: {result}");
|
PrintLog($"AccountCredit result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountCompany
|
//AccountCompany
|
||||||
private void button54_Click(object sender, EventArgs e)
|
private async void button54_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountCompany();
|
var result = await Execute(_apiClient.AccountCompany);
|
||||||
PrintLog($"AccountCompany result: {result}");
|
PrintLog($"AccountCompany result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountCurrency
|
//AccountCurrency
|
||||||
private void button55_Click(object sender, EventArgs e)
|
private async void button55_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountCurrency();
|
var result = await Execute(_apiClient.AccountCurrency);
|
||||||
PrintLog($"AccountCurrency result: {result}");
|
PrintLog($"AccountCurrency result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountEquity
|
//AccountEquity
|
||||||
private void button56_Click(object sender, EventArgs e)
|
private async void button56_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountEquity();
|
var result = await Execute(_apiClient.AccountEquity);
|
||||||
PrintLog($"AccountEquity result: {result}");
|
PrintLog($"AccountEquity result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountFreeMargin
|
//AccountFreeMargin
|
||||||
private void button57_Click(object sender, EventArgs e)
|
private async void button57_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountFreeMargin();
|
var result = await Execute(_apiClient.AccountFreeMargin);
|
||||||
PrintLog($"AccountFreeMargin result: {result}");
|
PrintLog($"AccountFreeMargin result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountFreeMarginCheck
|
//AccountFreeMarginCheck
|
||||||
private void button58_Click(object sender, EventArgs e)
|
private async void button58_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var symbol = textBoxAccountInfoSymbol.Text;
|
var symbol = textBoxAccountInfoSymbol.Text;
|
||||||
if (string.IsNullOrEmpty(symbol))
|
if (string.IsNullOrEmpty(symbol))
|
||||||
@@ -1285,71 +1297,85 @@ namespace TestApiClientUI
|
|||||||
TradeOperation cmd;
|
TradeOperation cmd;
|
||||||
Enum.TryParse(comboBoxAccountInfoCmd.Text, out cmd);
|
Enum.TryParse(comboBoxAccountInfoCmd.Text, out cmd);
|
||||||
|
|
||||||
var result = _apiClient.AccountFreeMarginCheck(symbol, cmd, volume);
|
var result = await Execute(() => _apiClient.AccountFreeMarginCheck(symbol, cmd, volume));
|
||||||
PrintLog($"AccountFreeMarginCheck result: {result}");
|
PrintLog($"AccountFreeMarginCheck result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountFreeMarginMode
|
//AccountFreeMarginMode
|
||||||
private void button59_Click(object sender, EventArgs e)
|
private async void button59_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountFreeMarginMode();
|
var result = await Execute(_apiClient.AccountFreeMarginMode);
|
||||||
PrintLog($"AccountFreeMarginMode result: {result}");
|
PrintLog($"AccountFreeMarginMode result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountLeverage
|
//AccountLeverage
|
||||||
private void button60_Click(object sender, EventArgs e)
|
private async void button60_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountLeverage();
|
var result = await Execute(_apiClient.AccountLeverage);
|
||||||
PrintLog($"AccountLeverage result: {result}");
|
PrintLog($"AccountLeverage result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountMargin
|
//AccountMargin
|
||||||
private void button61_Click(object sender, EventArgs e)
|
private async void button61_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountMargin();
|
var result = await Execute(_apiClient.AccountMargin);
|
||||||
PrintLog($"AccountMargin result: {result}");
|
PrintLog($"AccountMargin result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountName
|
//AccountName
|
||||||
private void button62_Click(object sender, EventArgs e)
|
private async void button62_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountName();
|
var result = await Execute(_apiClient.AccountName);
|
||||||
PrintLog($"AccountName result: {result}");
|
PrintLog($"AccountName result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountNumber
|
//AccountNumber
|
||||||
private void button63_Click(object sender, EventArgs e)
|
private async void button63_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountNumber();
|
var result = await Execute(_apiClient.AccountNumber);
|
||||||
PrintLog($"AccountNumber result: {result}");
|
PrintLog($"AccountNumber result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountProfit
|
//AccountProfit
|
||||||
private void button64_Click(object sender, EventArgs e)
|
private async void button64_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountProfit();
|
var result = await Execute(_apiClient.AccountProfit);
|
||||||
PrintLog($"AccountProfit result: {result}");
|
PrintLog($"AccountProfit result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountServer
|
//AccountServer
|
||||||
private void button65_Click(object sender, EventArgs e)
|
private async void button65_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountServer();
|
var result = await Execute(_apiClient.AccountServer);
|
||||||
PrintLog($"AccountServer result: {result}");
|
PrintLog($"AccountServer result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountStopoutLevel
|
//AccountStopoutLevel
|
||||||
private void button66_Click(object sender, EventArgs e)
|
private async void button66_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountStopoutLevel();
|
var result = await Execute(_apiClient.AccountStopoutLevel);
|
||||||
PrintLog($"AccountStopoutLevel result: {result}");
|
PrintLog($"AccountStopoutLevel result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//AccountStopoutMode
|
//AccountStopoutMode
|
||||||
private void button67_Click(object sender, EventArgs e)
|
private async void button67_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var result = _apiClient.AccountStopoutMode();
|
var result = await Execute(_apiClient.AccountStopoutMode);
|
||||||
PrintLog($"AccountStopoutMode result: {result}");
|
PrintLog($"AccountStopoutMode result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CharID
|
||||||
|
private async void button37_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var result = await Execute(_apiClient.ChartId);
|
||||||
|
PrintLog($"CharID: result = {result}");
|
||||||
|
}
|
||||||
|
|
||||||
|
//ChartRedraw
|
||||||
|
private async void button38_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Execute(() => _apiClient.ChartRedraw());
|
||||||
|
PrintLog($"ChartRedraw: called.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user