Пример #1
0
        /// <summary>
        /// Handles the ItemAdded event of the libraryManager control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
        void libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
        {
            if (!FilterItem(e.Item))
            {
                return;
            }

            lock (_libraryChangedSyncLock)
            {
                if (LibraryUpdateTimer == null)
                {
                    LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
                                                              Timeout.Infinite);
                }
                else
                {
                    LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
                }

                var parent = e.Item.GetParent() as Folder;
                if (parent != null)
                {
                    _foldersAddedTo.Add(parent);
                }

                _itemsAdded.Add(e.Item);
            }
        }
Пример #2
0
        public FramesPerSecondMonitor(ITimerFactory timerFactory, IStartupPropertiesCache propertiesCache)
        {
            _updateFpsTracker = new FpsTracker(timerFactory.Create(), propertiesCache);
            _drawFpsTracker   = new FpsTracker(timerFactory.Create(), propertiesCache);

            _updateFpsTracker.Reset();
            _drawFpsTracker.Reset();
        }
Пример #3
0
        private void InitialiseLoopProperties()
        {
            _timer = _timerFactory.Create();
            _timer.Reset();

            //For FIXED_ADAPTIVE update time steps, we do not start at the smallest possible timestep. Here is hardcorded 120FPS
            var timeStep = _startUpPropertiesCache.User.UpdatePeriodType == UpdatePeriod.Fixed_Adaptive &&
                           _startUpPropertiesCache.User.FixedOrSmallestUpdateTimeStepInSeconds < 1.0f / 120.0f ?
                           1.0f / 120.0f : _startUpPropertiesCache.User.FixedOrSmallestUpdateTimeStepInSeconds;

            _loopProperties = new LoopProperties
            {
                UpdatePeriodType = _startUpPropertiesCache.User.UpdatePeriodType,
                ProcessFractionalUpdatesBeforeDraw        = _startUpPropertiesCache.User.ProcessFractionalUpdatesBeforeDraw,
                SmallestFixedUpdateTimeStepInSeconds      = _startUpPropertiesCache.User.FixedOrSmallestUpdateTimeStepInSeconds,
                FixedUpdateTimeStepInSeconds              = timeStep,
                DoNotDrawFrameUnlessThereHasBeenOneUpdate = _startUpPropertiesCache.User.RequireAtleastOneUpdatePerDraw,
                Running          = false,
                TimeOfLastUpdate = 0.0,
                TimeOfLastDraw   = 0.0,
                HasThereBeenAnUpdateSinceTheLastDraw = false
            };

            _updater = _updatePeriodFactory.Create(_loopProperties.UpdatePeriodType);
        }
