Пример #1
0
        private void UpdateRulerBlocks()
        {
            if (MinimumTick == null || MaximumTick == null)
            {
                // Clear all block
                RulerBlocks = EmptyRulerBlockList;
            }
            else
            {
                long timeframe = MaximumTick.Value - MinimumTick.Value;
                System.Diagnostics.Debug.WriteLine("timeframe " + timeframe);
                int totalBlocks = (int)Math.Ceiling((double)(timeframe / EffectiveBlockTicks));
                System.Diagnostics.Debug.WriteLine("fefTicks " + EffectiveBlockTicks);
                System.Diagnostics.Debug.WriteLine("totalBlocks " + totalBlocks);
                System.Diagnostics.Debug.WriteLine("devidied " + (double)(timeframe / EffectiveBlockTicks));
                System.Diagnostics.Debug.WriteLine("math " + Math.Ceiling((double)(timeframe / EffectiveBlockTicks)));



                totalBlocks++;

                if (totalBlocks > 2000)
                {
                    Debug.WriteLine("Because we do not support virtualization for TimelineRulerControl yet the number of blocks was limit to 2000");
                    totalBlocks = 2000;
                }

                List <RulerBlockItem> blocks = new List <RulerBlockItem>();

                long spanFromStart = EffectiveBlockTicks;
                long prev          = MinimumTick.Value;

                for (int blockIdx = 0; blockIdx < totalBlocks; blockIdx++)
                {
                    long current = MinimumTick.Value + spanFromStart;

                    RulerBlockItem block = new RulerBlockItem();
                    block.Start = prev;
                    block.Span  = EffectiveBlockTicks;
                    //block.Text = prev.ToString();
                    blocks.Add(block);

                    prev          = current;
                    spanFromStart = spanFromStart + EffectiveBlockTicks;
                }

                RulerBlocks = blocks;
                System.Diagnostics.Debug.WriteLine(blocks.Count);
            }
        }
        private void UpdateRulerBlocks()
        {
            if (MinimumDate == null || MaximumDate == null)
            {
                // Clear all block
                RulerBlocks = EmptyRulerBlockList;
            }
            else
            {
                TimeSpan timeframe   = MaximumDate.Value - MinimumDate.Value;
                int      totalBlocks = (int)Math.Ceiling((double)(timeframe.Ticks / EffectiveBlockTimeSpan.Ticks));
                totalBlocks++;

                if (totalBlocks > 2000)
                {
                    Debug.WriteLine("Because we do not support virtualization for TimelineRulerControl yet the number of blocks was limit to 2000");
                    totalBlocks = 2000;
                }

                List <RulerBlockItem> blocks = new List <RulerBlockItem>();

                TimeSpan spanFromStart = EffectiveBlockTimeSpan;
                DateTime prev          = MinimumDate.Value;

                for (int blockIdx = 0; blockIdx < totalBlocks; blockIdx++)
                {
                    DateTime current = MinimumDate.Value.Add(spanFromStart);

                    RulerBlockItem block = new RulerBlockItem();
                    block.Start = prev;
                    block.Span  = EffectiveBlockTimeSpan;
                    //block.Text = prev.ToString();
                    blocks.Add(block);

                    prev          = current;
                    spanFromStart = spanFromStart.Add(EffectiveBlockTimeSpan);
                }

                RulerBlocks = blocks;
            }
        }
Пример #3
0
        private void UpdateRulerBlocks()
        {
            if (MinimumTick == null || MaximumTick == null)
            {
                // Clear all block
                RulerBlocks = EmptyRulerBlockList;
            }
            else
            {
                long timeframe = MaximumTick.Value - MinimumTick.Value;
                System.Diagnostics.Debug.WriteLine("timeframe " +  timeframe);
                int totalBlocks = (int)Math.Ceiling((double)(timeframe / EffectiveBlockTicks));
                System.Diagnostics.Debug.WriteLine("fefTicks " + EffectiveBlockTicks);
                System.Diagnostics.Debug.WriteLine("totalBlocks " + totalBlocks);
                System.Diagnostics.Debug.WriteLine("devidied " + (double)(timeframe / EffectiveBlockTicks));
                System.Diagnostics.Debug.WriteLine("math " + Math.Ceiling((double)(timeframe / EffectiveBlockTicks)));
                
                
                
                totalBlocks++;

                if (totalBlocks > 2000)
                {
                    Debug.WriteLine("Because we do not support virtualization for TimelineRulerControl yet the number of blocks was limit to 2000");
                    totalBlocks = 2000;
                }

                List<RulerBlockItem> blocks = new List<RulerBlockItem>();

                long spanFromStart = EffectiveBlockTicks;
                long prev = MinimumTick.Value;

                for (int blockIdx = 0; blockIdx < totalBlocks; blockIdx++)
                {
                    long current = MinimumTick.Value + spanFromStart;

                    RulerBlockItem block = new RulerBlockItem();
                    block.Start = prev;
                    block.Span = EffectiveBlockTicks;
                    //block.Text = prev.ToString();
                    blocks.Add(block);

                    prev = current;
                    spanFromStart = spanFromStart + EffectiveBlockTicks;
                }

                RulerBlocks = blocks;
                System.Diagnostics.Debug.WriteLine(blocks.Count);
            }
        }