Ejemplo n.º 1
0
 private void Tick(object?state)
 {
     lock (_lock)
     {
         var processIds = ProcessExtensions.GetProcessIds();
         Collections.ModifyObservableCollection(_processes, processIds);
     }
 }
Ejemplo n.º 2
0
    /// <inheritdoc />
    public ProcessWatcher()
    {
        var interval = IoC.Get <LoaderConfig>().ReloadedProcessListRefreshInterval;

        _processes = new ObservableCollection <int>(ProcessExtensions.GetProcessIds());
        _processes.CollectionChanged += ProcessesChanged;
        _timer = new Timer(Tick, null, TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(interval));
    }