mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Moved test applications to folder TestClients. Fixed build of installers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -20,7 +20,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MT5Connector</RootNamespace>
|
||||
</PropertyGroup>
|
||||
@@ -30,28 +30,28 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
Binary file not shown.
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.19.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.19.0")]
|
||||
[assembly: AssemblyVersion("1.0.20.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.20.0")]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -20,7 +20,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2BE5FAC1-7FB7-45C3-9215-31A5BC4B964F}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MTConnector</RootNamespace>
|
||||
<ProjectName>MTConnector</ProjectName>
|
||||
@@ -31,28 +31,28 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
<?define ProductName="MtApi5_x64" ?>
|
||||
<?define ProductPathNative="..\build\products\$(var.Configuration)\"?>
|
||||
<?define ProductPathNative="..\build\products\$(var.Configuration)\x64\"?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||
<?define PlatformSystemFolder = "System64Folder" ?>
|
||||
<?else ?>
|
||||
<?define ProductName="MtApi5" ?>
|
||||
<?define ProductPathNative="..\build\products\$(var.Configuration)\x64\"?>
|
||||
<?define ProductPathNative="..\build\products\$(var.Configuration)\"?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||
<?define PlatformSystemFolder = "SystemFolder" ?>
|
||||
<?endif ?>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<Application x:Class="MtApi5TestClient.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
private readonly Predicate<object> _canExecute;
|
||||
private readonly Action<object> _execute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public DelegateCommand(Action<object> execute)
|
||||
: this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<object> execute,
|
||||
Predicate<object> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return _canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
if (CanExecuteChanged != null)
|
||||
{
|
||||
CanExecuteChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,391 +0,0 @@
|
||||
<Window x:Class="MtApi5TestClient.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mtapi5="clr-namespace:MtApi5;assembly=MtApi5"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
Title="MainWindow" Height="700" Width="650"
|
||||
Closing="Window_Closing">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="ConnectionTextBlockTemplate" DataType="{x:Type mtapi5:Mt5ConnectionState}">
|
||||
<TextBlock Text="{Binding}" x:Name="PART_Text" />
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding}" Value="Connected">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connected" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Green" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Connecting">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connecting..." />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Gold" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Failed">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connection Failed" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Red" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Disconnected">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Disconnected" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Black" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TRADE_REQUEST_ACTIONS_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TRADE_REQUEST_ACTIONS"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_FILLING_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE_FILLING"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_TIME_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE_TIME"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_DOUBLE_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_DOUBLE"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_STRING_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_STRING"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_INTEGER_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_INTEGER"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TIMEFRAMES_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TIMEFRAMES"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid x:Name="_MainLayout">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Expander ExpandDirection="Right" IsExpanded="True"
|
||||
Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="Connection" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="Auto">
|
||||
<TextBlock.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="-90"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.LayoutTransform>
|
||||
<TextBlock.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
</Expander.Header>
|
||||
<Expander.Content>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Orientation="Horizontal">
|
||||
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
||||
<Button Margin="5,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander.Content>
|
||||
</Expander>
|
||||
|
||||
<ListView Grid.Row="0" Grid.Column="1"
|
||||
ItemsSource="{Binding Quotes}"
|
||||
SelectedItem="{Binding SelectedQuote}"
|
||||
SelectionMode="Single">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="140" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
||||
<GridViewColumn Width="80" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
||||
<GridViewColumn Width="80" Header="Ask" DisplayMemberBinding="{Binding Ask}" />
|
||||
<GridViewColumn Width="80" Header="Feeds Count" DisplayMemberBinding="{Binding FeedCount}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
|
||||
<TabControl Grid.Row="1" >
|
||||
<TabItem Header="Trade Functions">
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Expander Header="MqlTradeRequest" Margin="10">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Action"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Source={StaticResource ENUM_TRADE_REQUEST_ACTIONS_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Action}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="Magic" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="0" Text="{Binding TradeRequest.Magic}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="Order"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding TradeRequest.Order}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="1" Text="Symbol" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="1" Text="{Binding TradeRequest.Symbol}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="Volume"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding TradeRequest.Volume}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" Text="Price" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="2" Text="{Binding TradeRequest.Price}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="Stoplimit"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding TradeRequest.Stoplimit}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="3" Text="Sl" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="3" Text="{Binding TradeRequest.Sl}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="Tp"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding TradeRequest.Tp}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="4" Text="Deviation" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="4" Text="{Binding TradeRequest.Deviation}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="5" Text="Type"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="5" Text="Type_filling" Margin="10,0,0,0"/>
|
||||
<ComboBox Grid.Column="3" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_FILLING_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_filling}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="6" Text="Type_time"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="6" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_TIME_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_time}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="6" Text="Expiration" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="6" Text="{Binding TradeRequest}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="7" Text="Comment"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" Text="{Binding TradeRequest}" Margin="5,0,0,0"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Account Information">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="0"
|
||||
SelectedItem="{Binding AccountInfoDoublePropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_DOUBLE_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoDoubleCommand}"
|
||||
Content="AccountInfoDouble" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="1"
|
||||
SelectedItem="{Binding AccountInfoIntegerPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_INTEGER_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoIntegerCommand}"
|
||||
Content="AccountInfoInteger" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="2"
|
||||
SelectedItem="{Binding AccountInfoStringPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_STRING_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoStringCommand}"
|
||||
Content="AccountInfoString" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Timeseries and Indicators Access">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox Grid.Row="0" Text="symbol_name"/>
|
||||
<TextBox Grid.Row="1" Text="timeframe"/>
|
||||
<TextBox Grid.Row="2" Text="start_pos"/>
|
||||
<TextBox Grid.Row="3" Text="count"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
||||
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}"/>
|
||||
|
||||
<WrapPanel Grid.Row="4" Grid.ColumnSpan="2" Margin="10">
|
||||
<Button Command="{Binding CopyRatesCommand}"
|
||||
Content="CopyRates" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTimesCommand}"
|
||||
Content="CopyTimes" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyOpenCommand}"
|
||||
Content="CopyOpen" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyHighCommand}"
|
||||
Content="CopyHigh" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyLowCommand}"
|
||||
Content="CopyLow" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyCloseCommand}"
|
||||
Content="CopyClose" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTickVolumeCommand}"
|
||||
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyRealVolumeCommand}"
|
||||
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopySpreadCommand}"
|
||||
Content="CopySpread" HorizontalAlignment="Left" />
|
||||
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<ListBox ItemsSource="{Binding TimeSeriesResults}" />
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header=" Market Info">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
||||
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
||||
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
||||
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionQuoteCommand}" Content="SymbolInfoSessionQuote" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionTradeCommand}" Content="SymbolInfoSessionTrade" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookAddCommand}" Content="MarketBookAdd" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookReleaseCommand}" Content="MarketBookRelease" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookGetCommand}" Content="MarketBookGet" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Expander Grid.Row="2" Header="History" IsExpanded="True">
|
||||
<ListBox Height="200" ItemsSource="{Binding History}"/>
|
||||
</Expander>
|
||||
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{Binding ConnectionState}"
|
||||
ToolTip="{Binding ConnectionMessage}"
|
||||
ContentTemplate="{StaticResource ConnectionTextBlockTemplate}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
ViewModel _vm { get; set; }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_vm = new ViewModel();
|
||||
_MainLayout.DataContext = _vm;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
_vm.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using MtApi5;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class MqlTradeRequestViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public MqlTradeRequestViewModel(MqlTradeRequest reqest)
|
||||
{
|
||||
if (reqest == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
TradeRequest = reqest;
|
||||
}
|
||||
|
||||
private MqlTradeRequest TradeRequest { get; set; }
|
||||
|
||||
public ENUM_TRADE_REQUEST_ACTIONS Action
|
||||
{
|
||||
get { return TradeRequest.Action; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Action = value;
|
||||
OnPropertyChanged("Action");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Magic
|
||||
{
|
||||
get { return TradeRequest.Magic; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Magic = value;
|
||||
OnPropertyChanged("Magic");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Order
|
||||
{
|
||||
get { return TradeRequest.Order; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Order = value;
|
||||
OnPropertyChanged("Order");
|
||||
}
|
||||
}
|
||||
|
||||
public string Symbol
|
||||
{
|
||||
get { return TradeRequest.Symbol; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Symbol = value;
|
||||
OnPropertyChanged("Symbol");
|
||||
}
|
||||
}
|
||||
|
||||
public double Volume
|
||||
{
|
||||
get { return TradeRequest.Volume; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Volume = value;
|
||||
OnPropertyChanged("Volume");
|
||||
}
|
||||
}
|
||||
|
||||
public double Price
|
||||
{
|
||||
get { return TradeRequest.Price; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Price = value;
|
||||
OnPropertyChanged("Price");
|
||||
}
|
||||
}
|
||||
|
||||
public double Stoplimit
|
||||
{
|
||||
get { return TradeRequest.Stoplimit; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Stoplimit = value;
|
||||
OnPropertyChanged("Stoplimit");
|
||||
}
|
||||
}
|
||||
|
||||
public double Sl
|
||||
{
|
||||
get { return TradeRequest.Sl; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Sl = value;
|
||||
OnPropertyChanged("Sl");
|
||||
}
|
||||
}
|
||||
|
||||
public double Tp
|
||||
{
|
||||
get { return TradeRequest.Tp; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Tp = value;
|
||||
OnPropertyChanged("Tp");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Deviation
|
||||
{
|
||||
get { return TradeRequest.Deviation; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Deviation = value;
|
||||
OnPropertyChanged("Deviation");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE Type
|
||||
{
|
||||
get { return TradeRequest.Type; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type = value;
|
||||
OnPropertyChanged("Type");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE_FILLING Type_filling
|
||||
{
|
||||
get { return TradeRequest.Type_filling; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type_filling = value;
|
||||
OnPropertyChanged("Type_filling");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE_TIME Type_time
|
||||
{
|
||||
get { return TradeRequest.Type_time; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type_time = value;
|
||||
OnPropertyChanged("Type_time");
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime Expiration
|
||||
{
|
||||
get { return TradeRequest.Expiration; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Expiration = value;
|
||||
OnPropertyChanged("Expiration");
|
||||
}
|
||||
}
|
||||
|
||||
public string Comment
|
||||
{
|
||||
get { return TradeRequest.Comment; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Comment = value;
|
||||
OnPropertyChanged("Comment");
|
||||
}
|
||||
}
|
||||
|
||||
public MqlTradeRequest GetMqlTradeRequest()
|
||||
{
|
||||
return TradeRequest;
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{38B9C657-BC2F-44F0-8824-54B31F2A64F5}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MtApi5TestClient</RootNamespace>
|
||||
<AssemblyName>MtApi5TestClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Debug\MtApi5TestClient.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Release\MtApi5TestClient.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DelegateCommand.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MqlTradeRequestViewModel.cs" />
|
||||
<Compile Include="QuoteViewModel.cs" />
|
||||
<Compile Include="TimeSeriesValueViewModel.cs" />
|
||||
<Compile Include="ViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MtApi5\MtApi5.csproj">
|
||||
<Project>{AC8B5010-DA75-477E-9CA5-547C649E12D8}</Project>
|
||||
<Name>MtApi5</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,55 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MtApi5TestClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MtApi5TestClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MtApi5TestClient.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MtApi5TestClient.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MtApi5TestClient.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class QuoteViewModel: INotifyPropertyChanged
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public string Instrument { get; private set; }
|
||||
|
||||
private double _Bid;
|
||||
public double Bid
|
||||
{
|
||||
get { return _Bid; }
|
||||
set
|
||||
{
|
||||
_Bid = value;
|
||||
OnPropertyChanged("Bid");
|
||||
}
|
||||
}
|
||||
|
||||
private double _Ask;
|
||||
public double Ask
|
||||
{
|
||||
get { return _Ask; }
|
||||
set
|
||||
{
|
||||
_Ask = value;
|
||||
OnPropertyChanged("Ask");
|
||||
}
|
||||
}
|
||||
|
||||
private int _FeedCount = 0;
|
||||
public int FeedCount
|
||||
{
|
||||
get { return _FeedCount; }
|
||||
set
|
||||
{
|
||||
_FeedCount = value;
|
||||
OnPropertyChanged("FeedCount");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public QuoteViewModel(string instrument)
|
||||
{
|
||||
Instrument = instrument;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MtApi5;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class TimeSeriesValueViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private string _SymbolValue;
|
||||
public string SymbolValue
|
||||
{
|
||||
get { return _SymbolValue; }
|
||||
set
|
||||
{
|
||||
_SymbolValue = value;
|
||||
OnPropertyChanged("SymbolValue");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_TIMEFRAMES TimeFrame { get; set; }
|
||||
public int StartPos { get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,765 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using MtApi5;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
#region Commands
|
||||
public DelegateCommand ConnectCommand { get; private set; }
|
||||
public DelegateCommand DisconnectCommand { get; private set; }
|
||||
|
||||
public DelegateCommand OrderSendCommand { get; private set; }
|
||||
|
||||
public DelegateCommand AccountInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoStringCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyRatesCommand { get; private set; }
|
||||
public DelegateCommand CopyTimesCommand { get; private set; }
|
||||
public DelegateCommand CopyOpenCommand { get; private set; }
|
||||
public DelegateCommand CopyHighCommand { get; private set; }
|
||||
public DelegateCommand CopyLowCommand { get; private set; }
|
||||
public DelegateCommand CopyCloseCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyTickVolumeCommand { get; private set; }
|
||||
public DelegateCommand CopyRealVolumeCommand { get; private set; }
|
||||
public DelegateCommand CopySpreadCommand { get; private set; }
|
||||
|
||||
public DelegateCommand SymbolsTotalCommand { get; private set; }
|
||||
public DelegateCommand SymbolNameCommand { get; private set; }
|
||||
public DelegateCommand SymbolSelectCommand { get; private set; }
|
||||
public DelegateCommand SymbolIsSynchronizedCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoStringCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoTickCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionQuoteCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionTradeCommand { get; private set; }
|
||||
public DelegateCommand MarketBookAddCommand { get; private set; }
|
||||
public DelegateCommand MarketBookReleaseCommand { get; private set; }
|
||||
public DelegateCommand MarketBookGetCommand { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private Mt5ConnectionState _ConnectionState;
|
||||
public Mt5ConnectionState ConnectionState
|
||||
{
|
||||
get { return _ConnectionState; }
|
||||
set
|
||||
{
|
||||
_ConnectionState = value;
|
||||
OnPropertyChanged("ConnectionState");
|
||||
}
|
||||
}
|
||||
|
||||
private string _ConnectionMessage;
|
||||
public string ConnectionMessage
|
||||
{
|
||||
get { return _ConnectionMessage; }
|
||||
set
|
||||
{
|
||||
_ConnectionMessage = value;
|
||||
OnPropertyChanged("ConnectionMessage");
|
||||
}
|
||||
}
|
||||
|
||||
private string _Host;
|
||||
public string Host
|
||||
{
|
||||
get { return _Host; }
|
||||
set
|
||||
{
|
||||
_Host = value;
|
||||
OnPropertyChanged("Host");
|
||||
}
|
||||
}
|
||||
|
||||
private int _Port;
|
||||
public int Port
|
||||
{
|
||||
get { return _Port; }
|
||||
set
|
||||
{
|
||||
_Port = value;
|
||||
OnPropertyChanged("Port");
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<QuoteViewModel> _Quotes = new ObservableCollection<QuoteViewModel>();
|
||||
public ObservableCollection<QuoteViewModel> Quotes
|
||||
{
|
||||
get { return _Quotes; }
|
||||
}
|
||||
|
||||
private QuoteViewModel _SelectedQuote;
|
||||
public QuoteViewModel SelectedQuote
|
||||
{
|
||||
get { return _SelectedQuote; }
|
||||
set
|
||||
{
|
||||
_SelectedQuote = value;
|
||||
OnPropertyChanged("SelectedQuote");
|
||||
OnSelectedQuoteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<string> _History = new ObservableCollection<string>();
|
||||
public ObservableCollection<string> History
|
||||
{
|
||||
get { return _History; }
|
||||
}
|
||||
|
||||
private ObservableCollection<MqlTradeRequestViewModel> _TradeRequests = new ObservableCollection<MqlTradeRequestViewModel>();
|
||||
public ObservableCollection<MqlTradeRequestViewModel> TradeRequests
|
||||
{
|
||||
get { return _TradeRequests; }
|
||||
}
|
||||
|
||||
private MqlTradeRequestViewModel _TradeRequest;
|
||||
public MqlTradeRequestViewModel TradeRequest
|
||||
{
|
||||
get { return _TradeRequest; }
|
||||
set
|
||||
{
|
||||
_TradeRequest = value;
|
||||
OnPropertyChanged("TradeRequest");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ACCOUNT_INFO_DOUBLE AccountInfoDoublePropertyId { get; set; }
|
||||
public ENUM_ACCOUNT_INFO_INTEGER AccountInfoIntegerPropertyId { get; set; }
|
||||
public ENUM_ACCOUNT_INFO_STRING AccountInfoStringPropertyId { get; set; }
|
||||
|
||||
public TimeSeriesValueViewModel TimeSeriesValues { get; set; }
|
||||
|
||||
private ObservableCollection<string> _TimeSeriesResults = new ObservableCollection<string>();
|
||||
public ObservableCollection<string> TimeSeriesResults
|
||||
{
|
||||
get { return _TimeSeriesResults; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public ViewModel()
|
||||
{
|
||||
// Init MtApi client
|
||||
mMtApiClient = new MtApi5Client();
|
||||
|
||||
mMtApiClient.ConnectionStateChanged += new EventHandler<Mt5ConnectionEventArgs>(mMtApiClient_ConnectionStateChanged);
|
||||
mMtApiClient.QuoteAdded += new EventHandler<Mt5QuoteEventArgs>(mMtApiClient_QuoteAdded);
|
||||
mMtApiClient.QuoteRemoved += new EventHandler<Mt5QuoteEventArgs>(mMtApiClient_QuoteRemoved);
|
||||
mMtApiClient.QuoteUpdated += new MtApi5Client.QuoteHandler(mMtApiClient_QuoteUpdated);
|
||||
|
||||
_quotesMap = new Dictionary<string, QuoteViewModel>();
|
||||
|
||||
ConnectionState = mMtApiClient.ConnectionState;
|
||||
ConnectionMessage = "Disconnected";
|
||||
Port = 8228; //default local port
|
||||
|
||||
InitCommands();
|
||||
|
||||
var request = new MqlTradeRequest { Action = ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_DEAL
|
||||
, Type = ENUM_ORDER_TYPE.ORDER_TYPE_BUY
|
||||
, Volume = 0.1
|
||||
, Comment = "Test Trade Request"
|
||||
};
|
||||
|
||||
TradeRequest = new MqlTradeRequestViewModel(request);
|
||||
|
||||
TimeSeriesValues = new TimeSeriesValueViewModel();
|
||||
TimeSeriesValues.Count = 100;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
mMtApiClient.BeginDisconnect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
|
||||
private void InitCommands()
|
||||
{
|
||||
ConnectCommand = new DelegateCommand(ExecuteConnect, CanExecuteConnect);
|
||||
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
|
||||
|
||||
OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
|
||||
|
||||
AccountInfoDoubleCommand = new DelegateCommand(ExecuteAccountInfoDouble);
|
||||
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
|
||||
AccountInfoStringCommand = new DelegateCommand(ExecuteAccountInfoString);
|
||||
|
||||
CopyRatesCommand = new DelegateCommand(ExecuteCopyRates);
|
||||
CopyTimesCommand = new DelegateCommand(ExecuteCopyTime);
|
||||
CopyOpenCommand = new DelegateCommand(ExecuteCopyOpen);
|
||||
CopyHighCommand = new DelegateCommand(ExecuteCopyHigh);
|
||||
CopyLowCommand = new DelegateCommand(ExecuteCopyLow);
|
||||
CopyCloseCommand = new DelegateCommand(ExecuteCopyClose);
|
||||
|
||||
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
|
||||
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
|
||||
CopySpreadCommand = new DelegateCommand(ExecuteCopySpread);
|
||||
|
||||
SymbolsTotalCommand = new DelegateCommand(ExecuteSymbolsTotal);
|
||||
SymbolNameCommand = new DelegateCommand(ExecuteSymbolName);
|
||||
SymbolSelectCommand = new DelegateCommand(ExecuteSymbolSelect);
|
||||
SymbolIsSynchronizedCommand = new DelegateCommand(ExecuteSymbolIsSynchronized);
|
||||
SymbolInfoDoubleCommand = new DelegateCommand(ExecuteSymbolInfoDouble);
|
||||
SymbolInfoIntegerCommand = new DelegateCommand(ExecuteSymbolInfoInteger);
|
||||
SymbolInfoStringCommand = new DelegateCommand(ExecuteSymbolInfoString);
|
||||
SymbolInfoTickCommand = new DelegateCommand(ExecuteSymbolInfoTick);
|
||||
SymbolInfoSessionQuoteCommand = new DelegateCommand(ExecuteSymbolInfoSessionQuote);
|
||||
SymbolInfoSessionTradeCommand = new DelegateCommand(ExecuteSymbolInfoSessionTrade);
|
||||
MarketBookAddCommand = new DelegateCommand(ExecuteMarketBookAdd);
|
||||
MarketBookReleaseCommand = new DelegateCommand(ExecuteMarketBookRelease);
|
||||
MarketBookGetCommand = new DelegateCommand(ExecuteMarketBookGet);
|
||||
}
|
||||
|
||||
private bool CanExecuteConnect(object o)
|
||||
{
|
||||
return ConnectionState == Mt5ConnectionState.Disconnected || ConnectionState == Mt5ConnectionState.Failed;
|
||||
}
|
||||
|
||||
private void ExecuteConnect(object o)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Host))
|
||||
{
|
||||
mMtApiClient.BeginConnect(Port);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMtApiClient.BeginConnect(Host, Port);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanExecuteDisconnect(object o)
|
||||
{
|
||||
return ConnectionState == Mt5ConnectionState.Connected;
|
||||
}
|
||||
|
||||
private void ExecuteDisconnect(object o)
|
||||
{
|
||||
mMtApiClient.BeginDisconnect();
|
||||
}
|
||||
|
||||
private void ExecuteOrderSend(object o)
|
||||
{
|
||||
var request = TradeRequest.GetMqlTradeRequest();
|
||||
|
||||
MqlTradeResult result;
|
||||
bool retVal = mMtApiClient.OrderSend(request, out result);
|
||||
|
||||
string historyItem;
|
||||
|
||||
if (retVal == true)
|
||||
{
|
||||
historyItem = "OrderSend successed. " + MqlTradeResultToString(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
historyItem = "OrderSend failed. " + MqlTradeResultToString(result);
|
||||
}
|
||||
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoDouble(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoDouble(AccountInfoDoublePropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoDouble: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoInteger(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoInteger(AccountInfoIntegerPropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoInteger: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoString(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoString(AccountInfoStringPropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoString: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteCopyTime(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
DateTime[] timesArray;
|
||||
var count = mMtApiClient.CopyTime(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out timesArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var time in timesArray)
|
||||
{
|
||||
TimeSeriesResults.Add(time.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyTime success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyOpen(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] opensArray;
|
||||
var count = mMtApiClient.CopyOpen(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out opensArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var open in opensArray)
|
||||
{
|
||||
TimeSeriesResults.Add(open.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyOpen success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyHigh(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyHigh(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyHigh success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyLow(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyLow(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyLow success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyClose(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyClose(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyClose success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyRates(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
MqlRates[] ratesArray;
|
||||
var count = mMtApiClient.CopyRates(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out ratesArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var rates in ratesArray)
|
||||
{
|
||||
TimeSeriesResults.Add(string.Format("time={0}; open={1}; high={2}; low={3}; close={4}; tick_volume={5}; spread={6}; real_volume={7}",
|
||||
rates.time, rates.open, rates.high, rates.low, rates.close, rates.tick_volume, rates.spread, rates.tick_volume));
|
||||
}
|
||||
|
||||
History.Add("CopyRates success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyTickVolume(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
long[] array;
|
||||
var count = mMtApiClient.CopyTickVolume(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyTickVolume success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyRealVolume(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
long[] array;
|
||||
var count = mMtApiClient.CopyRealVolume(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyRealVolume success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopySpread(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
int[] array;
|
||||
var count = mMtApiClient.CopySpread(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopySpread success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteSymbolsTotal(object o)
|
||||
{
|
||||
var selectedCount = mMtApiClient.SymbolsTotal(true);
|
||||
History.Add("SymbolsTotal(true) success, result = " + selectedCount.ToString());
|
||||
|
||||
var commonCount = mMtApiClient.SymbolsTotal(false);
|
||||
History.Add("SymbolsTotal(false) success, result = " + selectedCount.ToString());
|
||||
}
|
||||
|
||||
private void ExecuteSymbolName(object o)
|
||||
{
|
||||
var selectedSymbol = mMtApiClient.SymbolName(5, true);
|
||||
History.Add("SymbolName(5, true) success, result = " + selectedSymbol);
|
||||
|
||||
var commonSymbol = mMtApiClient.SymbolName(5, false);
|
||||
History.Add("SymbolName(5, false) success, result = " + commonSymbol);
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteSymbolSelect(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolSelect("AUDJPY", true);
|
||||
History.Add("SymbolSelect(AUDJPY, true) success, result = " + retVal);
|
||||
|
||||
//var retVal1 = mMtApiClient.SymbolSelect("AUDJPY", false);
|
||||
//History.Add("SymbolSelect(AUDJPY, false) success, result = " + retVal1);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolIsSynchronized(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolIsSynchronized("EURUSD");
|
||||
History.Add("SymbolIsSynchronized(EURUSD) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoDouble(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID);
|
||||
History.Add("SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoInteger(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoInteger("EURUSD", ENUM_SYMBOL_INFO_INTEGER.SYMBOL_SPREAD);
|
||||
History.Add("SymbolInfoInteger(EURUSD, ENUM_SYMBOL_INFO_INTEGER.SYMBOL_SPREAD) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoString(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoString("EURUSD", ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION);
|
||||
History.Add("SymbolInfoString(EURUSD, ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoTick(object o)
|
||||
{
|
||||
MqlTick tick;
|
||||
var retVal = mMtApiClient.SymbolInfoTick("EURUSD", out tick);
|
||||
History.Add("SymbolInfoTick(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.time = " + tick.time);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.bid = " + tick.bid);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.ask = " + tick.ask);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.last = " + tick.last);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.volume = " + tick.volume);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoSessionQuote(object o)
|
||||
{
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
var retVal = mMtApiClient.SymbolInfoSessionQuote("EURUSD", ENUM_DAY_OF_WEEK.MONDAY, 0, out from, out to);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) from = " + from);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) to = " + to);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoSessionTrade(object o)
|
||||
{
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
var retVal = mMtApiClient.SymbolInfoSessionTrade("EURUSD", ENUM_DAY_OF_WEEK.MONDAY, 0, out from, out to);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) from = " + from);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) to = " + to);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookAdd(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.MarketBookAdd("CHFJPY");
|
||||
History.Add("MarketBookAdd(CHFJPY) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookRelease(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.MarketBookRelease("CHFJPY");
|
||||
History.Add("MarketBookRelease(CHFJPY) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookGet(object o)
|
||||
{
|
||||
MqlBookInfo[] book;
|
||||
var retVal = mMtApiClient.MarketBookGet("EURUSD", out book);
|
||||
History.Add("MarketBookGet(EURUSD) success, result = " + retVal);
|
||||
if (retVal == true && book != null)
|
||||
{
|
||||
for (int i = 0; i < book.Length; i++)
|
||||
{
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].price));
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].volume));
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUIThread(Action action)
|
||||
{
|
||||
if (Application.Current != null)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(action);
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUIThread<T>(Action<T> action, params Object[] args)
|
||||
{
|
||||
if (Application.Current != null)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(action, args);
|
||||
}
|
||||
}
|
||||
|
||||
private object mLocker = new object();
|
||||
|
||||
private void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||
{
|
||||
if (string.IsNullOrEmpty(symbol) == false)
|
||||
{
|
||||
if (_quotesMap.ContainsKey(symbol) == true)
|
||||
{
|
||||
var qvm = _quotesMap[symbol];
|
||||
qvm.Bid = bid;
|
||||
qvm.Ask = ask;
|
||||
}
|
||||
|
||||
if (string.Equals(symbol, TradeRequest.Symbol))
|
||||
{
|
||||
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
||||
{
|
||||
TradeRequest.Price = ask;
|
||||
}
|
||||
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
||||
{
|
||||
TradeRequest.Price = bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mMtApiClient_QuoteRemoved(object sender, Mt5QuoteEventArgs e)
|
||||
{
|
||||
runOnUIThread<Mt5Quote>(RemoveQuote, e.Quote);
|
||||
}
|
||||
|
||||
private void mMtApiClient_QuoteAdded(object sender, Mt5QuoteEventArgs e)
|
||||
{
|
||||
runOnUIThread<Mt5Quote>(AddQuote, e.Quote);
|
||||
}
|
||||
|
||||
private void mMtApiClient_ConnectionStateChanged(object sender, Mt5ConnectionEventArgs e)
|
||||
{
|
||||
ConnectionState = e.Status;
|
||||
ConnectionMessage = e.ConnectionMessage;
|
||||
|
||||
runOnUIThread(ConnectCommand.RaiseCanExecuteChanged);
|
||||
runOnUIThread(DisconnectCommand.RaiseCanExecuteChanged);
|
||||
|
||||
switch (e.Status)
|
||||
{
|
||||
case Mt5ConnectionState.Connected:
|
||||
runOnUIThread(OnConnected);
|
||||
break;
|
||||
case Mt5ConnectionState.Disconnected:
|
||||
runOnUIThread(OnDisconnected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null)
|
||||
return;
|
||||
|
||||
QuoteViewModel qvm = null;
|
||||
|
||||
if (_quotesMap.ContainsKey(quote.Instrument) == false)
|
||||
{
|
||||
qvm = new QuoteViewModel(quote.Instrument);
|
||||
_quotesMap[quote.Instrument] = qvm;
|
||||
Quotes.Add(qvm);
|
||||
}
|
||||
else
|
||||
{
|
||||
qvm = _quotesMap[quote.Instrument];
|
||||
}
|
||||
|
||||
qvm.FeedCount++;
|
||||
qvm.Bid = quote.Bid;
|
||||
qvm.Ask = quote.Ask;
|
||||
}
|
||||
|
||||
private void RemoveQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null)
|
||||
return;
|
||||
|
||||
if (_quotesMap.ContainsKey(quote.Instrument) == true)
|
||||
{
|
||||
var qvm = _quotesMap[quote.Instrument];
|
||||
qvm.FeedCount--;
|
||||
|
||||
if (qvm.FeedCount <= 0)
|
||||
{
|
||||
_quotesMap.Remove(quote.Instrument);
|
||||
Quotes.Remove(qvm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnConnected()
|
||||
{
|
||||
var quotes = mMtApiClient.GetQuotes();
|
||||
if (quotes != null)
|
||||
{
|
||||
foreach (var quote in quotes)
|
||||
{
|
||||
AddQuote(quote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisconnected()
|
||||
{
|
||||
_quotesMap.Clear();
|
||||
Quotes.Clear();
|
||||
}
|
||||
|
||||
private static string MqlTradeResultToString(MqlTradeResult result)
|
||||
{
|
||||
return result != null ?
|
||||
"Retcode = " + result.Retcode + ";"
|
||||
+ " Comment = " + result.Comment + ";"
|
||||
+ " Order = " + result.Order + ";"
|
||||
+ " Volume = " + result.Volume + ";"
|
||||
+ " Price = " + result.Price + ";"
|
||||
+ " Deal = " + result.Deal + ";"
|
||||
+ " Request_id = " + result.Request_id + ";"
|
||||
+ " Bid = " + result.Bid + ";"
|
||||
+ " Ask = " + result.Ask + ";" : string.Empty;
|
||||
}
|
||||
|
||||
private void OnSelectedQuoteChanged()
|
||||
{
|
||||
if (SelectedQuote != null)
|
||||
{
|
||||
TradeRequest.Symbol = SelectedQuote.Instrument;
|
||||
TimeSeriesValues.SymbolValue = SelectedQuote.Instrument;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private readonly MtApi5Client mMtApiClient;
|
||||
|
||||
private Dictionary<string, QuoteViewModel> _quotesMap;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Generated
-1386
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>133, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TestApiClientUI
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestApiClientUI")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DW")]
|
||||
[assembly: AssemblyProduct("TestApiClientUI")]
|
||||
[assembly: AssemblyCopyright("Copyright © DW 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("b8a613a1-ac11-4582-a67d-33bfd80fc490")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TestApiClientUI.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestApiClientUI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TestApiClientUI.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,169 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{663CC515-EAAE-47D4-8933-5008C2DA1160}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestApiClientUI</RootNamespace>
|
||||
<AssemblyName>TestApiClientUI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Debug\TestApiClientUI.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Release\TestApiClientUI.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MtApi\MtApi.csproj">
|
||||
<Project>{7a76c388-a8fb-4949-8170-24d4742e934e}</Project>
|
||||
<Name>MtApi</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestMtApi", "TestMtApi\TestMtApi.vbproj", "{EB7C228D-9494-4985-845E-B8312450DF3D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Debug|x86.Build.0 = Debug|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|x86.ActiveCfg = Release|x86
|
||||
{EB7C228D-9494-4985-845E-B8312450DF3D}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
|
||||
</startup>
|
||||
</configuration>
|
||||
Generated
-97
@@ -1,97 +0,0 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class Form1
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
||||
Me.btnConnect = New System.Windows.Forms.Button()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.ListBoxQuotesUpdate = New System.Windows.Forms.ListBox()
|
||||
Me.btnDisconnect = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'TextBox1
|
||||
'
|
||||
Me.TextBox1.Location = New System.Drawing.Point(47, 12)
|
||||
Me.TextBox1.Name = "TextBox1"
|
||||
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
|
||||
Me.TextBox1.TabIndex = 0
|
||||
Me.TextBox1.Text = "8222"
|
||||
'
|
||||
'btnConnect
|
||||
'
|
||||
Me.btnConnect.Location = New System.Drawing.Point(153, 10)
|
||||
Me.btnConnect.Name = "btnConnect"
|
||||
Me.btnConnect.Size = New System.Drawing.Size(75, 23)
|
||||
Me.btnConnect.TabIndex = 1
|
||||
Me.btnConnect.Text = "Connect"
|
||||
Me.btnConnect.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Label1
|
||||
'
|
||||
Me.Label1.AutoSize = True
|
||||
Me.Label1.Location = New System.Drawing.Point(12, 15)
|
||||
Me.Label1.Name = "Label1"
|
||||
Me.Label1.Size = New System.Drawing.Size(29, 13)
|
||||
Me.Label1.TabIndex = 2
|
||||
Me.Label1.Text = "Port:"
|
||||
'
|
||||
'ListBoxQuotesUpdate
|
||||
'
|
||||
Me.ListBoxQuotesUpdate.FormattingEnabled = True
|
||||
Me.ListBoxQuotesUpdate.Location = New System.Drawing.Point(12, 51)
|
||||
Me.ListBoxQuotesUpdate.Name = "ListBoxQuotesUpdate"
|
||||
Me.ListBoxQuotesUpdate.Size = New System.Drawing.Size(297, 199)
|
||||
Me.ListBoxQuotesUpdate.TabIndex = 3
|
||||
'
|
||||
'btnDisconnect
|
||||
'
|
||||
Me.btnDisconnect.Location = New System.Drawing.Point(234, 10)
|
||||
Me.btnDisconnect.Name = "btnDisconnect"
|
||||
Me.btnDisconnect.Size = New System.Drawing.Size(75, 23)
|
||||
Me.btnDisconnect.TabIndex = 4
|
||||
Me.btnDisconnect.Text = "Disconnect"
|
||||
Me.btnDisconnect.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(318, 262)
|
||||
Me.Controls.Add(Me.btnDisconnect)
|
||||
Me.Controls.Add(Me.ListBoxQuotesUpdate)
|
||||
Me.Controls.Add(Me.Label1)
|
||||
Me.Controls.Add(Me.btnConnect)
|
||||
Me.Controls.Add(Me.TextBox1)
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Form1"
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
|
||||
Friend WithEvents btnConnect As System.Windows.Forms.Button
|
||||
Friend WithEvents Label1 As System.Windows.Forms.Label
|
||||
Friend WithEvents ListBoxQuotesUpdate As System.Windows.Forms.ListBox
|
||||
Friend WithEvents btnDisconnect As System.Windows.Forms.Button
|
||||
|
||||
End Class
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,38 +0,0 @@
|
||||
Imports MtApi
|
||||
|
||||
Public Class Form1
|
||||
|
||||
Private apiClient As MtApiClient
|
||||
|
||||
Public Sub New()
|
||||
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
|
||||
apiClient = New MtApiClient
|
||||
AddHandler apiClient.QuoteUpdated, AddressOf QuoteUpdatedHandler
|
||||
|
||||
End Sub
|
||||
|
||||
Sub QuoteUpdatedHandler(sender As Object, symbol As String, bid As Double, ask As Double)
|
||||
Dim quoteSrt As String
|
||||
quoteSrt = symbol + ": Bid = " + bid.ToString() + "; Ask = " + ask.ToString()
|
||||
|
||||
ListBoxQuotesUpdate.Invoke(Sub()
|
||||
ListBoxQuotesUpdate.Items.Add(quoteSrt)
|
||||
End Sub)
|
||||
|
||||
Console.WriteLine(quoteSrt)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnConnect_Click(sender As System.Object, e As System.EventArgs) Handles btnConnect.Click
|
||||
apiClient.BeginConnect(8222)
|
||||
End Sub
|
||||
|
||||
Private Sub btnDisconnect_Click(sender As System.Object, e As System.EventArgs) Handles btnDisconnect.Click
|
||||
apiClient.BeginDisconnect()
|
||||
End Sub
|
||||
End Class
|
||||
@@ -1,38 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.17929
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.TestMtApi.Form1
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Form1</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>0</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
@@ -1,35 +0,0 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("TestMtApi")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("TestMtApi")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2013")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("d49ddaa5-5fca-4f84-8750-7d36804fd070")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
@@ -1,62 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.17929
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestMtApi.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.17929
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.TestMtApi.My.MySettings
|
||||
Get
|
||||
Return Global.TestMtApi.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
|
||||
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
|
||||
</asmv1:assembly>
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{EB7C228D-9494-4985-845E-B8312450DF3D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>TestMtApi.My.MyApplication</StartupObject>
|
||||
<RootNamespace>TestMtApi</RootNamespace>
|
||||
<AssemblyName>TestMtApi</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>TestMtApi.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>TestMtApi.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MtApi, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.vb">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\app.manifest" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
enum CodeErrorTypes
|
||||
{
|
||||
ERR_NO_ERROR = 0,
|
||||
ERR_NO_RESULT = 1,
|
||||
ERR_COMMON_ERROR = 2,
|
||||
ERR_INVALID_TRADE_PARAMETERS = 3,
|
||||
ERR_SERVER_BUSY = 4,
|
||||
ERR_OLD_VERSION = 5,
|
||||
ERR_NO_CONNECTION = 6,
|
||||
ERR_NOT_ENOUGH_RIGHTS = 7,
|
||||
ERR_TOO_FREQUENT_REQUESTS = 8,
|
||||
ERR_MALFUNCTIONAL_TRADE = 9,
|
||||
ERR_ACCOUNT_DISABLED = 64,
|
||||
ERR_INVALID_ACCOUNT = 65,
|
||||
ERR_TRADE_TIMEOUT = 128,
|
||||
ERR_INVALID_PRICE = 129,
|
||||
ERR_INVALID_STOPS = 130,
|
||||
ERR_INVALID_TRADE_VOLUME = 131,
|
||||
ERR_MARKET_CLOSED = 132,
|
||||
ERR_TRADE_DISABLED = 133,
|
||||
ERR_NOT_ENOUGH_MONEY = 134,
|
||||
ERR_PRICE_CHANGED = 135,
|
||||
ERR_OFF_QUOTES = 136,
|
||||
ERR_BROKER_BUSY = 137,
|
||||
ERR_REQUOTE = 138,
|
||||
ERR_ORDER_LOCKED = 139,
|
||||
ERR_LONG_POSITIONS_ONLY_ALLOWED = 140,
|
||||
ERR_TOO_MANY_REQUESTS = 141,
|
||||
ERR_TRADE_MODIFY_DENIED = 145,
|
||||
ERR_TRADE_CONTEXT_BUSY = 146,
|
||||
ERR_TRADE_EXPIRATION_DENIED = 147,
|
||||
ERR_TRADE_TOO_MANY_ORDERS = 148,
|
||||
ERR_TRADE_HEDGE_PROHIBITED = 149,
|
||||
ERR_TRADE_PROHIBITED_BY_FIFO = 150
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
interface IMetaTrader
|
||||
{
|
||||
void Print(string msg);
|
||||
void MessageBoxA(string msg);
|
||||
|
||||
string AccountName();
|
||||
int AccountNumber();
|
||||
bool IsDemo();
|
||||
bool IsConnected();
|
||||
string ErrorDescription(int errorCode);
|
||||
int OrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment, int magic, int expiration, int arrow_color);
|
||||
bool OrderClose(int ticket, double lots, double price, int slippage, int color);
|
||||
}
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
delegate void MetaTraderInfoHandler(string msg);
|
||||
|
||||
class MetaTrader: IMetaTrader, IDisposable
|
||||
{
|
||||
public MetaTrader(string accountName, int accountNumber)
|
||||
{
|
||||
mAccountName = accountName != null ? accountName : string.Empty;
|
||||
mAccountNumber = accountNumber;
|
||||
}
|
||||
|
||||
#region IMetaTrader
|
||||
public void Print(string msg)
|
||||
{
|
||||
updateMetaTraderInfo(msg);
|
||||
}
|
||||
|
||||
public void MessageBoxA(string msg)
|
||||
{
|
||||
updateMetaTraderInfo("[MessageBox] " + msg);
|
||||
}
|
||||
|
||||
public string AccountName()
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - AccountName");
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
return mAccountName;
|
||||
}
|
||||
|
||||
public int AccountNumber()
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - AccountNumber");
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
return mAccountNumber;
|
||||
}
|
||||
|
||||
public bool IsDemo()
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - IsDemo");
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
return mIsDemo;
|
||||
}
|
||||
|
||||
public bool IsConnected()
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - IsConnected");
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int OrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment, int magic, int expiration, int arrow_color)
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - OrderSend: cmd = {0}, symbol = {1}, volume = {2}, price = {3}, slippage = {4}, stoploss = {5}, takeprofit = {6}, comment = {7}, magic = {8}, expiration = {9}, arrow_color = {10}"
|
||||
, cmd, symbol, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrow_color);
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
Thread.Sleep(5000);
|
||||
|
||||
return ++mOrderCount;
|
||||
}
|
||||
|
||||
public bool OrderClose(int ticket, double lots, double price, int slippage, int color)
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - OrderClose, ticket = {0}, lots = {1}, price = {2}, slippage = {3}", ticket, lots, price, slippage);
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public string ErrorDescription(int errorCode)
|
||||
{
|
||||
var msg = string.Format("MetaTrader: Commmand - ErrorDescription: errorCode = {0}", errorCode);
|
||||
updateMetaTraderInfo(msg);
|
||||
|
||||
CodeErrorTypes errorType = (CodeErrorTypes)errorCode;
|
||||
|
||||
return errorType.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public void Start()
|
||||
{
|
||||
foreach(var instrument in mInstruments)
|
||||
{
|
||||
instrument.Start();
|
||||
}
|
||||
|
||||
mIsStarted = true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
mIsStarted = false;
|
||||
|
||||
foreach (var chart in mInstrumentCharts)
|
||||
{
|
||||
chart.Stop();
|
||||
}
|
||||
|
||||
foreach(var instrument in mInstruments)
|
||||
{
|
||||
instrument.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddInstrument(MtInstrument instrument)
|
||||
{
|
||||
if (instrument != null && mInstruments.Contains(instrument) == false)
|
||||
{
|
||||
mInstruments.Add(instrument);
|
||||
instrument.InstrumentUpdate += instrument_InstrumentUpdate;
|
||||
|
||||
if (mIsStarted == true)
|
||||
instrument.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveInstrument(MtInstrument instrument)
|
||||
{
|
||||
if (instrument != null && mInstruments.Contains(instrument) == true)
|
||||
{
|
||||
mInstruments.Remove(instrument);
|
||||
instrument.InstrumentUpdate -= instrument_InstrumentUpdate;
|
||||
|
||||
instrument.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddInstrumentChart(MtInstrumentChart instrumentChart)
|
||||
{
|
||||
if (instrumentChart != null && mInstrumentCharts.Contains(instrumentChart) == false)
|
||||
{
|
||||
mInstrumentCharts.Add(instrumentChart);
|
||||
|
||||
instrumentChart.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveInstrumentChart(MtInstrumentChart instrumentChart)
|
||||
{
|
||||
if (instrumentChart != null && mInstrumentCharts.Contains(instrumentChart) == true)
|
||||
{
|
||||
mInstrumentCharts.Remove(instrumentChart);
|
||||
|
||||
instrumentChart.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDemo(bool isDemo)
|
||||
{
|
||||
mIsDemo = isDemo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public List<MtInstrument> Instruments
|
||||
{
|
||||
get { return mInstruments; }
|
||||
}
|
||||
|
||||
|
||||
public List<MtInstrumentChart> InstrumentCharts
|
||||
{
|
||||
get { return mInstrumentCharts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
void instrument_InstrumentUpdate(string symbol, double bid, double ask)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void updateMetaTraderInfo(string msg)
|
||||
{
|
||||
if (InfoUpdated != null)
|
||||
InfoUpdated(msg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event MetaTraderInfoHandler InfoUpdated;
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly string mAccountName;
|
||||
private readonly int mAccountNumber;
|
||||
|
||||
private int mOrderCount = 0;
|
||||
|
||||
private readonly List<MtInstrument> mInstruments = new List<MtInstrument>();
|
||||
private readonly List<MtInstrumentChart> mInstrumentCharts = new List<MtInstrumentChart>();
|
||||
|
||||
private bool mIsStarted = false;
|
||||
|
||||
private static List<string> OpTypes = new List<string> { "OP_BUY", "OP_SELL", "OP_BUYLIMIT", "OP_SELLLIMIT", "OP_BUYSTOP", "OP_SELLSTOP" };
|
||||
|
||||
private bool mIsDemo = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
enum MtExpertType
|
||||
{
|
||||
MtApiSymbol,
|
||||
MtApiControl,
|
||||
MtQuoteExpert
|
||||
}
|
||||
|
||||
abstract class MtExpert
|
||||
{
|
||||
public MtExpert(MtExpertType expertType, IMetaTrader metatrader)
|
||||
{
|
||||
ExpertType = expertType;
|
||||
mMetaTrader = metatrader;
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Init()
|
||||
{
|
||||
Action a = () =>
|
||||
{
|
||||
mIsStartFuncBlocked = true;
|
||||
|
||||
init();
|
||||
|
||||
mIsStartFuncBlocked = false;
|
||||
};
|
||||
a.BeginInvoke(null, null);
|
||||
}
|
||||
|
||||
public void Deinit()
|
||||
{
|
||||
Action a = () =>
|
||||
{
|
||||
deinit();
|
||||
};
|
||||
a.BeginInvoke(null, null);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Action a = () =>
|
||||
{
|
||||
if (mIsStartFuncBlocked == true)
|
||||
return;
|
||||
|
||||
mIsStartFuncBlocked = true;
|
||||
|
||||
start();
|
||||
|
||||
mIsStartFuncBlocked = false;
|
||||
|
||||
};
|
||||
a.BeginInvoke(null, null);
|
||||
}
|
||||
|
||||
public void SetStopped()
|
||||
{
|
||||
mIsStopped = true;
|
||||
}
|
||||
|
||||
public bool IsStopped()
|
||||
{
|
||||
return mIsStopped;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Expert Methods
|
||||
protected abstract void init();
|
||||
protected abstract void deinit();
|
||||
protected abstract void start();
|
||||
#endregion
|
||||
|
||||
#region MetaTrader Functions
|
||||
protected void Print(string msg)
|
||||
{
|
||||
if (mMetaTrader != null)
|
||||
mMetaTrader.Print(msg);
|
||||
}
|
||||
|
||||
protected void MessageBoxA(string msg)
|
||||
{
|
||||
if (mMetaTrader != null)
|
||||
mMetaTrader.MessageBoxA(msg);
|
||||
}
|
||||
|
||||
protected string AccountName()
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.AccountName() : string.Empty;
|
||||
}
|
||||
|
||||
protected int AccountNumber()
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.AccountNumber() : -1;
|
||||
}
|
||||
|
||||
protected bool IsDemo()
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.IsDemo() : false;
|
||||
}
|
||||
|
||||
public bool IsConnected()
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.IsConnected() : false;
|
||||
}
|
||||
|
||||
protected int OrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment, int magic, int expiration, int arrow_color)
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrow_color) : -1;
|
||||
}
|
||||
|
||||
protected bool OrderClose(int ticket, double lots, double price, int slippage, int color)
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.OrderClose(ticket, lots, price, slippage, color) : false;
|
||||
}
|
||||
|
||||
protected string ErrorDescription(int errorCode)
|
||||
{
|
||||
return (mMetaTrader != null) ? mMetaTrader.ErrorDescription(errorCode) : string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public MtExpertType ExpertType { get; private set; }
|
||||
|
||||
public string Symbol { get; set; }
|
||||
public double Bid { get; set; }
|
||||
public double Ask { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private readonly IMetaTrader mMetaTrader;
|
||||
private volatile bool mIsStopped = false;
|
||||
private volatile bool mIsStartFuncBlocked = false;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
public delegate void InstrumentEventHandler(string symbol, double bid, double ask);
|
||||
|
||||
public class MtInstrument
|
||||
{
|
||||
public MtInstrument(string symbol, double startBid, double startAsk)
|
||||
{
|
||||
_symbol = symbol;
|
||||
_bid = startBid;
|
||||
_ask = startAsk;
|
||||
}
|
||||
|
||||
private void work()
|
||||
{
|
||||
Debug.WriteLine(string.Format("[INFO] MetaTrader Instrument {0} is runned.", _symbol));
|
||||
|
||||
while (_isRunning)
|
||||
{
|
||||
if (_trendCycle <= 0)
|
||||
{
|
||||
Random randomCicle = new Random();
|
||||
_trendCycle = randomCicle.Next(1, 10);
|
||||
|
||||
Random randomValue = new Random();
|
||||
int tmpValue = randomValue.Next(1, 100);
|
||||
_trend = (tmpValue > 50) ? 1 : -1;
|
||||
}
|
||||
|
||||
Random randomCount = new Random();
|
||||
int pipsCount = randomCount.Next(1, 4);
|
||||
double change = (_trend * pipsCount * _pip);
|
||||
|
||||
lock (_lockPrice)
|
||||
{
|
||||
_bid += change;
|
||||
_ask += change;
|
||||
}
|
||||
|
||||
if (InstrumentUpdate != null)
|
||||
InstrumentUpdate(_symbol, _bid, _ask);
|
||||
|
||||
_trendCycle--;
|
||||
|
||||
Random randomSleepValue = new Random();
|
||||
int sleepValue = randomSleepValue.Next(200, 500);
|
||||
Thread.Sleep(sleepValue);
|
||||
}
|
||||
|
||||
Debug.WriteLine(string.Format("[INFO] MetaTrader Instrument {0} is stopepd.", _symbol));
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_isRunning = true;
|
||||
|
||||
Thread thread = new Thread(work);
|
||||
thread.Name = "Instrument_" + Symbol;
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_isRunning = false;
|
||||
}
|
||||
|
||||
public double Bid
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_lockPrice)
|
||||
{
|
||||
return _bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double Ask
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_lockPrice)
|
||||
{
|
||||
return _ask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Symbol
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_lockPrice)
|
||||
{
|
||||
return _symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event InstrumentEventHandler InstrumentUpdate;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
private volatile bool _isRunning = false;
|
||||
private int _trend = 1;
|
||||
private int _trendCycle = 0;
|
||||
|
||||
private const double _pip = 0.0001;
|
||||
|
||||
private object _lockPrice = new object();
|
||||
private double _bid;
|
||||
private double _ask;
|
||||
private string _symbol = string.Empty;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
class MtInstrumentChart
|
||||
{
|
||||
public MtInstrumentChart(MtInstrument instrument)
|
||||
{
|
||||
Instrument = instrument;
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
public void Start()
|
||||
{
|
||||
lock (mExpertLocker)
|
||||
{
|
||||
if (Expert != null)
|
||||
{
|
||||
if (Instrument != null)
|
||||
Expert.Symbol = Instrument.Symbol;
|
||||
|
||||
Expert.Init();
|
||||
}
|
||||
}
|
||||
|
||||
if (Instrument != null)
|
||||
{
|
||||
Instrument.InstrumentUpdate += Instrument_InstrumentUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (Instrument != null)
|
||||
{
|
||||
Instrument.InstrumentUpdate -= Instrument_InstrumentUpdate;
|
||||
}
|
||||
|
||||
lock (mExpertLocker)
|
||||
{
|
||||
if (Expert != null)
|
||||
{
|
||||
Expert.SetStopped();
|
||||
Expert.Deinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddExpert(MtExpert expert)
|
||||
{
|
||||
lock (mExpertLocker)
|
||||
{
|
||||
Expert = expert;
|
||||
|
||||
if (Expert != null)
|
||||
{
|
||||
if (Instrument != null)
|
||||
Expert.Symbol = Instrument.Symbol;
|
||||
|
||||
Expert.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void Instrument_InstrumentUpdate(string symbol, double bid, double ask)
|
||||
{
|
||||
lock (mExpertLocker)
|
||||
{
|
||||
if (Expert != null)
|
||||
{
|
||||
Expert.Symbol = symbol;
|
||||
Expert.Bid = bid;
|
||||
Expert.Ask = ask;
|
||||
|
||||
Expert.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public MtInstrument Instrument { get; private set; }
|
||||
public MtExpert Expert { get; private set; }
|
||||
|
||||
private readonly object mExpertLocker = new object();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,433 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
class MtQuoteExpert : MtExpert
|
||||
{
|
||||
#region Dll Import functions
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int initExpert(int isLocal, int port, [MarshalAs(UnmanagedType.LPStr)] string symbol, int expertHandle, IntPtr err);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int deinitExpert(int port, int expertHandle, IntPtr err);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int updateQuote(int port, [MarshalAs(UnmanagedType.LPStr)] string symbol, double bid, double ask, IntPtr err);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int getCommand(int port, ref int res, IntPtr err);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int getCommandType(int port, int commandId, ref int res);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendIntResponse(int port, int commandId, int response);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendBooleanResponse(int port, int commandId, int response);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendDoubleResponse(int port, int commandId, double response);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendVoidResponse(int port, int commandId);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendDoubleArrayResponse(int port, int commandId, int size);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int sendStringResponse(int port, int commandId, [MarshalAs(UnmanagedType.LPStr)]StringBuilder response);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int getIntValue(int port, int commandId, int paramIndex, ref int res);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int getDoubleValue(int port, int commandId, int paramIndex, ref double res);
|
||||
|
||||
//[DllImport(@"d:\dw\project\forex\MetaTraderApi\Debug\MTConnector.dll")]
|
||||
[DllImport("MT5Connector.dll")]
|
||||
public static extern int getStringValue(int port, int commandId, int paramIndex, IntPtr res);
|
||||
|
||||
#endregion
|
||||
|
||||
public MtQuoteExpert(IMetaTrader metatrader, int port, bool isController) :
|
||||
base(MtExpertType.MtQuoteExpert, metatrader)
|
||||
{
|
||||
Port = port;
|
||||
IsController = isController;
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("ExpertType = {0}; Port = {1}; IsController = {2}", ExpertType, Port, IsController);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Protected Methods
|
||||
protected override void init()
|
||||
{
|
||||
//int isDemo = IsDemo() == true ? 1 : 0;
|
||||
int isDemo = 1;
|
||||
mId = IDcount++;
|
||||
|
||||
int isLocal = 1;
|
||||
|
||||
if (initExpert(isLocal, Port, Symbol, mId, message) == 0)
|
||||
{
|
||||
MessageBoxA("Init error: " + "MetaTraderApi");
|
||||
isCrashed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
runController();
|
||||
|
||||
//if (IsController == true)
|
||||
//{
|
||||
// runController();
|
||||
|
||||
// if (deinitExpert(Port, mId, message) == 0)
|
||||
// {
|
||||
// MessageBoxA("Deinitilization error:\n" + "MetaTraderApi");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
protected override void deinit()
|
||||
{
|
||||
if (isCrashed == false)
|
||||
{
|
||||
if (deinitExpert(Port, mId, message) == 0)
|
||||
{
|
||||
MessageBoxA("Deinit error: " + "MetaTraderApi");
|
||||
isCrashed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
if (isCrashed == false)
|
||||
{
|
||||
if (updateQuote(Port, Symbol, Bid, Ask, message) == 0)
|
||||
{
|
||||
MessageBoxA("Start error: " + "MetaTraderApi");
|
||||
isCrashed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void runController()
|
||||
{
|
||||
string symbolValue = string.Empty;
|
||||
string commentValue = string.Empty;
|
||||
string msgValue = string.Empty;
|
||||
string captionValue = string.Empty;
|
||||
string filenameValue = string.Empty;
|
||||
string ftp_pathValue = string.Empty;
|
||||
string subjectValue = string.Empty;
|
||||
string some_textValue = string.Empty;
|
||||
int cmdValue = -1;
|
||||
int slippageValue = -1;
|
||||
int ticketValue = -1;
|
||||
int oppositeValue = -1;
|
||||
int magicValue = -1;
|
||||
int expirationValue = -1;
|
||||
int arrow_colorValue = -1;
|
||||
int colorValue = -1;
|
||||
int indexValue = -1;
|
||||
int selectValue = -1;
|
||||
int poolValue = -1;
|
||||
int errorCodeValue = -1;
|
||||
int typeValue = -1;
|
||||
int flagValue = -1;
|
||||
int millisecondsValue = -1;
|
||||
int dateValue = -1;
|
||||
int timeValue = -1;
|
||||
double lotsValue = double.NaN;
|
||||
double volumeValue = double.NaN;
|
||||
double priceValue = double.NaN;
|
||||
double stoplossValue = double.NaN;
|
||||
double takeprofitValue = double.NaN;
|
||||
|
||||
int a1 = IsDemo() == true ? 1 : 0;
|
||||
|
||||
Print("MetaTraderApi Expert is runned as controller. Symbol: " + Symbol);
|
||||
|
||||
while (!IsStopped())
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
int commandId = -1;
|
||||
|
||||
if (getCommand(Port, ref commandId, message) == 0)
|
||||
{
|
||||
Print("[ERROR] getCommand");
|
||||
isCrashed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//try
|
||||
//{
|
||||
// waitRequest(Port, ref commandId, message);
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// Print("[ERROR] waitRequest");
|
||||
// isCrashed = true;
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (waitRequest(Port, ref commandId, message) == 0)
|
||||
//{
|
||||
// Print("[ERROR] waitRequest");
|
||||
// isCrashed = true;
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (commandId < 0)
|
||||
continue;
|
||||
|
||||
Print("MetaTraderApi Expert recieved command. Symbol: " + Symbol);
|
||||
|
||||
int commandType = 0;
|
||||
|
||||
if (getCommandType(Port, commandId, ref commandType) == 0)
|
||||
{
|
||||
Print("[ERROR] getCommandType");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (commandType)
|
||||
{
|
||||
case 0: //NoCommmand
|
||||
break;
|
||||
case 1: //OrderSend
|
||||
{
|
||||
//if (getStringValue(Port, mId, 0, ref symbolValue) == 0)
|
||||
//{
|
||||
// PrintParamError("symbolValue");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (getIntValue(Port, commandId, 1, ref cmdValue) == 0)
|
||||
{
|
||||
PrintParamError("cmd");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 2, ref volumeValue) == 0)
|
||||
{
|
||||
PrintParamError("volume");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 3, ref priceValue) == 0)
|
||||
{
|
||||
PrintParamError("price");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getIntValue(Port, commandId, 4, ref slippageValue) == 0)
|
||||
{
|
||||
PrintParamError("slippage");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 5, ref stoplossValue) == 0)
|
||||
{
|
||||
PrintParamError("stoploss");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 6, ref takeprofitValue) == 0)
|
||||
{
|
||||
PrintParamError("takeprofit");
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (getStringValue(Port, mId, 7, ref commentValue) == 0)
|
||||
//{
|
||||
// PrintParamError("commentValue");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (getIntValue(Port, commandId, 8, ref magicValue) == 0)
|
||||
{
|
||||
PrintParamError("magic");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getIntValue(Port, commandId, 9, ref expirationValue) == 0)
|
||||
{
|
||||
PrintParamError("expiration");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getIntValue(Port, commandId, 10, ref arrow_colorValue) == 0)
|
||||
{
|
||||
PrintParamError("arrow_color");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (sendIntResponse(Port, commandId, OrderSend(symbolValue, cmdValue, volumeValue, priceValue, slippageValue, stoplossValue, takeprofitValue, commentValue, magicValue, expirationValue, arrow_colorValue)) == 0)
|
||||
{
|
||||
PrintResponseError("OrderSend");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//OrderClose
|
||||
case 2:
|
||||
{
|
||||
if (getIntValue(Port, commandId, 0, ref ticketValue) == 0)
|
||||
{
|
||||
PrintParamError("ticket");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 1, ref lotsValue) == 0)
|
||||
{
|
||||
PrintParamError("lots");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getDoubleValue(Port, commandId, 2, ref priceValue) == 0)
|
||||
{
|
||||
PrintParamError("price");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getIntValue(Port, commandId, 3, ref slippageValue) == 0)
|
||||
{
|
||||
PrintParamError("slippage");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getIntValue(Port, commandId, 4, ref colorValue) == 0)
|
||||
{
|
||||
PrintParamError("color");
|
||||
continue;
|
||||
}
|
||||
|
||||
//RefreshRates();
|
||||
|
||||
var result = OrderClose(ticketValue, lotsValue, priceValue, slippageValue, colorValue);
|
||||
int responseValue = result == true ? 1 : 0;
|
||||
|
||||
if (sendBooleanResponse(Port, commandId, responseValue) == 0)
|
||||
{
|
||||
PrintResponseError("OrderClose");
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//IsConnected
|
||||
case 27:
|
||||
{
|
||||
var result = IsConnected();
|
||||
int responseValue = result == true ? 1 : 0;
|
||||
if (sendBooleanResponse(Port, commandId, responseValue) == 0)
|
||||
{
|
||||
PrintResponseError("IsConnected");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//IsDemo
|
||||
case 28:
|
||||
{
|
||||
var result = true;// IsDemo();
|
||||
int responseValue = result == true ? 1 : 0;
|
||||
sendBooleanResponse(Port, commandId, responseValue);
|
||||
}
|
||||
break;
|
||||
|
||||
//ErrorDescription
|
||||
case 39:
|
||||
{
|
||||
//int errorCode = getIntValueOfField(0);
|
||||
//var result = ErrorDescription(errorCode);
|
||||
//sendStringResponse(result);
|
||||
}
|
||||
break;
|
||||
|
||||
//iCloseArray
|
||||
case 144:
|
||||
{
|
||||
int sizeValue = 0;
|
||||
if (getIntValue(Port, commandId, 3, ref sizeValue) == 0)
|
||||
{
|
||||
PrintParamError("slippage");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sendDoubleArrayResponse(Port, commandId/*, prices*/, 100) == 0)
|
||||
{
|
||||
PrintResponseError("iCloseArray");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: //Unknown Commmand
|
||||
Print(string.Format("MetaTrader: Unknown Commmand: code = {0}", commandType));
|
||||
sendVoidResponse(Port, commandId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintParamError(string paramName)
|
||||
{
|
||||
Print("[ERROR] parameter: " + paramName);
|
||||
}
|
||||
|
||||
private void PrintResponseError(string commandName)
|
||||
{
|
||||
Print("[ERROR] response: " + commandName);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public int Port { get; private set; }
|
||||
public bool IsController { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private IntPtr message = IntPtr.Zero;
|
||||
private bool isCrashed = false;
|
||||
private int mId = -1;
|
||||
private static int IDcount = 0;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,243 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Pipes;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
|
||||
namespace TestServer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static MetaTrader createMetaTrader(string accountName, int accountNumber)
|
||||
{
|
||||
MetaTrader mt = new MetaTrader(accountName, accountNumber);
|
||||
|
||||
mt.AddInstrument(new MtInstrument("EURUSD", 1.3, 1.4));
|
||||
mt.AddInstrument(new MtInstrument("EURJPY", 1.3, 1.4));
|
||||
mt.AddInstrument(new MtInstrument("EURAUD", 1.3, 1.4));
|
||||
mt.AddInstrument(new MtInstrument("USDAUD", 1.3, 1.4));
|
||||
mt.AddInstrument(new MtInstrument("USDJPY", 1.3, 1.4));
|
||||
|
||||
return mt;
|
||||
}
|
||||
|
||||
static MtInstrument selectInstrument(List<MtInstrument> instruments)
|
||||
{
|
||||
MtInstrument result = null;
|
||||
|
||||
if (instruments != null)
|
||||
{
|
||||
Console.Clear();
|
||||
|
||||
Console.WriteLine("Select Instrument:");
|
||||
|
||||
foreach (var ins in instruments)
|
||||
Console.WriteLine("{0} - {1}", instruments.IndexOf(ins), ins.Symbol);
|
||||
|
||||
string selectedIndexStr = Console.ReadLine();
|
||||
int selectedIndex = -1;
|
||||
int.TryParse(selectedIndexStr, out selectedIndex);
|
||||
|
||||
if (selectedIndex >= 0 && selectedIndex < instruments.Count)
|
||||
{
|
||||
result = instruments[selectedIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("ERROR: Invalid number of Instrument!\nPress any key...");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static MtInstrumentChart selectChart(List<MtInstrumentChart> instrumentCharts)
|
||||
{
|
||||
MtInstrumentChart result = null;
|
||||
|
||||
if (instrumentCharts != null)
|
||||
{
|
||||
Console.WriteLine("Select Chart:");
|
||||
|
||||
foreach (var chart in instrumentCharts)
|
||||
{
|
||||
if (chart.Instrument != null)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", instrumentCharts.IndexOf(chart), chart.Instrument.Symbol);
|
||||
}
|
||||
}
|
||||
|
||||
string selectedIndexStr = Console.ReadLine();
|
||||
int selectedIndex = -1;
|
||||
int.TryParse(selectedIndexStr, out selectedIndex);
|
||||
|
||||
if (selectedIndex >= 0 && selectedIndex < instrumentCharts.Count)
|
||||
{
|
||||
result = instrumentCharts[selectedIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("ERROR: Invalid number of Chart!\nPress any key...");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void addChart(MetaTrader mt)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Adding Chart.");
|
||||
|
||||
var selectedIinstrument = selectInstrument(mt.Instruments);
|
||||
|
||||
if (selectedIinstrument != null)
|
||||
{
|
||||
var instrumentChart = new MtInstrumentChart(selectedIinstrument);
|
||||
|
||||
mt.AddInstrumentChart(instrumentChart);
|
||||
}
|
||||
}
|
||||
|
||||
static void removeChart(MetaTrader mt)
|
||||
{
|
||||
var selectedChart = selectChart(mt.InstrumentCharts);
|
||||
|
||||
if (selectedChart != null)
|
||||
{
|
||||
mt.RemoveInstrumentChart(selectedChart);
|
||||
}
|
||||
}
|
||||
|
||||
static void addExpert(MetaTrader mt)
|
||||
{
|
||||
var selectedChart = selectChart(mt.InstrumentCharts);
|
||||
|
||||
if (selectedChart != null)
|
||||
{
|
||||
bool isController = false;
|
||||
|
||||
Console.WriteLine("Is Expert controller (y/n) ?");
|
||||
|
||||
ConsoleKeyInfo keyInfo = Console.ReadKey();
|
||||
Console.WriteLine();
|
||||
|
||||
switch (keyInfo.Key)
|
||||
{
|
||||
case ConsoleKey.N:
|
||||
isController = false;
|
||||
break;
|
||||
case ConsoleKey.Y:
|
||||
isController = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine("Input Port property (8222 - default): ");
|
||||
|
||||
string portStr = Console.ReadLine();
|
||||
int port = 8222;
|
||||
if (int.TryParse(portStr, out port) == false)
|
||||
port = 8222;
|
||||
var expert = new MtQuoteExpert(mt, port, isController);
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
selectedChart.AddExpert(expert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void printCharts(List<MtInstrumentChart> instrumentCharts)
|
||||
{
|
||||
if (instrumentCharts != null)
|
||||
{
|
||||
if (instrumentCharts.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Working Charts:");
|
||||
|
||||
foreach (var chart in instrumentCharts)
|
||||
{
|
||||
if (chart.Instrument != null)
|
||||
{
|
||||
string chartInfo = chart.Instrument.Symbol;
|
||||
if (chart.Expert != null)
|
||||
{
|
||||
chartInfo += " - ";
|
||||
chartInfo += chart.Expert.ToString();
|
||||
}
|
||||
|
||||
Console.WriteLine(chartInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("No working Charts.");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var mt = createMetaTrader("Vyacheslav Demidyuk", 9107044);
|
||||
mt.SetDemo(false);
|
||||
|
||||
mt.InfoUpdated += new MetaTraderInfoHandler(mt_InfoUpdated);
|
||||
|
||||
mt.Start();
|
||||
|
||||
Console.WriteLine("Test Server of MetaTraderApi.");
|
||||
Console.WriteLine("MetaTrader started.");
|
||||
Console.WriteLine("Press any key to continue...\n");
|
||||
|
||||
Console.ReadKey();
|
||||
|
||||
bool isWorked = true;
|
||||
|
||||
do
|
||||
{
|
||||
Console.Clear();
|
||||
|
||||
printCharts(mt.InstrumentCharts);
|
||||
|
||||
Console.WriteLine("Choose command:");
|
||||
Console.WriteLine("A- Add Chart");
|
||||
Console.WriteLine("R- Remove Chart");
|
||||
Console.WriteLine("E- Add Expert");
|
||||
Console.WriteLine("Esc- Exit");
|
||||
|
||||
ConsoleKeyInfo keyInfo = Console.ReadKey();
|
||||
|
||||
switch (keyInfo.Key)
|
||||
{
|
||||
case ConsoleKey.A:
|
||||
addChart(mt);
|
||||
break;
|
||||
case ConsoleKey.R:
|
||||
removeChart(mt);
|
||||
break;
|
||||
case ConsoleKey.E:
|
||||
addExpert(mt);
|
||||
break;
|
||||
case ConsoleKey.Escape:
|
||||
isWorked = false;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (isWorked);
|
||||
|
||||
Console.WriteLine("MetaTrader stopped.");
|
||||
|
||||
mt.Stop();
|
||||
}
|
||||
|
||||
static void mt_InfoUpdated(string msg)
|
||||
{
|
||||
Console.WriteLine(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestServer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DW")]
|
||||
[assembly: AssemblyProduct("TestServer")]
|
||||
[assembly: AssemblyCopyright("Copyright © DW 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f96bb2dc-0e55-43e1-a5e4-7989310a09cc")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{220F01DF-8489-44F3-9C79-D5AFFCE94D6B}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestServer</RootNamespace>
|
||||
<AssemblyName>TestServer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CodeErrorTypes.cs" />
|
||||
<Compile Include="IMetaTrader.cs" />
|
||||
<Compile Include="MtExpert.cs" />
|
||||
<Compile Include="MtInstrument.cs" />
|
||||
<Compile Include="MetaTrader.cs" />
|
||||
<Compile Include="MtInstrumentChart.cs" />
|
||||
<Compile Include="MtQuoteExpert.cs.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Reference in New Issue
Block a user