void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            // Re-map the session orderInfo.
            RuntimeDataSessionInformation information = _dataDelivery.GetSymbolRuntimeSessionInformation(_symbol);

            if (information == null)
            {
                SystemMonitor.OperationError("Failed to map session information for quote provider.");
                _sessionInfo = DataSessionInfo.Empty;
            }
            else
            {
                _sessionInfo = information.Info;

                if (_dataDelivery.SubscribeToData(_sessionInfo, true, new DataSubscriptionInfo(true, false, null)))
                {
                    RequestQuoteUpdate(false);
                }
            }
        }
Esempio n. 2
0
        public bool Initialize(AnalyzerSession session)
        {
            lock (this)
            {
                //SystemMonitor.CheckThrow(_expertSession == null);
                _expertSession = session;
                //_executionAccount.Initialize(session);

                double balance = 10000;
                //_executionAccount.InitializeInfo(balance, 0, "NA", session.SessionInfo.BaseCurrency, balance,
                //    0, 100, 0, session.SessionInfo.Symbol, 1, 0, "Local");

                this.Name = "Simulation Order Executioner of " + _expertSession.SessionInfo.Id;

                if (_expertSession != null && _expertSession.DataProvider != null)
                {
                    _expertSession.DataProvider.ValuesUpdateEvent += new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
                }
                else
                {// Wait for session to be ready before trying to subsribe again.
                 //_expertSession.OperationalStatusChangedEvent += new GeneralHelper.GenericDelegate<IOperational>(_expertSession_OperationalStatusChangedEvent);
                }
            }

            _operationalState = OperationalStateEnum.Operational;
            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
            return(OperationalState == OperationalStateEnum.Operational);
        }
Esempio n. 3
0
 /// <summary>
 /// Raise event helper.
 /// </summary>
 /// <param name="previousState"></param>
 protected void RaiseOperationalStatusChangedEvent(OperationalStateEnum previousState)
 {
     if (OperationalStateChangedEvent != null)
     {
         OperationalStateChangedEvent(this, previousState);
     }
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 void GenericKeeper_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     if (ItemOperationalStatusChangedEvent != null)
     {
         ItemOperationalStatusChangedEvent(this, (ItemType)operational);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Change the component operational state.
        /// </summary>
        /// <param name="operationalState"></param>
        protected void ChangeOperationalState(OperationalStateEnum operationalState)
        {
            OperationalStateEnum previousState;

            lock (this)
            {
                if (operationalState == _operationalState)
                {
                    return;
                }

                previousState = _operationalState;
            }

            TracerHelper.Trace(this.GetType().Name + " is now " + operationalState.ToString() + " has [" + _operationStateChangeSubscribers.Count + "] subscribers.");

            _operationalState = operationalState;
            if (OperationalStateChangedEvent != null)
            {
                OperationalStateChangedEvent(this, previousState);
            }

            // Send to monitoring subscribers.
            lock (this)
            {
                foreach (TransportInfo info in _operationStateChangeSubscribers)
                {
                    TracerHelper.Trace("Sending operational state [" + operationalState.ToString() + "] to [" + info.OriginalSenderId.Value.Id.Print() + "].");
                    this.SendResponding(info, new ChangeOperationalStateMessage(this.OperationalState, false));
                }
            }
        }
Esempio n. 6
0
 void component_OperationalStatusChangedEvent(IOperational component, OperationalStateEnum previousState)
 {
     SystemMonitor.CheckError(_components.ContainsValue((PlatformComponent)component), "Component not present.");
     if (ActiveComponentChangedOperationalStateEvent != null)
     {
         ActiveComponentChangedOperationalStateEvent(this, (PlatformComponent)component, previousState);
     }
 }
 void _component_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     WinFormsHelper.BeginManagedInvoke(this,
                                       delegate
     {
         labelStatus.Text = UserFriendlyNameAttribute.GetTypeAttributeName(operational.GetType()) + " is " + operational.OperationalState.ToString();
     });
 }
 protected override void DataProvider_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     base.DataProvider_OperationalStatusChangedEvent(operational, previousOperationState);
     if (operational.OperationalState == OperationalStateEnum.Operational)
     {// Run in a separate thread since it takes time to request from server.
         BeginUpdate();
     }
 }
