private void UnsubscribeTriggers() { if (_triggerAll != null) { _triggerAll.Dispose(); _triggerAll = null; } }
private void SubscribeTriggers() { UnsubscribeTriggers(); _triggerAll = new TriggerAll(_process.Id, Constants.CustomHeaderEventSourceName, Constants.TriggerHeaderCounterName); _triggerAll.OnCpu = d => UpdateTextBlock(trCpu, d.ToString() + "%"); _triggerAll.OnEventCounterCount = d => UpdateTextBlock(trCustomHeader, d.ToString()); _triggerAll.OnException = d => UpdateTextBlock(trException, d); _triggerAll.OnGcAllocation = d => UpdateTextBlock(trGcAlloc, $"{d}"); _triggerAll.OnHttpRequests = d => UpdateTextBlock(trHttpReq, $"{d}/sec"); _triggerAll.OnWorkingSet = d => UpdateTextBlock(trWorkingSet, $"{d} MB"); _triggerAll.Start(); }