Пример #4
0
        public AutoAddPlugin(ILogger <AutoAddPlugin> logger,
                             ITimerFactory timerFactory,
                             IAutoAddRepository repository,
                             IFolderScanner folderScanner)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException("timerFactory");
            }
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }
            if (folderScanner == null)
            {
                throw new ArgumentNullException("folderScanner");
            }

            _logger        = logger;
            _repository    = repository;
            _folderScanner = folderScanner;
            _timer         = timerFactory.Create(5000, CheckFolders);
        }
        public SonarQubeIssuesProvider(ISonarQubeService sonarQubeService, string sonarQubeProjectKey, ITimerFactory timerFactory,
                                       ILogger logger)
        {
            if (sonarQubeService == null)
            {
                throw new ArgumentNullException(nameof(sonarQubeService));
            }
            if (string.IsNullOrWhiteSpace(sonarQubeProjectKey))
            {
                throw new ArgumentNullException(nameof(sonarQubeProjectKey));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            this.sonarQubeService    = sonarQubeService;
            this.sonarQubeProjectKey = sonarQubeProjectKey;
            this.logger = logger;

            refreshTimer           = timerFactory.Create();
            refreshTimer.AutoReset = true;
            refreshTimer.Interval  = MillisecondsToWaitBetweenRefresh;
            refreshTimer.Elapsed  += OnRefreshTimerElapsed;

            initialFetchCancellationTokenSource = new CancellationTokenSource();
            this.initialFetch = Task.Factory.StartNew(DoInitialFetchAsync, initialFetchCancellationTokenSource.Token);
            refreshTimer.Start();
        }
Пример #6
0
        public void Run()
        {
            LoadCachedAddress();

            _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(1));
            ((ConnectManager)_connectManager).Start();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="eventType"></param>
        public void QueueItem(BaseItem item, EventType eventType)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (_queueTimer == null)
            {
                _queueTimer = _timerFactory.Create(OnQueueTimerCallback, null, TimeSpan.FromMilliseconds(20000),
                                                   Timeout.InfiniteTimeSpan);
            }
            else
            {
                _queueTimer.Change(TimeSpan.FromMilliseconds(20000), Timeout.InfiniteTimeSpan);
            }

            var users = Plugin.Instance.PluginConfiguration.TraktUsers;

            if (users == null || users.Length == 0)
            {
                return;
            }

            // we need to process the video for each user
            foreach (var user in users.Where(x => _traktApi.CanSync(item, x)))
            {
                // we have a match, this user is watching the folder the video is in. Add to queue and they
                // will be processed when the next timer elapsed event fires.
                var libraryEvent = new LibraryEvent {
                    Item = item, TraktUser = user, EventType = eventType
                };
                _queuedEvents.Add(libraryEvent);
            }
        }
        public SonarQubeIssuesProvider(ISonarQubeService sonarQubeService,
                                       IActiveSolutionBoundTracker solutionBoundTracker,
                                       ITimerFactory timerFactory)
        {
            if (sonarQubeService == null)
            {
                throw new ArgumentNullException(nameof(sonarQubeService));
            }
            if (solutionBoundTracker == null)
            {
                throw new ArgumentNullException(nameof(solutionBoundTracker));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }

            this.sonarQubeService    = sonarQubeService;
            this.solutionBoundTacker = solutionBoundTracker;
            this.solutionBoundTacker.SolutionBindingChanged += OnSolutionBoundChanged;

            refreshTimer           = timerFactory.Create();
            refreshTimer.AutoReset = true;
            refreshTimer.Interval  = MillisecondsToWaitBetweenRefresh;
            refreshTimer.Elapsed  += OnRefreshTimerElapsed;

            if (this.solutionBoundTacker.IsActiveSolutionBound)
            {
                SynchronizeSuppressedIssues();
                refreshTimer.Start();
            }
        }
        public SonarQubeIssuesProvider(ISonarQubeService sonarQubeService,
                                       string sonarQubeProjectKey,
                                       ITimerFactory timerFactory)
        {
            if (sonarQubeService == null)
            {
                throw new ArgumentNullException(nameof(sonarQubeService));
            }
            if (string.IsNullOrWhiteSpace(sonarQubeProjectKey))
            {
                throw new ArgumentNullException(nameof(sonarQubeProjectKey));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }

            this.sonarQubeService    = sonarQubeService;
            this.sonarQubeProjectKey = sonarQubeProjectKey;

            refreshTimer           = timerFactory.Create();
            refreshTimer.AutoReset = true;
            refreshTimer.Interval  = MillisecondsToWaitBetweenRefresh;
            refreshTimer.Elapsed  += OnRefreshTimerElapsed;

            this.initialFetch = Task.Factory.StartNew(SynchronizeSuppressedIssues);
            refreshTimer.Start();
        }
Пример #10
0
        public void SetOptions(ConnectivityManagerOptions options)
        {
            Options = options ?? throw new InvalidOperationException("Please set valid options.");

            Timer = _timerFactory.Create(new TaskReference(IsNetworkAvailableInternalAsync), Options.TimerInterval);

            TaskDeferral = new TaskDeferral <bool>();
        }
Пример #11
0
 public PositionService(SpotService spotService, ITimerFactory timerFactory, DataGenerationSettings settings,
                        IHubContext <UpdateHub> updateHub)
 {
     _spotService = spotService;
     _settings    = settings;
     _updateHub   = updateHub;
     _timer       = timerFactory.Create(UpdatePositions);
 }
Пример #12
0
        public UserSelectorPage(IWizardViewModel wizard, ITimerFactory timerFactory)
            : base(wizard)
        {
            Timer       = timerFactory.Create(1000);
            Timer.Tick += Timer_Tick;

            UserCollection = new SmartCollection <UserViewModel>();
        }
Пример #13
0
        void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
        {
            DisposeTimer();

            if (_appHost.HasPendingRestart)
            {
                _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
            }
        }
Пример #14
0
        private void StartTimer()
        {
            if (!IsEnabled)
            {
                return;
            }

            _timerFactory.Create(CheckDeadlock, 1000).Start();
        }
