Taken from: http://stackoverflow.com/questions/22619896/problems-with-system-threading-timer-in-pcl-profile-78-warnings Thank you Daniel Henry
Inheritance: IDisposable
コード例 #1
0
        /// <summary>
        ///     Creates a RasterizingLayer which rasterizes a layer for performance
        /// </summary>
        /// <param name="layer">The Layer to be rasterized</param>
        /// <param name="delayBeforeRasterize">Delay after viewport change to start rerasterising</param>
        /// <param name="renderResolutionMultiplier"></param>
        /// <param name="rasterizer">Rasterizer to use. null will use the default</param>
        /// <param name="overscanRatio">The ratio of the size of the rasterized output to the current viewport</param>
        /// <param name="onlyRerasterizeIfOutsideOverscan">
        ///     Set the rerasterization policy. false will trigger a Rerasterisation on
        ///     every viewport change. true will trigger a Rerasterisation only if the viewport moves outside the existing
        ///     rasterisation.
        /// </param>
        public RasterizingLayer(ILayer layer, int delayBeforeRasterize = 500, double renderResolutionMultiplier = 1,
            IRenderer rasterizer = null, double overscanRatio = 1, bool onlyRerasterizeIfOutsideOverscan = false)
        {
            if (overscanRatio < 1)
                throw new ArgumentException($"{nameof(overscanRatio)} must be >= 1", nameof(overscanRatio));

            _layer = layer;
            Name = layer.Name;
            _delayBeforeRasterize = delayBeforeRasterize;
            _renderResolutionMultiplier = renderResolutionMultiplier;
            _rasterizer = rasterizer;
            _timer = new Timer(TimerElapsed, null, _delayBeforeRasterize, int.MaxValue);
            _timer.Stop();
            _layer.DataChanged += LayerOnDataChanged;
            _cache = new MemoryProvider();
            _overscan = overscanRatio;
            _onlyRerasterizeIfOutsideOverscan = onlyRerasterizeIfOutsideOverscan;
        }
コード例 #2
0
ファイル: ImageLayer.cs プロジェクト: pauldendulk/Mapsui
 public ImageLayer(string layername)
 {
     Name = layername;
     StartFetchTimer = new Timer(StartFetchTimerElapsed, null, 500, int.MaxValue);
     NumberOfFeaturesReturned = 1;
 }
コード例 #3
0
ファイル: ImageLayer.cs プロジェクト: pauldendulk/Mapsui
        public override void ViewChanged(bool majorChange, BoundingBox extent, double resolution)
        {
            if (!Enabled) return;
            if (DataSource == null) return;
            if (!majorChange) return;

            NewExtent = extent;
            NewResolution = resolution;

            if (IsFetching)
            {
                NeedsUpdate = true;
                return;
            }
            StartFetchTimer.Dispose();
            StartFetchTimer = new Timer(StartFetchTimerElapsed, null, 500, int.MaxValue);
        }
コード例 #4
0
 public void AddFeatures(IEnumerable<IFeature> features)
 {
     var previousCache = _cache;
     _cache = ConvertToAnimatedItems(features.ToList(), previousCache, IdField);
     _startTimeAnimation = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
     if (_animation != null) StopAnimation();
     _animation = new Timer(AnimationCallback, this, 0, MillisecondsBetweenUpdates);
     _first = true;
 }
コード例 #5
0
 private void StopAnimation()
 {
     _animation.Stop();
     _animation.Dispose();
     _animation = null;
 }
コード例 #6
0
 public AnimatedPointsWithAutoUpdateLayer()
     : base(new DynamicMemoryProvider())
 {
     Style = new SymbolStyle {Fill = {Color = new Color(255, 215, 0, 200)}, SymbolScale = 0.9};
     _timer = new Timer(arg => UpdateData(), this, 0, 2000);
 }