コード例 #1
0
        //================================================================================
        void MainFormLoad(object sender, EventArgs e)
        {
            // параметры по умолчанию


            session_timeout = 25;
            request_timeout = 10;


            edt_Login.Text    = sLogin;
            edt_Password.Text = sPassword;



            bConnected  = false;
            bConnecting = false;

            Enable_Password_Controls(false);

            Init_Data();

            // открытие лог-файла
            log.StartLogging(AppDir + "log" + DateTime.Now.ToString("yyMMdd") + ".txt");

            TXmlConnector.statusTimeout = session_timeout * 1000;

            TXmlConnector.ConnectorSetCallback(OnNewFormData, OnNewSecurity, OnNewTimeframe, OnNewStatus);

            //NewStringDataHandler nStrDH = Add_FormData;
            //this.onNewFormDataEvent += nStrDH;

            this.onNewFormDataEvent  += new NewStringDataHandler(Add_FormData);
            this.onNewSecurityEvent  += new NewStringDataHandler(Add_Security);
            this.onNewTimeframeEvent += new NewStringDataHandler(Add_Timeframe);
            this.onNewStatusEvent    += new NewBoolDataHandler(ConnectionStatusReflect);

            TXmlConnector.FormReady = true;

            string LogPath = AppDir + "\0";

            if (TXmlConnector.ConnectorInitialize(LogPath, 3))
            {
                TXmlConnector.statusDisconnected.Set();
            }
        }
コード例 #2
0
        //================================================================================
        void MainFormLoad(object sender, EventArgs e)
        {
            ctl_Tabs.SelectTab("tab_Param");

            // параметры по умолчанию
            ServerIP   = "tr1.finam.ru";
            ServerPort = "3900";

            loadLogginDetails();

            session_timeout = 25;
            request_timeout = 10;

            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "FORTS", Value = 4
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ММВБ", Value = 1
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "SPBEX", Value = 7
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "INF", Value = 8
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "MMA", Value = 14
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ETS", Value = 8
            });

            comboBox1.SelectedIndex = 0;


            edt_Login.Text    = sLogin;
            edt_Password.Text = sPassword;
            edt_IP.Text       = ServerIP;
            edt_Port.Text     = ServerPort;

            bConnected  = false;
            bConnecting = false;

            Enable_Password_Controls(false);

            Init_Data();

            // открытие лог-файла
            log.StartLogging(AppDir + "log" + DateTime.Now.ToString("yyMMdd") + ".txt");

            TXmlConnector.statusTimeout = session_timeout * 1000;

            TXmlConnector.ConnectorSetCallback(OnNewFormData, OnNewSecurity, OnNewTimeframe, OnNewStatus);

            this.onNewFormDataEvent  += new NewStringDataHandler(Add_FormData);
            this.onNewSecurityEvent  += new NewStringDataHandler(Add_Security);
            this.onNewTimeframeEvent += new NewStringDataHandler(Add_Timeframe);
            this.onNewStatusEvent    += new NewBoolDataHandler(ConnectionStatusReflect);

            TXmlConnector.Orders4HMISubscribe(OrdersSubscriber);
            this.onOrdersPublished += new NewStringDataHandler(processOrdersDistribution);


            OportunityMonitor.init();

            TXmlConnector.FormReady = true;

            string LogPath = AppDir + "\0";

            if (TXmlConnector.ConnectorInitialize(LogPath, 3))
            {
                TXmlConnector.statusDisconnected.Set();
            }

            OportunityMonitor.subscribeQuotationUpdate(quotationCall);
            this.onQuotation += new quotationDelegate(setQuotationPrice);

            OportunityMonitor.PositionPublisherCallback(PositionPublisherCall);
            onPositionSuscriber += new PositionDelegate(setTakingClosingPosition);

            MamuschkaRepeater.mamushkaStatusSubscribe(mamuschkaStatusCall);
            onMamushkaStatusResponse += new NewStringDataHandler(setMamushkaServerStatus);
            MamuschkaRepeater.monitorMamuschkaServer();
        }