Пример #15
0
        public ConnectivityTests()
        {
            _timeFactory  = Substitute.For <ITimerFactory>();
            _logManager   = Substitute.For <ILogManager>();
            _connectivity = Substitute.For <IConnectivity>();
            _timerMock    = Substitute.For <ITimer>();

            _logManager.GetLogger <BaseInternetConnectionManager>().Returns(info => Substitute.For <ILogger>());
            _timeFactory.Create(Arg.Any <TaskReference>(), Arg.Any <int>()).Returns(info => _timerMock);
            _internetManager = new TestBaseInternetConnectionManagerObject(_logManager, _connectivity, _timeFactory);
        }
Пример #16
0
        public RssPlugin(ILogger<RssPlugin> logger, ITimerFactory timerFactory, IRssRepository rssRepository, IFeedChecker feedChecker)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (timerFactory == null) throw new ArgumentNullException("timerFactory");
            if (rssRepository == null) throw new ArgumentNullException("rssRepository");
            if (feedChecker == null) throw new ArgumentNullException("feedChecker");

            _logger = logger;
            _rssRepository = rssRepository;
            _timer = timerFactory.Create(60000, CheckFeeds);
            _feedChecker = feedChecker;
        }
Пример #17
0
 public WatchDog(ITimerFactory timerFactory, IClock clock)
 {
     if (timerFactory == null)
     {
         throw new ArgumentNullException(nameof(timerFactory));
     }
     _clock = clock
              ?? throw new ArgumentNullException(nameof(clock));
     _timer         = timerFactory.Create(TimeSpan.FromSeconds(CheckIntervalSeconds));
     _timer.Ticked += Timer_Ticked;
     _timer.Start();
 }
Пример #18
0
 public DatagramReassembler(ITimerFactory timerFactory, ArrayPool <byte> bufferPool)
 {
     if (timerFactory == null)
     {
         throw new ArgumentNullException(nameof(timerFactory));
     }
     this._timer              = timerFactory.Create(TimeSpan.FromSeconds(10), this.TimerCallback);
     this._bufferPool         = bufferPool ?? throw new ArgumentNullException(nameof(bufferPool));
     this._fragmentsPool      = s_DefaultFragmentsPool;
     this._fragments          = this._fragmentsPool.Rent(127);
     this._lastSetWasDisposed = true;
 }
Пример #19
0
        public ThreadRunner(Func<bool> executionCondition, ThreadResult result, TimingSettings settings, BenchmarkState sharedState, Action test, ITimerFactory timerFactory)
        {
            this.ExecutionCondition = executionCondition;
            this.Result = result;
            this.Settings = settings;
            this.SharedState = sharedState;
            this.Test = test;

            Timer = timerFactory.Create();

            thread = new Thread(Run);
            thread.IsBackground = true;
        }
Пример #20
0
        private void ResetExpireCachedDevicesTimer()
        {
            if (IsDisposed)
            {
                return;
            }

            if (_ExpireCachedDevicesTimer == null)
            {
                _ExpireCachedDevicesTimer = _timerFactory.Create(this.ExpireCachedDevices, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            }

            _ExpireCachedDevicesTimer.Change(60000, System.Threading.Timeout.Infinite);
        }
Пример #21
0
 public void RestartBroadcastTimer(TimeSpan dueTime, TimeSpan period)
 {
     lock (_timerLock)
     {
         if (_BroadcastTimer == null)
         {
             _BroadcastTimer = _timerFactory.Create(OnBroadcastTimerCallback, null, dueTime, period);
         }
         else
         {
             _BroadcastTimer.Change(dueTime, period);
         }
     }
 }
Пример #22
0
        private void StartTimer(TimerInfo item, TimeSpan dueTime)
        {
            var timer = _timerFactory.Create(TimerCallback, item.Id, dueTime, TimeSpan.Zero);

            if (_timers.TryAdd(item.Id, timer))
            {
                _logger.Info("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
            }
            else
            {
                timer.Dispose();
                _logger.Warn("Timer already exists for item {0}", item.Id);
            }
        }
Пример #23
0
        public AutoAddPlugin(ILogger<AutoAddPlugin> logger,
            ITimerFactory timerFactory,
            IAutoAddRepository repository,
            IFolderScanner folderScanner)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (timerFactory == null) throw new ArgumentNullException("timerFactory");
            if (repository == null) throw new ArgumentNullException("repository");
            if (folderScanner == null) throw new ArgumentNullException("folderScanner");

            _logger = logger;
            _repository = repository;
            _folderScanner = folderScanner;
            _timer = timerFactory.Create(5000, CheckFolders);
        }
Пример #24
0
        public void StartAutomaticProgress(ITimerFactory timerFactory, PlaybackProgressInfo progressInfo)
        {
            lock (_progressLock)
            {
                _lastProgressInfo = progressInfo;

                if (_progressTimer == null)
                {
                    _progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000);
                }
                else
                {
                    _progressTimer.Change(1000, 1000);
                }
            }
        }
