コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual bool Initialize(DataSessionInfo?sessionInfo)
        {
            if (sessionInfo.HasValue == false)
            {
                sessionInfo = _sessionInfo;
            }

            if (IsInitOrOperational(_sessionDataProvider.OperationalState) == false)
            {
                if (_sessionDataProvider.Initialize(sessionInfo) == false)
                {
                    SystemMonitor.Error("Data provider for expert session can not be initialized.");
                    ChangeOperationalState(OperationalStateEnum.NotOperational);
                    return(false);
                }
            }

            ChangeOperationalState(OperationalStateEnum.Initializing);

            _sessionDataProvider.OperationalStateChangedEvent += new OperationalStateChangedDelegate(_subItem_OperationalStatusChangedEvent);

            if (_orderExecutionProvider != null)
            {
                SystemMonitor.CheckReport(_orderExecutionProvider.OperationalState == OperationalStateEnum.Operational, "Order execution provider not ready on session init.");
                _orderExecutionProvider.OperationalStateChangedEvent += new OperationalStateChangedDelegate(_subItem_OperationalStatusChangedEvent);
            }

            _subItem_OperationalStatusChangedEvent(null, OperationalStateEnum.Unknown);

            return(true);
        }