コード例 #1
0
        protected bool RemoveSession(ExpertSession session)
        {
            if (_sessions.Contains(session) == false)
            {
                return(false);
            }

            _sessions.Remove(session);

            if (session.DataProvider != null && session.DataProvider.Quotes != null)
            {
                session.DataProvider.Quotes.QuoteUpdateEvent -= new QuoteProviderUpdateDelegate(Quote_QuoteUpdateEvent);
            }

            if (session.OrderExecutionProvider != null)
            {
                ITradeEntityManagement management = session.OrderExecutionProvider.TradeEntities;

                if (management != null)
                {
                    management.OrdersAddedEvent   -= new OrderManagementOrdersUpdateDelegate(history_OrdersAddedEvent);
                    management.OrdersRemovedEvent -= new OrderManagementOrdersUpdateDelegate(history_OrdersRemovedEvent);
                    management.OrdersUpdatedEvent -= new OrderManagementOrdersUpdateTypeDelegate(management_OrderUpdatedEvent);
                    management.OrdersCriticalInformationChangedEvent -= new OrderManagementOrderCriticalModificationDelegate(management_OrdersCriticalInformationChangedEvent);
                }
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public void UnRegisterExpertSession(ExpertSession session)
        {
            lock (this)
            {
                if (SessionDestroyingEvent != null)
                {
                    SessionDestroyingEvent(this, session);
                }

                if (session.OperationalState == OperationalStateEnum.Operational ||
                    session.OperationalState == OperationalStateEnum.Initialized)
                {
                    SystemMonitor.CheckError(Arbiter != null, "Make sure entering here only when the entire host is still valid and only a session needs to be destroyed.");
                    ((PlatformExpertSession)session).UnInitialize();
                }

                session.Dispose();

                _sessions.Remove((PlatformExpertSession)session);
            }

            if (SessionDestroyedEvent != null)
            {
                SessionDestroyedEvent(this, session);
            }

            if (SessionsUpdateEvent != null)
            {
                SessionsUpdateEvent(this);
            }
        }
コード例 #3
0
 public void UnInitializeControl()
 {
     listViewIndicators.Clear();
     listViewIndicatorTypes.Clear();
     this.indicatorControl1.SelectedObject = null;
     _session = null;
 }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        public ExpertSessionIndicatorsControl(ExpertSession session, IEnumerable <ChartPane> chartPanes)
        {
            InitializeComponent();

            _session    = session;
            _chartPanes = chartPanes;
        }
コード例 #5
0
 void ordersControl1_SelectedOrderChangedEvent(ExpertSession session, Order newSelectedOrder)
 {
     if (_session.MainChartSeries != null)
     {
         _session.MainChartSeries.SelectedOrder = newSelectedOrder;
         chartControl.MasterPane.Refresh();
     }
 }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        bool IsSessionVisible(ExpertSession session)
        {
            if (session.OrderExecutionProvider == null)
            {// Not order sessions always invisible.
                return(false);
            }

            return(_selectedSession == null || _selectedSession == session);
        }
コード例 #7
0
 /// <summary>
 /// Helper.
 /// </summary>
 /// <param name="sessionInformation"></param>
 /// <returns></returns>
 string GetSessionName(ExpertSession session)
 {
     if (session.OperationalState == OperationalStateEnum.NotOperational || session.OperationalState == OperationalStateEnum.Unknown ||
         session.OrderExecutionProvider == null || session.OrderExecutionProvider.DefaultAccount == null)
     {
         return("[Invalid Account]");
     }
     else
     {
         return(session.Info.Name + "," + session.OrderExecutionProvider.DefaultAccount.Info.Name + ", " + session.OrderExecutionProvider.DefaultAccount.Info.Server);
     }
 }
コード例 #8
0
ファイル: ExpertHost.cs プロジェクト: hombrevrc/OpenForexNew
        public virtual ISessionDataProvider CreateRemoteExpertSession(DataSessionInfo info, ComponentId dataSourceId, ComponentId orderExecuteId)
        {
            string message = string.Empty;

            ExpertSession session = this.CreateExpertSession(info, dataSourceId, orderExecuteId, false, out message);

            if (session != null)
            {
                if (this.RegisterExpertSession(session))
                {
                    return(session.DataProvider);
                }
            }
            return(null);
        }
コード例 #9
0
        /// <summary>
        /// Create an expert sessionInformation, by coupling the dataDelivery and order execution providers.
        /// </summary>
        /// <param name="dataProvider">Do not initialize the dataDelivery OrderExecutionProvider before passing it here, and do not add it to arbiter.</param>
        /// <param name="orderExecutionProvider">May be null, for dataDelivery only sessions; do not initialize the dataDelivery OrderExecutionProvider before passing it here, and do not add it to arbiter.</param>
        /// <returns></returns>
        public bool RegisterExpertSession(ExpertSession session)
        {
            lock (this)
            {
                _sessions.Add((PlatformExpertSession)session);
            }

            if (SessionCreatedEvent != null)
            {
                SessionCreatedEvent(this, session);
            }

            if (SessionsUpdateEvent != null)
            {
                SessionsUpdateEvent(this);
            }

            return(true);
        }
コード例 #10
0
        private void toolStripComboBoxAccount_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_sessionManager == null)
            {
                return;
            }

            if (toolStripComboBoxAccount.SelectedIndex > 0)
            {// Set select orderInfo, -1 to compensate for the initial "All" field.
                _selectedSession = _sessionManager.SessionsArray[toolStripComboBoxAccount.SelectedIndex - 1];
            }
            else
            {// By default 0 position means all are selected.
                _selectedSession = null;
            }

            UpdateUI();

            if (SelectedSessionChangedEvent != null)
            {
                SelectedSessionChangedEvent(_selectedSession);
            }
        }
コード例 #11
0
        private void listViewOrders_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_sessionManager == null)
            {
                return;
            }

            if (SelectedOrderChangedEvent != null)
            {
                if (listViewOrders.SelectedItems.Count == 0)
                {
                    SelectedOrderChangedEvent(null, null);
                }
                else
                {
                    DataSessionInfo sessionInfo = ((DataSessionInfo?)listViewOrders.SelectedItems[0].Group.Tag).Value;
                    ExpertSession   session     = null;
                    foreach (ExpertSession sessionItem in _sessions)
                    {
                        if (sessionItem.Info.Equals(sessionInfo))
                        {
                            session = sessionItem;
                            break;
                        }
                    }

                    SystemMonitor.CheckError(session != null, "Session for this session info not found.");

                    Order order = listViewOrders.SelectedItems[0].Tag as Order;

                    SystemMonitor.CheckError(session.OrderExecutionProvider == null || session.OrderExecutionProvider.TradeEntities.ContainsOrder(order), "Wrong session for selected order.");

                    SelectedOrderChangedEvent(session, order);
                }
            }
        }
コード例 #12
0
        public bool SetInitialParameters(ISourceManager manager, ComponentId sourceSourceId, ExpertSession session)
        {
            _manager = manager;

            _sessionInfo = session.Info;

            _sourceDataDelivery = manager.ObtainDataDelivery(sourceSourceId);
            //_sourceDataDelivery.OperationalStateChangedEvent += new OperationalStateChangedDelegate(_sourceDataDelivery_OperationalStateChangedEvent);

            StatusSynchronizationSource = _sourceDataDelivery;

            return(true);
        }