Пример #25
0
        public void Start(ITransport transport, TimeSpan interval)
        {
            _transport = transport;
            if (_timer != null)
            {
                throw new Exception("Timer already started.");
            }

            var versionRequest = new UasAutopilotVersionRequest();

            _transport.SendMessage(versionRequest);

            _timer       = _timerFactory.Create(interval);
            _timer.Tick += _timer_Tick;
            _timer.Start();
        }
Пример #26
0
        private void Start()
        {
            _logger.LogDebug("Starting NAT discovery");
            if (_natManager == null)
            {
                _natManager              = new NatManager(_logger, _httpClient);
                _natManager.DeviceFound += NatUtility_DeviceFound;
                _natManager.StartDiscovery();
            }

            _timer = _timerFactory.Create(ClearCreatedRules, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));

            _deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered;

            _lastConfigIdentifier = GetConfigIdentifier();
        }
Пример #27
0
        /// <summary>
        /// Mesaures the execution time for the code under test.
        /// </summary>
        /// <param name="action">Code under test for which you want to measure the execution time.</param>
        /// <param name="numberOfIterations">
        /// Number of times the code under test should be executed. If this value is not null then it overrides
        /// the value provided using <see cref="ChronometerOptions"/>.
        /// </param>
        /// <returns>
        /// Returns average elapsed time in milliseconds. If UseNormalizedMean property of
        /// <see cref="ChronometerOptions"/> is set then returns the normalized elapsed time in milliseconds.
        /// </returns>
        public double Measure(Action action, int?numberOfIterations = null)
        {
            if (!Options.AllowMeasurementsUnderDebugMode && _debugModeDetector.IsInDebugMode())
            {
                throw new InvalidOperationException(
                          "Under the current Chronometer configuration, measurements are not allowed when the process is in debug mode. Please set AllowMeasurementsUnderDebugMode chronometer option to true if you would like measurements when the process is under debug mode.");
            }

            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            if (numberOfIterations.HasValue && numberOfIterations.Value < 1)
            {
                throw new ArgumentException(Properties.Resources.NumberOfIterationsLessThan1ExceptionMessage,
                                            "numberOfIterations");
            }

            _memoryOptimizer.Optimize();

            _performanceOptimizer.Optimize();

            //Warm up
            if (Options.Warmup)
            {
                action();
            }

            var timer = _timerFactory.Create(Options);

            numberOfIterations = numberOfIterations ?? Options.NumberOfInterations;
            var timings = new List <double>();

            for (var i = 0; i < numberOfIterations; i++)
            {
                timer.Restart();
                action();
                timer.Stop();

                timings.Add(timer.Elapsed.TotalMilliseconds);
            }

            _performanceOptimizer.Revert();

            return(Options.UseNormalizedMean ? _normalizedMeanCalculator.Calculate(timings) : timings.Average());
        }
        public TelemetryTimer(ITelemetryDataRepository telemetryRepository, ITimerFactory timerFactory)
        {
            if (telemetryRepository == null)
            {
                throw new ArgumentNullException(nameof(telemetryRepository));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }

            this.telemetryRepository = telemetryRepository;

            timer           = timerFactory.Create();
            timer.AutoReset = true;
            timer.Interval  = MillisecondsBeforeFirstUpload;
        }
Пример #29
0
        public ImageProcessor(ILogger logger,
                              IServerApplicationPaths appPaths,
                              IFileSystem fileSystem,
                              IJsonSerializer jsonSerializer,
                              IImageEncoder imageEncoder,
                              Func <ILibraryManager> libraryManager, ITimerFactory timerFactory, Func <IMediaEncoder> mediaEncoder)
        {
            _logger         = logger;
            _fileSystem     = fileSystem;
            _jsonSerializer = jsonSerializer;
            _imageEncoder   = imageEncoder;
            _libraryManager = libraryManager;
            _mediaEncoder   = mediaEncoder;
            _appPaths       = appPaths;

            ImageEnhancers             = new IImageEnhancer[] { };
            _saveImageSizeTimer        = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);
            ImageHelper.ImageProcessor = this;

            Dictionary <Guid, ImageSize> sizeDictionary;

            try
            {
                sizeDictionary = jsonSerializer.DeserializeFromFile <Dictionary <Guid, ImageSize> >(ImageSizeFile) ??
                                 new Dictionary <Guid, ImageSize>();
            }
            catch (FileNotFoundException)
            {
                // No biggie
                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }
            catch (IOException)
            {
                // No biggie
                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error parsing image size cache file", ex);

                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }

            _cachedImagedSizes = new ConcurrentDictionary <Guid, ImageSize>(sizeDictionary);
        }
