void source_DataDownloadedEventToDataStore(OnlineEntrySource source)
        {
            source.DataDownloadedEvent -= new OnlineEntrySource.EntrySourceUpdateDelegate(source_DataDownloadedEventToDataStore);

            if (source.DownloadSucceeded)
            {
                foreach (string filePath in source.DownloadedTempFilesPaths)
                {
                    Manager.AddEntryFromLocalFile(filePath);
                }

                WinFormsHelper.BeginManagedInvoke(this, delegate()
                {
                    toolStripStatusLabel1.DisplayStyle = ToolStripItemDisplayStyle.Text;
                    toolStripStatusLabel1.Text         = "Download of [" + source.Uri.ToString() + "] successful.";
                });
            }
            else
            {
                WinFormsHelper.BeginManagedInvoke(this, delegate()
                {
                    toolStripStatusLabel1.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                    toolStripStatusLabel1.Text         = "Download of [" + source.Uri.ToString() + "] failed.";
                });
            }

            source.EndDownload(true);
            WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
        }
 void DataBarHistory_DataBarHistoryUpdateEvent(IDataBarHistoryProvider provider, DataBarUpdateType updateType, int updatedBarsCount)
 {
     if (updateType == DataBarUpdateType.Initial)
     {// Only executes on initial adding of many items.
         WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.GenericDelegate <bool, bool>(chartControl.MasterPane.FitDrawingSpaceToScreen), true, true);
     }
 }
Пример #3
0
        public void SynchronizeWithMasterPane()
        {
            if (_masterPane == null || _masterPaneSynchronizationMode == MasterPaneSynchronizationModeEnum.None)
            {
                return;
            }

            SystemMonitor.CheckThrow(_masterPaneSynchronizationMode == MasterPaneSynchronizationModeEnum.XAxis, "Mode not supported.");
            GraphicsWrapper.SynchronizeDrawingSpaceXAxis(_masterPane.GraphicsWrapper);

            this.YAxisLabelsPosition = _masterPane.YAxisLabelsPosition;

            //this.AutoScrollToEnd = _masterPane.AutoScrollToEnd;
            this.LimitedView = _masterPane.LimitedView;

            Crosshair.Visible = _masterPane.Crosshair.Visible;

            RectangleF screen = GraphicsWrapper.ActualSpaceToDrawingSpace(ActualDrawingSpaceArea);

            FitHorizontalAreaToScreen(screen);

            UpdateMasterSynchronizationState(true);

            WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(100), Refresh);
            //this.Invalidate();
        }
        /// <summary>
        /// Non UI thread.
        /// </summary>
        void UpdateMasterChart()
        {
            this.chartControl.Visible         = _session != null;
            toolStripButtonIndicators.Visible = _session != null;

            if (_session == null || _session.DataProvider == null)
            {
                return;
            }

            string name = _session.Info.Symbol.Name;

            if (CurrentDataBarProvider != null && CurrentDataBarProvider.Period.HasValue)
            {
                name += " [M" + CurrentDataBarProvider.Period.Value.TotalMinutes.ToString() + "]";
            }

            if (_session.DataProvider != null && _session.DataProvider.Quotes != null &&
                _session.DataProvider.Quotes.OperationalState == OperationalStateEnum.Operational)
            {
                name += ", " + GeneralHelper.ToString(_session.DataProvider.Quotes.Bid, _session.Info.ValueFormat) + " / " + GeneralHelper.ToString(_session.DataProvider.Quotes.Ask, _session.Info.ValueFormat);
                name += ", " + _session.DataProvider.DataBars.BarCount.ToString() + " bars";
            }
            else
            {
                name = name + ", " + _session.OperationalState.ToString();
            }

            if (_session.OperationalState != OperationalStateEnum.Operational)
            {
                name = name + ", " + _session.OperationalState.ToString();
            }

            WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.GenericDelegate <string>(chartControl.MasterPane.SetChartName), name);
        }
