예제 #1
0
        /// <summary>
        /// double click event on the source table/событие двойного клика на таблицу источников
        /// </summary>
        void _gridSources_DoubleClick(object sender, EventArgs e)
        {
            if (_gridSources.CurrentCell.RowIndex <= -1)
            {
                return;
            }

            ServerType type;

            Enum.TryParse(_gridSources.Rows[_gridSources.CurrentCell.RowIndex].Cells[0].Value.ToString(), out type);

            if (ServerMaster.GetServers() == null)
            {
                ServerMaster.CreateServer(type, false);
            }

            IServer server = ServerMaster.GetServers().Find(s => s.ServerType == type);

            if (server == null)
            {
                ServerMaster.CreateServer(type, false);
                server = ServerMaster.GetServers().Find(s => s.ServerType == type);
            }

            server.ShowDialog();
        }
예제 #2
0
        public TesterHandyUi()
        {
            InitializeComponent();
            ServerMaster.SetHostTable(HostPositionOnBoard, HostOrdersOnBoard);
            ServerMaster.CreateServer(ServerType.Tester, false);
            ServerMaster.GetServers();


            _strategyKeeper = new OsTraderMaster(GridChart,
                                                 ChartHostPanel, HostGlass, HostOpenPosition, HostClosePosition, HostAllPosition,
                                                 HostBotLog, HostBotLogPrime, RectChart, HostAllert, TabControlBotsName, TabControlBotTab, TextBoxPrice,
                                                 GridChartControlPanel, StartProgram.IsTester);
            LocationChanged += TesterHandyUi_LocationChanged;
            LabelOsa.Content = "V_" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            cbItems  = new ObservableCollection <ComboBoxItem>();
            cbItems2 = new ObservableCollection <ComboBoxItem>();
            cbItems3 = new ObservableCollection <ComboBoxItem>();
            SetComboBoxItemByTab(0);

            TabControlBotsName.SelectionChanged += TabControlBotsName_SelectionChanged;

            TabControlBotsName.SizeChanged += TabControlBotsName_SizeChanged;
            Closing += TesterHandyUi_Closing;

            Local();
            TabControlMd.SelectedIndex = 2;

            _gridClOrder           = DataGridFactory.GetDataGridOrder();
            HostOrdersClosed.Child = _gridClOrder;
            _gridClOrder.Click    += _gridClOrder_Click;
        }
예제 #3
0
        /// <summary>
        /// конструктор
        /// </summary>
        /// <param name="hostChart">хост для чарта</param>
        /// <param name="hostLog">хост для лога</param>
        /// <param name="hostSource">хост для источников</param>
        /// <param name="hostSets">хост для сетов</param>
        /// <param name="comboBoxSecurity">меню выбора бумаг</param>
        /// <param name="comboBoxTimeFrame">меню выбора таймфрейма</param>
        /// <param name="rectangle">квадрат для подложки</param>
        public OsDataMaster(WindowsFormsHost hostChart, WindowsFormsHost hostLog,
                            WindowsFormsHost hostSource, WindowsFormsHost hostSets, System.Windows.Controls.ComboBox comboBoxSecurity,
                            System.Windows.Controls.ComboBox comboBoxTimeFrame, System.Windows.Shapes.Rectangle rectangle)
        {
            _hostChart         = hostChart;
            _hostSource        = hostSource;
            _hostSets          = hostSets;
            _comboBoxSecurity  = comboBoxSecurity;
            _comboBoxTimeFrame = comboBoxTimeFrame;
            _rectangle         = rectangle;

            _log = new Log("OsDataMaster");
            _log.StartPaint(hostLog);
            _log.Listen(this);

            Load();

            CreateSetGrid();
            RePaintSetGrid();

            try
            {
                ServerMaster.CreateServer(ServerType.Finam, false);
                ServerMaster.CreateServer(ServerType.Quik, false);
                ServerMaster.CreateServer(ServerType.Plaza, false);
                ServerMaster.CreateServer(ServerType.SmartCom, false);
                ServerMaster.CreateServer(ServerType.InteractivBrokers, false);


                List <IServer> servers = ServerMaster.GetServers();

                for (int i = 0; i < servers.Count; i++)
                {
                    servers[i].ConnectStatusChangeEvent += ServerStatusChangeEvent;
                    servers[i].LogMessageEvent          += OsDataMaster_LogMessageEvent;
                }

                SendNewLogMessage("Сервера успешно развёрнуты", LogMessageType.System);
            }
            catch (Exception)
            {
                SendNewLogMessage("Ошибка при создании серверов", LogMessageType.Error);
            }

            CreateSourceGrid();
            RePaintSourceGrid();
            ChangeActivSet(0);
        }
예제 #4
0
        public TesterUi()
        {
            InitializeComponent();

            ServerMaster.IsTester = true;
            ServerMaster.SetHostTable(HostPositionOnBoard, HostOrdersOnBoard);
            ServerMaster.CreateServer(ServerType.Tester, false);
            ServerMaster.GetServers();

            _strategyKeeper = new OsTraderMaster(
                ChartHostPanel, HostGlass, HostOpenPosition, HostClosePosition, HostAllPosition,
                HostBotLog, HostBotLogPrime, RectChart, HostAllert, TabControlBotsName, TabControlBotTab, TextBoxPrice);
            LocationChanged += TesterUi_LocationChanged;
            LabelOsa.Content = "V_" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            TabControlBotsName.SizeChanged += TabControlBotsName_SizeChanged;
        }
예제 #5
0
        public TesterUiLight()
        {
            InitializeComponent();
            ServerMaster.SetHostTable(HostPositionOnBoard, HostOrdersOnBoard);
            ServerMaster.CreateServer(ServerType.Tester, false);
            ServerMaster.GetServers();

            _strategyKeeper = new OsTraderMaster(null,
                                                 null, null, null, null, HostAllPosition,
                                                 null, HostBotLogPrime, null, null, null, null, null,
                                                 null, StartProgram.IsTester);
            LabelOsa.Content = "V_" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            Closing += TesterUi_Closing;
            Local();

            BotTabsPainter painter = new BotTabsPainter(_strategyKeeper, BotsHost);
        }