Пример #30
0
        public ImageProcessor(ILogger logger,
                              IServerApplicationPaths appPaths,
                              IFileSystem fileSystem,
                              IJsonSerializer jsonSerializer,
                              IImageEncoder imageEncoder,
                              int maxConcurrentImageProcesses, Func <ILibraryManager> libraryManager, ITimerFactory timerFactory)
        {
            _logger         = logger;
            _fileSystem     = fileSystem;
            _jsonSerializer = jsonSerializer;
            _imageEncoder   = imageEncoder;
            _libraryManager = libraryManager;
            _appPaths       = appPaths;

            ImageEnhancers      = new List <IImageEnhancer>();
            _saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);

            Dictionary <Guid, ImageSize> sizeDictionary;

            try
            {
                sizeDictionary = jsonSerializer.DeserializeFromFile <Dictionary <Guid, ImageSize> >(ImageSizeFile) ??
                                 new Dictionary <Guid, ImageSize>();
            }
            catch (FileNotFoundException)
            {
                // No biggie
                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }
            catch (IOException)
            {
                // No biggie
                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error parsing image size cache file", ex);

                sizeDictionary = new Dictionary <Guid, ImageSize>();
            }

            _cachedImagedSizes = new ConcurrentDictionary <Guid, ImageSize>(sizeDictionary);
            _logger.Info("ImageProcessor started with {0} max concurrent image processes", maxConcurrentImageProcesses);
            _imageProcessingSemaphore = new SemaphoreSlim(maxConcurrentImageProcesses, maxConcurrentImageProcesses);
        }
Пример #31
0
        private void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
        {
            if (!FilterItem(e.Item))
            {
                return;
            }

            lock (_libraryChangedSyncLock)
            {
                if (LibraryUpdateTimer == null)
                {
                    LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
                }
                else
                {
                    LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
                }
            }
        }
Пример #32
0
        void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
        {
            if (e.SaveReason == UserDataSaveReason.PlaybackProgress)
            {
                return;
            }

            lock (_syncLock)
            {
                if (UpdateTimer == null)
                {
                    UpdateTimer = _timerFactory.Create(UpdateTimerCallback, null, UpdateDuration,
                                                       Timeout.Infinite);
                }
                else
                {
                    UpdateTimer.Change(UpdateDuration, Timeout.Infinite);
                }

                List <IHasUserData> keys;

                if (!_changedItems.TryGetValue(e.UserId, out keys))
                {
                    keys = new List <IHasUserData>();
                    _changedItems[e.UserId] = keys;
                }

                keys.Add(e.Item);

                var baseItem = e.Item as BaseItem;

                // Go up one level for indicators
                if (baseItem != null)
                {
                    var parent = baseItem.GetParent();

                    if (parent != null)
                    {
                        keys.Add(parent);
                    }
                }
            }
        }
Пример #33
0
        internal ResourceMonitor(
            string resourceName,
            IHealthCheckStrategy verificationStrategy,
            IResourceMonitorConfiguration configuration,
            ILogger <ResourceMonitor> logger,
            bool isCritical,
            ITimerFactory timerFactory)
        {
            if (resourceName == null)
            {
                throw new ArgumentNullException(nameof(resourceName));
            }
            if (verificationStrategy == null)
            {
                throw new ArgumentNullException(nameof(verificationStrategy));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _verificationStrategy = verificationStrategy;
            _logger       = logger;
            ResourceName  = resourceName;
            Configuration = configuration;
            IsCritical    = isCritical;

            _timer = timerFactory.Create(OnTimer);
            if (_timer == null)
            {
                throw new InvalidOperationException("Expected TimerFactory to return a Timer.");
            }
        }
Пример #34
0
 public BenchmarkState(ITimerFactory timerFactory)
 {
     TimerFromBeginning = timerFactory.Create();
 }