C# Class ACAT.Lib.Core.Utility.WindowActivityMonitor

Monitors the activity of the foreground window and notifies event subscribers if the focues of the active window changes, OR if the focus changes from one control to another inside the active window Also supports a heartbeat where subscribers can be periodically notified of the current focused window/ window element
Exibir arquivo Open project: brlima94/acat-localization

Public Methods

Method Description
Dispose ( ) : void

Disposes resources

GetActiveWindowAsync ( ) : void

Asyncrhonously forces an event to be raised regardless of whether focus changed or not

IsDifferent ( AutomationElement ele1, AutomationElement ele2 ) : bool

Compares the two automation elements and returns if they are identical or not

Pause ( ) : void

Pauses the activity monitoring. No events will be raised when paused

Resume ( ) : void

Resumes window activity monitoring.

Start ( ) : bool

Starts activity monitoring

Private Methods

Method Description
GetActiveWindow ( ) : void
GetForegroundWindowInfo ( ) : ACAT.Lib.Core.Utility.WindowActivityMonitorInfo
GetProcessForWindow ( IntPtr hwnd ) : Process
_timer_Tick ( object sender, EventArgs e ) : void

The timer function to check the currently focused window and to see if focus changed or not

getActiveWindow ( bool flag = false ) : void
release ( Object syncObj ) : void

Releases the synch object

tryEnter ( Object syncObj ) : bool

Uses Monitor to see if it can enter

Method Details

Dispose() public static method

Disposes resources
public static Dispose ( ) : void
return void

GetActiveWindowAsync() public static method

Asyncrhonously forces an event to be raised regardless of whether focus changed or not
public static GetActiveWindowAsync ( ) : void
return void

IsDifferent() public static method

Compares the two automation elements and returns if they are identical or not
public static IsDifferent ( AutomationElement ele1, AutomationElement ele2 ) : bool
ele1 System.Windows.Automation.AutomationElement first element
ele2 System.Windows.Automation.AutomationElement second element
return bool

Pause() public static method

Pauses the activity monitoring. No events will be raised when paused
public static Pause ( ) : void
return void

Resume() public static method

Resumes window activity monitoring.
public static Resume ( ) : void
return void

Start() public static method

Starts activity monitoring
public static Start ( ) : bool
return bool