Пример #5
0
 /// <summary>
 /// NON UI Thread.
 /// </summary>
 public void SelectOrder(Order order)
 {
     if (this.IsHandleCreated)
     {
         WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.GenericDelegate <Order>(DoSelectOrder), order);
     }
 }
        private void toolStripMenuItemFromFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter      = "All supported|*.csv;*.hst|CSV (*.csv)|*.csv|HST (*.hst)|*.hst";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                _waitControl.Message = "Importing data, please wait.";
                _waitControl.SetActiveState(true);

                GeneralHelper.FireAndForget(delegate()
                {
                    string errors = string.Empty;

                    foreach (string filePath in ofd.FileNames)
                    {
                        if (DataStoreComponent.DataStore.AddEntryFromLocalFile(filePath) == null)
                        {
                            errors += "Failed to create entry from file [" + filePath + "]." + Environment.NewLine;
                        }
                    }

                    _waitControl.SetActiveState(false);
                    WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);

                    if (string.IsNullOrEmpty(errors) == false)
                    {
                        MessageBox.Show(errors, "Error(s) in Importing Data", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                });
            }
        }
Пример #7
0
        //void ParseLine(string line)
        //{
        //if (string.IsNullOrEmpty(line))
        //{
        //    return;
        //}

        //try
        //{
        //    string[] substrings = line.Split('|');

        //    if (substrings.Length < 4)
        //    {
        //        SystemMonitor.OperationError("Failed to parse tracer item line [" + line + ", Not enough substrings generated].");
        //        return;
        //    }

        //    TracerItem.TypeEnum type = (TracerItem.TypeEnum)Enum.Parse(typeof(TracerItem.TypeEnum), substrings[0]);

        //    long index = 0;
        //    long.TryParse(substrings[1], out index);

        //    DateTime time;
        //    try
        //    {
        //        string dateTime = substrings[2];
        //        string[] dateTimeParts = dateTime.Split('/');
        //        string[] subParts = dateTimeParts[2].Split(' ');
        //        TimeSpan timeSpan = TimeSpan.Parse(subParts[1]);

        //        time = new DateTime(int.Parse(subParts[0]), int.Parse(dateTimeParts[0]),
        //            int.Parse(dateTimeParts[1]), timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds);
        //    }
        //    catch(Exception ex2)
        //    {
        //        SystemMonitor.OperationError("Failed to parse tracer item line [" + line + ", " + ex2.Message + "].");
        //        time = DateTime.MinValue;
        //    }

        //    //if (DateTime.TryParse(substrings[2], out time) == false)
        //    //{
        //    //    time = DateTime.MinValue;
        //    //}

        //    TracerItem item = new TracerItem(type, time, index.ToString() + "  " + substrings[substrings.Length - 1]);
        //    _tracer.Add(item);

        //}
        //catch(Exception ex)
        //{
        //    SystemMonitor.OperationError("Failed to parse tracer item line [" + line + ", " + ex.Message + "].");
        //}
        //}

        private void toolStripButtonUpdate_Click(object sender, EventArgs e)
        {
            GeneralHelper.FireAndForget(delegate()
            {
                _watcher_Changed(null, new FileSystemEventArgs(WatcherChangeTypes.Created, _watcher.Path, _watcher.Filter));
                WinFormsHelper.BeginFilteredManagedInvoke(tracerControl1, tracerControl1.UpdateUI);
            });
        }
        public override void UnInitializeControl()
        {
            UnInitialize();

            WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);

            base.UnInitializeControl();
        }
        void _account_UpdateEvent(Account account)
        {
            if (this.DesignMode)
            {
                return;
            }

            WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
        }
