protected void Initialize(BasicIndicator indicator)
 {
     _indicator = indicator;
     _indicator.IndicatorCalculatedEvent += new Indicator.IndicatorCalculatedDelegate(_indicator_IndicatorCalculatedEvent);
     _indicator.UI.IndicatorUIUpdatedEvent += new BasicIndicatorUI.IndicatorUIUpdatedDelegate(UI_IndicatorUIUpdatedEvent);
     _indicator.ics = this;
 }
        /// <summary>
        /// 
        /// </summary>
        public BasicIndicatorUI(BasicIndicator indicator)
        {
            Console.WriteLine(indicator.Name + "," + (indicator.DataProvider != null).ToString());

            _indicator = indicator;
            foreach (string name in indicator.ResultSetNames)
            {
                _outputResultSetsPens.Add(name, null);
            }
        }
        private void listViewIndicatorTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewIndicatorTypes.SelectedItems.Count > 0)
            {
                string name = listViewIndicatorTypes.SelectedItems[0].Tag as string;

                _pendingIndicator = (BasicIndicator)FxpaIndicatorManager.Instance.GetIndicatorCloneByName(FxpaIndicatorManager.IndicatorGroups.Fxpa, name);

                foreach (string setName in GeneralHelper.EnumerableToArray<string>(_pendingIndicator.UI.OutputResultSetsPens.Keys))
                {
                    _pendingIndicator.UI.OutputResultSetsPens[setName] = Pens.WhiteSmoke;
                }

                indicatorControl1.IsReadOnly = true;
                indicatorControl1.Indicator = _pendingIndicator;
            }
            else
            {
                indicatorControl1.Indicator = null;
                _pendingIndicator = null;
            }

            UpdateUI();
        }
        private void buttonNew_Click(object sender, EventArgs e)
        {
            if (listViewIndicatorTypes.SelectedItems.Count == 0 || _pendingIndicator == null)
            {
                return;
            }

            _pendingIndicator.Initialize(_session.DataProvider);
            _session.Add(_pendingIndicator);

            if (AddIndicatorEvent != null)
            {
                AddIndicatorEvent(_pendingIndicator, GetSelectedPane());
            }

            UpdateUI();

            // Select the newly created indicator.
            this.listViewIndicators.Items[listViewIndicators.Items.Count - 1].Selected = true;
            this.listViewIndicators.Focus();

            _pendingIndicator = null;

            // Invoke the creation of a new _pendingIndicator
            //listViewIndicatorTypes_SelectedIndexChanged(sender, e);

            // Select the newly created indicator.
            if (listViewIndicators.Items.Count > 0)
            {
                listViewIndicators.Items[listViewIndicators.Items.Count - 1].Selected = true;
            }

            listViewIndicators.Focus();
        }
        public void control_AddIndicatorEvent(BasicIndicator indicator, ChartPane pane)
        {
            IndicatorChartSeries series = new IndicatorChartSeries(indicator.Name, indicator);

            if (pane == null)
            {
                pane = chartControl.CreateSlavePane(indicator.Name, SubChartPane.MainChartPaneSyncModeEnum.XAxis, this.Height / 4);
                pane.RightMouseButtonSelectionMode = ChartPane.SelectionModeEnum.HorizontalZoom;
                pane.Add(series);
            }
            else
            {
                pane.Add(series);
            }
        }
 protected override void OnRemovedFromChart()
 {
     if (_indicator != null)
     {
         _indicator.IndicatorCalculatedEvent -= new Indicator.IndicatorCalculatedDelegate(_indicator_IndicatorCalculatedEvent);
         _indicator = null;
     }
 }
        /// <summary>
        /// 
        /// </summary>
        public IndicatorChartSeries(string name, BasicIndicator indicator)
        {
            Name = name;

            Initialize(indicator);
        }