/// <summary>
        /// Functional constructor.
        /// </summary>
        public SourceManagementComponentControl(SourceManagementComponent integrationOperator)
            : base(integrationOperator)
        {
            InitializeComponent();

            this.Name = Operator.Name;

            Operator.SourcesUpdateEvent += new SourceManagementComponent.SourcesUpdateDelegate(Operator_SourcesUpdateEvent);

            // We need to create early.
            this.Tag = integrationOperator;
            this.CreateControl();
        }
Пример #2
0
        /// <summary>
        /// Helper.
        /// </summary>
        protected bool GetSourcePath(ComponentId sourceId, out List <ArbiterClientId?> sourcePath)
        {
            SystemMonitor.CheckError(sourceId != _dataStoreSourceInfo.ComponentId, "Data store source has no path.");
            SystemMonitor.CheckError(sourceId != _backtestingExecutionSourceInfo.ComponentId, "Local execution source has no path.");

            // Go around the messaging mechanism for this one, since it seems to overload the system somehow.
            SourceManagementComponent management = (SourceManagementComponent)Platform.GetFirstComponentByType(typeof(SourceManagementComponent));

            if (management == null)
            {
                sourcePath = null;
                return(false);
            }

            SourceInfo?info = management.GetSourceInfo(sourceId);

            if (info.HasValue == false)
            {
                sourcePath = null;
                return(false);
            }

            sourcePath = info.Value.TransportInfo.CreateRespondingClientList();
            return(true);

            //sourcePath = null;

            //SourcesUpdateMessage response = this.SendAndReceive<SourcesUpdateMessage>(
            //    new GetSourceInfoMessage(sourceId));

            //if (response == null || response.OperationResult == false)
            //{
            //    return false;
            //}

            //if (response.Sources.Count > 0)
            //{
            //    if (response.Sources[0].TransportInfo != null)
            //    {
            //        sourcePath = response.Sources[0].TransportInfo.CreateRespondingClientList();
            //    }
            //    else
            //    {
            //        sourcePath = null;
            //    }

            //    return true;
            //}

            //return false;
        }
 void Operator_SourcesUpdateEvent(SourceManagementComponent sourceOperator)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }