Пример #1
0
        /// <summary>Отрисовка всего графика </summary>
        /// <param name="graphic">Полотно</param>
        protected void PaintAll()
        {
            if (!Candels.IssetCollection())
            {
                return;
            }
            GetMinMax();
            //Отрисовка свечей в приоритете
            Candels.PaintCandles();

            RightPrices.Paint(RightPrices.Panel.Params.MaxPrice, RightPrices.Panel.Params.MinPrice);

            if (ActiveCandles.ActiveCandle1.NotIsNull() && ActiveCandles.ActiveCandle2.NotIsNull())
            {
                if (ActiveCandles.ActiveCandle1.dataCandle.Index > ActiveCandles.ActiveCandle2.dataCandle.Index)
                {
                    GHorVolumes.activeCandle1 = ActiveCandles.ActiveCandle1;
                    GHorVolumes.activeCandle2 = ActiveCandles.ActiveCandle2;
                }
                else
                {
                    GHorVolumes.activeCandle1 = ActiveCandles.ActiveCandle2;
                    GHorVolumes.activeCandle2 = ActiveCandles.ActiveCandle1;
                }
                if (TypeHorVolume == 3)
                {
                    GHorVolumes.activeCandle2 = null;
                }
            }

            CandleInfo LastCandle = null;

            Levels.Panel.Clear();
            var leftCandle  = Candels.AllDataPaintedCandle.Last();
            var rightCandle = Candels.AllDataPaintedCandle.First();

            //Паинт
            foreach (var dCandle in Candels.AllDataPaintedCandle.ToArray())
            {
                dCandle.PrevCandleInfo = LastCandle;
                Volumes.PaintByCandle(dCandle);
                GHorVolumes.EachCandle(dCandle);
                Levels.PaintByCandle(dCandle, leftCandle, rightCandle, Candels.AllDataPaintedCandle.Count);
                Indicators.ForEach((ind) =>
                {
                    if (ind is Indicator)
                    {
                        ((Indicator)ind).EachFullCandle(dCandle);
                    }
                });
                LastCandle = dCandle;
            }

            LevelsOrders.Paint();
            Levels.Paint();

            ActualizeActiveCandle();
            if (ThreadPaintHotVol.NotIsNull())
            {
                ThreadPaintHotVol.Abort();
                ThreadPaintHotVol = null;
            }
            if (ThreadPaintHotVol.IsNull())
            {
                ThreadPaintHotVol = MThread.InitThread(() =>
                {
                    GHorVolumes.CollectionCandles = Candels.AllDataPaintedCandle;
                    if (TypeHorVolume == 1)
                    {
                        if (ActiveCandles.ActiveCandle1.NotIsNull())
                        {
                            GHorVolumes.PaintHorVolEachBlock(ActiveCandles.ActiveCandle1.dataCandle.Index + 1);
                        }
                    }
                    else if (TypeHorVolume == 2 || TypeHorVolume == 3)
                    {
                        GHorVolumes.PaintHorVolByPeriodCandleDelta(false, false);
                    }
                    else if (TypeHorVolume == 5)
                    {
                        GHorVolumes.PaintHorVolByPeriodCandleDelta(false, true, limitHorVol);
                    }
                    else if (TypeHorVolume == 4)
                    {
                        GHorVolumes.PaintCollectionHVol();
                    }
                    ThreadPaintHotVol = null;
                });
            }
            ToCanvas();
        }