public void SuspendTabs(bool freeze = true) { var affectedPids = new List <int> ( ); foreach (var pid in Pids) { try { if (!TryGetProcess(pid, out var process)) { continue; } affectedPids.Add(pid); if (freeze) { process.Suspend( ); } else { process.Resume( ); } } catch (Exception e) { _errorSubject.OnNext(new FreezeError(pid, exception: e)); } } SetTabsState(freeze ? ChromeTabsState.Suspended(affectedPids) : ChromeTabsState.Resumed(affectedPids)); }
public ChromeMonitor(FreezerSettings settings) { Settings = settings; Pids = ImmutableList <int> .Empty; TabsState = ChromeTabsState.Resumed(Enumerable.Empty <int> ( )); State = ChromeMonitorState.Stopped; _extractor = new ChromeTabsPidExtractor( ); }