public static void Start() { if (StepDiagram != null) { throw new Exception("Unable to start twice. Already listening. Call HookEngine.Stop after calling HookEngine.Start"); } activeWindowHandle = Win.GetActiveWindow(); StepDiagram = new StepDiagram(); cpuUsageCalculator = new CpuUsageCalculator(); currentProcessTimer = new Timer(CheckCpuUsage, null, 100, 100); HookEvents(); StepDiagram.AddTaskActive(WindowsEvents.GetActiveWindowTitle(), Win.GetForegroundWindow()); }
static void HookManager_WindowActivated(object sender, WindowActivatedEventArgs e) { StepDiagram.AddTaskActive(e.WindowName, e.Handle); }