示例#1
0
        private void OnTicked(object sender, double timeOffset)
        {
            this.Dispatcher.BeginInvoke(new System.Action(() =>
            {
                _currentTimeOffset = timeOffset;

                var isNowInTimeFrame = _endTimeOffset >= _currentTimeOffset && _startTimeOffset <= _currentTimeOffset;
                if (!_wasNowInTimeFrame && isNowInTimeFrame)
                {
                    // "now" has come into current time frame, add all active jobs
                    foreach (var job in _jobManager.GetAllJobs().Where(j => !j.IsFinished))
                    {
                        if (!_activeJobViewMap.ContainsKey(job))
                        {
                            this.AddJob(job);
                        }
                    }

                    this.UpdateAllViewPositions();
                }

                _wasNowInTimeFrame = isNowInTimeFrame;

                this.UpdateCanvasSize();
            }));
        }
        private void OnTicked(object sender, double timeOffset)
        {
            this.Dispatcher.BeginInvoke(new System.Action(() =>
            {
                _currentTimeOffset = timeOffset;

                var isNowInTimeFrame = _endTimeOffset >= _currentTimeOffset && _startTimeOffset <= _currentTimeOffset;
                if (isNowInTimeFrame)
                {
                    if (!_wasNowInTimeFrame)
                    {
                        // "now" has come into current time frame, add all active jobs
                        foreach (var job in _jobManager.GetAllJobs().Where(j => !j.IsFinished))
                        {
                            this.TryAddJob(job);
                        }
                    }

                    this.InvalidateMeasure();
                }

                _wasNowInTimeFrame = isNowInTimeFrame;
            }));
        }