Пример #10
0
        void _provider_AccountInfoUpdateEvent(IOrderSink provider, AccountInfo accountInfo)
        {
            if (((ISourceOrderExecution)provider).DefaultAccount != Account)
            {
                Account = ((ISourceOrderExecution)provider).DefaultAccount;
            }

            WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
        }
 void _controller_CurrentPeriodChangedEvent(ITimeControl control)
 {
     if (InvokeRequired)
     {
         WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
     }
     else
     {
         UpdateUI();
     }
 }
Пример #12
0
        void expertManager_AddedExpertContainerEvent(ExpertInformation container)
        {
            WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), new GeneralHelper.GenericDelegate <bool>(UpdateUI), true);

            GeneralHelper.DefaultDelegate newDelegate = delegate()
            {
                // Select the newly created expert.
                this.listViewExperts.SelectedIndices.Clear();
                if (listViewExperts.VirtualListSize > 0)
                {
                    this.listViewExperts.SelectedIndices.Add(listViewExperts.VirtualListSize - 1);
                }
            };

            WinFormsHelper.BeginManagedInvoke(this, newDelegate);
        }
Пример #13
0
 /// <summary>
 /// NON UI Thread.
 /// </summary>
 void Quote_QuoteUpdateEvent(IQuoteProvider provider)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
Пример #14
0
 void management_OrderUpdatedEvent(ITradeEntityManagement provider, AccountInfo account, Order[] orders, Order.UpdateTypeEnum[] updateType)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
Пример #15
0
 /// <summary>
 /// NON UI Thread.
 /// </summary>
 void history_OrdersAddedEvent(ITradeEntityManagement provider, AccountInfo account, IEnumerable <Order> order)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
Пример #16
0
 void Operator_SourcesUpdateEvent(SourceManagementComponent sourceOperator)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }
 void ExecutionSource_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum parameter2)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.DefaultDelegate(UpdateUI));
 }
 void TradeEntities_PositionsAddedEvent(ITradeEntityManagement provider, AccountInfo account, IEnumerable <IPosition> positions)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }
 void SessionManager_SessionUpdateEvent(ISourceAndExpertSessionManager sessionManager)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }
Пример #20
0
 void _dataProvider_OnValuesUpdateEvent(IQuoteProvider dataProvider)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
Пример #21
0
 void _executionAccount_UpdateEvent(Account accountInfo)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
Пример #22
0
 void expertManager_ExpertAssemblyAddedEvent(Assembly assembly)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), new GeneralHelper.GenericDelegate <bool>(UpdateUI), true);
 }
Пример #23
0
 void _dataProvider_QuoteUpdateEvent(IQuoteProvider provider)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }
Пример #24
0
 void expertManager_RemovedExpertContainerEvent(ExpertInformation container)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), new GeneralHelper.GenericDelegate <bool>(UpdateUI), true);
 }
 void TimeManagementToolStrip_OperationalStatusChangedEvent(IOperational parameter1, OperationalStateEnum previousState)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
        /// <summary>
        /// Non UI thread.
        /// </summary>
        void DoStepTo()
        {
            _timeControl.StepTo((int)numericUpDownSkip.Value);

            WinFormsHelper.BeginFilteredManagedInvoke(this, new GeneralHelper.GenericDelegate <bool>(UpdateUI), true);
        }
 void Adapters_ItemOperationalStatusChangedEvent(GenericContainer <IIntegrationAdapter> keeper, IIntegrationAdapter item)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, UpdateUI);
 }
 void combinedContainerControl_FocusedControlChangedEvent(CombinedContainerControl containerControl, CommonBaseControl control)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), new GeneralHelper.GenericDelegate <PlatformComponent>(UpdateFormText), control != null ? control.Tag as PlatformComponent : null);
 }
Пример #29
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);
        }
 void _provider_PositionUpdateEvent(IOrderSink provider, AccountInfo accountInfo, PositionInfo[] positionInfo)
 {
     WinFormsHelper.BeginFilteredManagedInvoke(this, TimeSpan.FromMilliseconds(250), UpdateUI);
 }