Esempio n. 9
0
 public bool Initialize(IDataProvider dataProvider)
 {
     lock (this)
     {
         _dataProvider = dataProvider;
         ////_dataProvider.OperationalStatusChangedEvent += new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
         _operationalState = OperationalStateEnum.Initialized;
     }
     return(true);
 }
Esempio n. 10
0
 void _account_OperationalStatusChangedEvent(IOperational account, OperationalStateEnum previousState)
 {
     if (account.OperationalState == CommonSupport.OperationalStateEnum.Operational)
     {
         if (_account.Info.Balance.HasValue)
         {
             _initialEquity = _account.Info.Balance.Value;
         }
     }
 }
Esempio n. 11
0
 void _delivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     if (operational.OperationalState == OperationalStateEnum.Operational)
     {
         foreach (Symbol symbol in _symbolQuotes.Keys)
         {
             string message;
             AddSymbol(_dataSourceId.Value, symbol, out message);
         }
     }
 }
Esempio n. 12
0
 /// <summary>
 ///
 /// </summary>
 protected override void ChangeOperationalState(OperationalStateEnum operationalState)
 {
     if (operationalState == OperationalStateEnum.Operational && AllAccountsLoaded == false)
     {// If we are still loading the accounts susped the change to operational for a while.
         base.ChangeOperationalState(OperationalStateEnum.Initializing);
     }
     else
     {
         base.ChangeOperationalState(operationalState);
     }
 }
Esempio n. 13
0
        public bool Initialize(IDataProvider dataProvider, IOrderExecutionProvider orderExectioner)
        {
            lock (this)
            {
                _dataProvider = dataProvider;

                _operationalState = OperationalStateEnum.Initialized;
            }

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
            return(true);
        }
Esempio n. 14
0
        void _expert_OperationalStatusChangedEvent(IOperational expert, OperationalStateEnum previousState)
        {
            if (expert.OperationalState == OperationalStateEnum.Operational)
            {
                SessionManager_SessionsUpdateEvent(_expert.Manager);
            }

            if (previousState == OperationalStateEnum.Operational)
            {// Coming out of operational state - always persist.
                _expert.Host.UISerializationInfo = new SerializationInfoEx();
                dragContainerControl1.SaveState(_expert.Host.UISerializationInfo);
            }
        }
        public virtual void UnInitialize()
        {
            if (_operationalState == OperationalStateEnum.Initialized ||
                _operationalState == OperationalStateEnum.Operational)
            {
                //UnSubscribeToSessionMessage message = new UnSubscribeToSessionMessage(_sessionInfo);
                RequestConfirmation = false;

                // UnSubscribe to source here.
                //SendForwarding(_forwardTransportation, message);
            }

            _operationalState = OperationalStateEnum.UnInitialized;

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
Esempio n. 16
0
        //void _expertSession_OperationalStatusChangedEvent(IOperational session)
        //{
        //    if (session.OperationalState != OperationalStateEnum.Operational)
        //    {
        //        return;
        //    }

        //    _expertSession.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_expertSession_OperationalStatusChangedEvent);
        //    if (_expertSession != null && _expertSession.DataProvider != null)
        //    {
        //        _expertSession.DataProvider.ValuesUpdateEvent += new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
        //    }
        //}

        public void UnInitialize()
        {
            lock (this)
            {
                _operationalState = OperationalStateEnum.UnInitialized;
            }
            //_executionAccount.UnInitialize();
            //_executionAccount = null;
            if (_expertSession != null && _expertSession.DataProvider != null)
            {
                _expertSession.DataProvider.ValuesUpdateEvent -= new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
            }
            _expertSession = null;

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
Esempio n. 17
0
        void _subItem_OperationalStatusChangedEvent(IOperational subItem, OperationalStateEnum previousState)
        {
            if (_sessionDataProvider != null && _sessionDataProvider.OperationalState == OperationalStateEnum.Operational &&
                (_orderExecutionProvider == null || _orderExecutionProvider.OperationalState == OperationalStateEnum.Operational))
            {
                if (_orderExecutionProvider != null && _orderExecutionProvider.TradeEntities != null)
                {
                    // Create the default position for this session.
                    _position = _orderExecutionProvider.TradeEntities.ObtainPositionBySymbol(_sessionInfo.Symbol);
                }

                ChangeOperationalState(OperationalStateEnum.Operational);
            }
            else
            {
                ChangeOperationalState(OperationalStateEnum.NotOperational);
            }
        }
Esempio n. 18
0
        public void UnInitialize()
        {
            lock (this)
            {
                _operationalState = OperationalStateEnum.UnInitialized;

                if (_dataProvider != null)
                {
                    //_dataProvider.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
                    _dataProvider = null;
                }

                if (_orderExecutionProvider != null)
                {
                    //_orderExecutionProvider.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
                    _orderExecutionProvider = null;
                }
            }
            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
Esempio n. 19
0
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            RuntimeDataSessionInformation info = _dataDelivery.GetSymbolRuntimeSessionInformation(_session.Symbol);

            if (info != null)
            {
                if (info.TickDataAvailabe)
                {
                    _dataDelivery.RequestDataHistoryUpdate(_session, new DataHistoryRequest(TimeSpan.Zero, null), false);
                }
            }
            else
            {
                SystemMonitor.OperationError("Failed to estblish runtime data session information.");
            }
        }
Esempio n. 20
0
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            if (_sessionInfo.IsEmtpy)
            {
                SystemMonitor.OperationError("Data bar provider has no valid session assiged.");
                return;
            }

            // Re-map the session orderInfo.
            RuntimeDataSessionInformation information = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);

            if (information == null)
            {
                SystemMonitor.OperationError("Failed to map session information for data provider.");
                _sessionInfo = DataSessionInfo.Empty;
                return;
            }
            else
            {
                _sessionInfo = information.Info;
            }

            if (_dataDelivery.SubscribeToData(_sessionInfo, true, new DataSubscriptionInfo(false, false, new TimeSpan[] { Period.Value })) == false)
            {
                SystemMonitor.OperationError("Failed to subscribe to bar data updates.");
                return;
            }

            RuntimeDataSessionInformation session = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);

            if (session != null && session.AvailableDataBarPeriods.Contains(_period.Value))
            {
                _dataDelivery.RequestDataHistoryUpdate(_sessionInfo, new DataHistoryRequest(_period.Value, _defaultHistoryBarsCount), false);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Change the component operational state.
        /// </summary>
        /// <param name="operationalState"></param>
        public virtual void ChangeOperationalState(OperationalStateEnum operationalState)
        {
            OperationalStateEnum previousState;

            lock (this)
            {
                if (operationalState == _operationalState)
                {
                    return;
                }

                previousState = _operationalState;
            }

            TracerHelper.Trace(this.GetType().Name + " was " + previousState.ToString() + " is now " + operationalState.ToString());

            _operationalState = operationalState;
            if (OperationalStateChangedEvent != null)
            {
                OperationalStateChangedEvent(this, previousState);
            }
        }
        void _session_OperationalStatusChangedEvent(IOperational session, OperationalStateEnum previousState)
        {// Session has changed operation mode - show in the chart name.
            if (_session == null)
            {
                SystemMonitor.Warning("Control session already cleared.");
                return;
            }

            WinFormsHelper.BeginManagedInvoke(this, delegate()
            {
                if (session == _session)
                {
                    UpdateMasterChart();
                }
                else
                {
                    SystemMonitor.CheckError(_session == null || session == null, "Session mismatch.");
                }
            });

            // We can not afford delayed execution here, since on closing the application, persisting is needed
            // and by than Invoke requests are not handled any more.
            if (previousState == OperationalStateEnum.Operational)
            {// All coming out of operation state must be persisted.
                // Save UI dataDelivery to sessionInformation object.
                if (_session.ChartControlPersistence != null)
                {
                    _session.ChartControlPersistence.Clear();
                }
                else
                {
                    _session.ChartControlPersistence = new SerializationInfoEx();
                }

                chartControl.SaveState(_session.ChartControlPersistence);
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Change the component operational state.
        /// </summary>
        /// <param name="operationalState"></param>
        protected virtual void ChangeOperationalState(OperationalStateEnum operationalState)
        {
            OperationalStateEnum previousState;

            lock (this)
            {
                if (operationalState == _operationalState)
                {
                    return;
                }

                previousState = _operationalState;
            }

#if Matrix_Diagnostics
            SystemMonitor.Debug(this.GetType().Name + " was " + previousState.ToString() + " is now " + operationalState.ToString());
#endif

            _operationalState = operationalState;
            if (OperationalStateChangedEvent != null)
            {
                OperationalStateChangedEvent(this, previousState);
            }
        }
 protected override void DataProvider_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     base.DataProvider_OperationalStatusChangedEvent(operational, previousOperationState);
     DoUpdate();
 }
 void expertHost_OperationalStatusChangedEvent(IOperational host, OperationalStateEnum previousState)
 {
 }
 void ExecutionSource_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.DefaultDelegate(UpdateUI));
 }
        void PlatformSourceOrderExecutionProvider_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (OperationalState == OperationalStateEnum.Operational && _accounts.Length == 0)
            {
                if (base.SubscribeToAccounts() == false)
                {
                    SystemMonitor.Error("Failed to subscribe to source. Further operations will not proceed as expected.");
                }

                AccountInfo[] accountInfos;
                if (base.GetAvailableAccountInfos(out accountInfos) && accountInfos.Length > 0)
                {
                    lock (this)
                    {
                        _accounts = new Account[accountInfos.Length];
                        for (int i = 0; i < accountInfos.Length; i++)
                        {
                            _accounts[i] = new RemoteExecutionAccount(accountInfos[i]);
                            _accounts[i].SetInitialParameters(_manager, this, _manager.GetDataDelivery(_dataSourced));
                            _accounts[i].Initialize(this);
                        }

                        if (_accounts.Length > 0)
                        {
                            _defaultAccount = _accounts[0];
                        }
                        else
                        {
                            _defaultAccount = null;
                        }
                    }
                }
                else
                {
                    SystemMonitor.Warning("Failed to establish accounts (default account) on Order Execution Provider.");
                }
            }
        }
 void _delivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     if (operational.OperationalState == OperationalStateEnum.Operational)
     {
         foreach (Symbol symbol in _symbolQuotes.Keys)
         {
             string message;
             AddSymbol(_dataSourceId.Value, symbol, out message);
         }
     }
 }
        void _expert_OperationalStatusChangedEvent(IOperational expert, OperationalStateEnum previousState)
        {
            if (expert.OperationalState == OperationalStateEnum.Operational)
            {
                SessionManager_SessionsUpdateEvent(_expert.Manager);
            }

            if (previousState == OperationalStateEnum.Operational)
            {// Coming out of operational state - always persist.
                _expert.Host.UISerializationInfo = new SerializationInfoEx();
                dragContainerControl1.SaveState(_expert.Host.UISerializationInfo);
            }
        }
 void _account_OperationalStatusChangedEvent(IOperational account, OperationalStateEnum previousState)
 {
     if (account.OperationalState == CommonSupport.OperationalStateEnum.Operational)
     {
         if (_account.Info.Balance.HasValue)
         {
             _initialEquity = _account.Info.Balance.Value;
         }
     }
 }
        public virtual void UnInitialize()
        {
            if (_operationalState == OperationalStateEnum.Initialized ||
                _operationalState == OperationalStateEnum.Operational)
            {
                //UnSubscribeToSessionMessage message = new UnSubscribeToSessionMessage(_sessionInfo);
                RequestConfirmation = false;

                // UnSubscribe to source here.
                //SendForwarding(_forwardTransportation, message);
            }

            _operationalState = OperationalStateEnum.UnInitialized;

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
        public void UnInitialize()
        {
            lock (this)
            {
                _operationalState = OperationalStateEnum.UnInitialized;

                if (_dataProvider != null)
                {
                    //_dataProvider.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
                    _dataProvider = null;
                }

                if (_orderExecutionProvider != null)
                {
                    //_orderExecutionProvider.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
                    _orderExecutionProvider = null;
                }
            }
            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
 public bool Initialize(IDataProvider dataProvider)
 {
     lock (this)
     {
         _dataProvider = dataProvider;
         ////_dataProvider.OperationalStatusChangedEvent += new GeneralHelper.GenericDelegate<IOperational>(_subItem_OperationalStatusChangedEvent);
         _operationalState = OperationalStateEnum.Initialized;
     }
     return true;
 }
        public bool Initialize(IDataProvider dataProvider, IOrderExecutionProvider orderExectioner)
        {
            lock (this)
            {
                _dataProvider = dataProvider;

                _operationalState = OperationalStateEnum.Initialized;
            }

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
            return true;
        }
        public bool Initialize(AnalyzerSession session)
        {
            lock (this)
            {
                //SystemMonitor.CheckThrow(_expertSession == null);
                _expertSession = session;
                //_executionAccount.Initialize(session);

                double balance = 10000;
                //_executionAccount.InitializeInfo(balance, 0, "NA", session.SessionInfo.BaseCurrency, balance,
                //    0, 100, 0, session.SessionInfo.Symbol, 1, 0, "Local");

                this.Name = "Simulation Order Executioner of " + _expertSession.SessionInfo.Id;

                if (_expertSession != null && _expertSession.DataProvider != null)
                {
                    _expertSession.DataProvider.ValuesUpdateEvent += new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
                }
                else
                {// Wait for session to be ready before trying to subsribe again.
                    //_expertSession.OperationalStatusChangedEvent += new GeneralHelper.GenericDelegate<IOperational>(_expertSession_OperationalStatusChangedEvent);
                }
            }

            _operationalState = OperationalStateEnum.Operational;
            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
            return OperationalState == OperationalStateEnum.Operational;
        }
        //void _expertSession_OperationalStatusChangedEvent(IOperational session)
        //{
        //    if (session.OperationalState != OperationalStateEnum.Operational)
        //    {
        //        return;
        //    }
        //    _expertSession.OperationalStatusChangedEvent -= new GeneralHelper.GenericDelegate<IOperational>(_expertSession_OperationalStatusChangedEvent);
        //    if (_expertSession != null && _expertSession.DataProvider != null)
        //    {
        //        _expertSession.DataProvider.ValuesUpdateEvent += new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
        //    }
        //}
        public void UnInitialize()
        {
            lock (this)
            {
                _operationalState = OperationalStateEnum.UnInitialized;
            }
            //_executionAccount.UnInitialize();
            //_executionAccount = null;
            if (_expertSession != null && _expertSession.DataProvider != null)
            {
                _expertSession.DataProvider.ValuesUpdateEvent -= new ValuesUpdatedDelegate(DataProvider_ValuesUpdateEvent);
            }
            _expertSession = null;

            //GeneralHelper.SafeEventRaise(OperationalStatusChangedEvent, this);
        }
        /// <summary>
        /// Change the component operational state.
        /// </summary>
        /// <param name="operationalState"></param>
        protected virtual void ChangeOperationalState(OperationalStateEnum operationalState)
        {
            OperationalStateEnum previousState;
            lock (this)
            {
                if (operationalState == _operationalState)
                {
                    return;
                }

                previousState = _operationalState;
            }

            TracerHelper.Trace(this.GetType().Name + " was " + previousState.ToString() + " is now " + operationalState.ToString());

            _operationalState = operationalState;
            if (OperationalStateChangedEvent != null)
            {
                OperationalStateChangedEvent(this, previousState);
            }
        }
 void DataStore_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
 {
 }
 void TimeManagementToolStrip_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum previousState)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
 /// <summary>
 /// Raise event helper.
 /// </summary>
 /// <param name="previousState"></param>
 protected void RaiseOperationalStatusChangedEvent(OperationalStateEnum previousState)
 {
     if (OperationalStateChangedEvent != null)
     {
         OperationalStateChangedEvent(this, previousState);
     }
 }
Esempio n. 41
0
        protected virtual void client_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            lock (this)
            {
                if (this.client != null && !this.SessionCheckBox.Enabled)
                {
                    if (this.client.IsOperational)
                    {
                        this.ConnectCheckBox.Invoke(new SetControlBoolValue(this.SetControlChecked), this.ConnectCheckBox, true);

                        TransportInfo ti = this.client.ProxyTransportInfo;

                        if (this.platform.RegisterSource(
                                new SourceInfo(
                                    SourceTypeEnum.HighPriorityLiveFullProvider,
                                    ti)
                                ))
                        {
                            this.Message = "Client Proxy connected";

                            this.clientID = ti.OriginalSenderId.Value.Id;
                            this.client.OperationalStateChangedEvent -= new OperationalStateChangedDelegate(client_OperationalStateChangedEvent);

                            this.Invoke(new SetControlBoolValue(this.SetControlEnable), this.URLTextBox, false);
                            this.Invoke(new SetControlBoolValue(this.SetControlEnable), this.ExpertNameTextBox, false);
                            this.Invoke(new SetControlBoolValue(this.SetControlEnable), this.SessionCheckBox, true);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 
 /// </summary>
 public OperationalStateChangeMessage(OperationalStateEnum state)
 {
     _state = state;
 }
 void _platform_ActiveComponentChangedOperationalStateEvent(Platform platform, PlatformComponent component, OperationalStateEnum previousState)
 {
     //WinFormsHelper.BeginFilteredManagedInvoke(this, new EventHandler(tabControl_SelectedIndexChanged), null, EventArgs.Empty);
 }
 /// <summary>
 /// Helper.
 /// </summary>
 public static bool IsInitOrOperational(OperationalStateEnum state)
 {
     return state == OperationalStateEnum.Initialized || state == OperationalStateEnum.Operational;
 }
Esempio n. 45
0
 void component_OperationalStatusChangedEvent(IOperational component, OperationalStateEnum previousState)
 {
     SystemMonitor.CheckError(_components.ContainsValue((PlatformComponent)component), "Component not present.");
     if (ActiveComponentChangedOperationalStateEvent != null)
     {
         ActiveComponentChangedOperationalStateEvent(this, (PlatformComponent)component, previousState);
     }
 }
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            RuntimeDataSessionInformation info = _dataDelivery.GetSymbolRuntimeSessionInformation(_session.Symbol);

            if (info != null)
            {
                if (info.TickDataAvailabe)
                {
                    _dataDelivery.RequestDataHistoryUpdate(_session, new DataHistoryRequest(TimeSpan.Zero, null), false);
                }
            }
            else
            {
                SystemMonitor.OperationError("Failed to estblish runtime data session information.");
            }
        }
        void _subItem_OperationalStatusChangedEvent(IOperational subItem, OperationalStateEnum previousState)
        {
            if (_sessionDataProvider != null && _sessionDataProvider.OperationalState == OperationalStateEnum.Operational
                && (_orderExecutionProvider == null || _orderExecutionProvider.OperationalState == OperationalStateEnum.Operational))
            {
                if (_orderExecutionProvider != null && _orderExecutionProvider.TradeEntities != null)
                {
                    // Create the default position for this session.
                    _position = _orderExecutionProvider.TradeEntities.ObtainPositionBySymbol(_sessionInfo.Symbol);
                }

                ChangeOperationalState(OperationalStateEnum.Operational);
            }
            else
            {
                ChangeOperationalState(OperationalStateEnum.NotOperational);
            }
        }
 /// <summary>
 /// 
 /// </summary>
 protected override void ChangeOperationalState(OperationalStateEnum operationalState)
 {
     if (operationalState == OperationalStateEnum.Operational && AllAccountsLoaded == false)
     {// If we are still loading the accounts susped the change to operational for a while.
         base.ChangeOperationalState(OperationalStateEnum.Initializing);
     }
     else
     {
         base.ChangeOperationalState(operationalState);
     }
 }
Esempio n. 49
0
        /// <summary>
        /// Follow synchrnozation source status.
        /// </summary>
        void _statusSynchronizationSource_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
        {
            if (StatusSynchronizationEnabled)
            {
#if Matrix_Diagnostics
                SystemMonitor.Debug(this.GetType().Name + " is following its source " + parameter1.GetType().Name + " to state " + parameter1.OperationalState.ToString());
#endif
                this.ChangeOperationalState(parameter1.OperationalState);
            }
            else
            {
#if Matrix_Diagnostics
                SystemMonitor.Debug(this.GetType().Name + " is not following its source " + parameter1.GetType().Name + " to new state because synchronization is disabled.");
#endif
            }
        }
Esempio n. 50
0
        ///// <summary>
        ///// External thread.
        ///// </summary>
        //void _manager_SessionUpdateEvent(SessionSource parameter1)
        //{
        //    if (this.IsDisposed == false &&
        //        this.Disposing == false && this.IsHandleCreated)
        //    {
        //        WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.DefaultDelegate(DoUpdateUI));
        //    }
        //}

        void _sessionManager_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
        {
            WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
        }
Esempio n. 51
0
 /// <summary>
 /// Helper.
 /// </summary>
 public static bool IsInitOrOperational(OperationalStateEnum state)
 {
     return(state == OperationalStateEnum.Initialized || state == OperationalStateEnum.Operational);
 }
 void _platform_ActiveComponentChangedOperationalStateEvent(Platform platform, PlatformComponent component, OperationalStateEnum previousState)
 {
     //WinFormsHelper.BeginFilteredManagedInvoke(this, new EventHandler(tabControl_SelectedIndexChanged), null, EventArgs.Empty);
 }
 protected override void _provider_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     base._provider_OperationalStatusChangedEvent(operational, previousOperationState);
     // Run in a separate thread since it takes time to request from server.
     BeginUpdate();
 }
 void _component_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
     WinFormsHelper.BeginManagedInvoke(this,
         delegate
         {
             labelStatus.Text = UserFriendlyNameAttribute.GetTypeAttributeName(operational.GetType()) + " is " + operational.OperationalState.ToString();
         });
 }
Esempio n. 55
0
 protected virtual void _provider_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
 }
        void _session_OperationalStatusChangedEvent(IOperational session, OperationalStateEnum previousState)
        {
            // Session has changed operation mode - show in the chart name.

            if (_session == null)
            {
                SystemMonitor.Warning("Control session already cleared.");
                return;
            }

            WinFormsHelper.BeginManagedInvoke(this, delegate()
            {
                if (session == _session)
                {
                    UpdateMasterChart();
                }
                else
                {
                    SystemMonitor.CheckError(_session == null || session == null, "Session mismatch.");
                }
            });

            // We can not afford delayed execution here, since on closing the application, persisting is needed
            // and by than Invoke requests are not handled any more.
            if (previousState == OperationalStateEnum.Operational)
            {// All coming out of operation state must be persisted.
                // Save UI dataDelivery to sessionInformation object.
                if (_session.ChartControlPersistence != null)
                {
                    _session.ChartControlPersistence.Clear();
                }
                else
                {
                    _session.ChartControlPersistence = new SerializationInfoEx();
                }

                chartControl.SaveState(_session.ChartControlPersistence);
            }
        }
Esempio n. 57
0
 protected virtual void _provider_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
 {
 }
Esempio n. 58
0
 /// <summary>
 /// Follow synchrnozation source status.
 /// </summary>
 void _statusSynchronizationSource_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
 {
     if (StatusSynchronizationEnabled)
     {
         TracerHelper.Trace(this.GetType().Name + " is following its source " + parameter1.GetType().Name + " to state " + parameter1.OperationalState.ToString());
         this.ChangeOperationalState(parameter1.OperationalState);
     }
     else
     {
         TracerHelper.Trace(this.GetType().Name + " is not following its source " + parameter1.GetType().Name + " to new state because synchronization is disabled.");
     }
 }
 /// <summary>
 /// Follow synchrnozation source status.
 /// </summary>
 void _statusSynchronizationSource_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
 {
     if (StatusSynchronizationEnabled)
     {
         TracerHelper.Trace(this.GetType().Name + " is following its source " + parameter1.GetType().Name + " to state " + parameter1.OperationalState.ToString());
         this.ChangeOperationalState(parameter1.OperationalState);
     }
     else
     {
         TracerHelper.Trace(this.GetType().Name + " is not following its source " + parameter1.GetType().Name + " to new state because synchronization is disabled.");
     }
 }
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            if (_sessionInfo.IsEmtpy)
            {
                SystemMonitor.OperationError("Data bar provider has no valid session assiged.");
                return;
            }

            // Re-map the session orderInfo.
            RuntimeDataSessionInformation information = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);
            if (information == null)
            {
                SystemMonitor.OperationError("Failed to map session information for data provider.");
                _sessionInfo = DataSessionInfo.Empty;
                return;
            }
            else
            {
                _sessionInfo = information.Info;
            }

            if (_dataDelivery.SubscribeToData(_sessionInfo, true, new DataSubscriptionInfo(false, false, new TimeSpan[] { Period.Value })) == false)
            {
                SystemMonitor.OperationError("Failed to subscribe to bar data updates.");
                return;
            }

            RuntimeDataSessionInformation session = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);
            if (session != null && session.AvailableDataBarPeriods.Contains(_period.Value))
            {
                _dataDelivery.RequestDataHistoryUpdate(_sessionInfo, new DataHistoryRequest(_period.Value, _defaultHistoryBarsCount), false);
            }
        }