Pistitium.Mouser 1.0.5

dotnet add package Pistitium.Mouser --version 1.0.5                
NuGet\Install-Package Pistitium.Mouser -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pistitium.Mouser" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pistitium.Mouser --version 1.0.5                
#r "nuget: Pistitium.Mouser, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pistitium.Mouser as a Cake Addin
#addin nuget:?package=Pistitium.Mouser&version=1.0.5

// Install Pistitium.Mouser as a Cake Tool
#tool nuget:?package=Pistitium.Mouser&version=1.0.5                

Pistitium.Mouser

Pistitium.Mouser Allows to:

  • Start MouseEventMonitor:

    • Randomly changes the mouse position at a default or given interval
    • Randomly perform a Left Button Click at a default or given interval
    • While running will keep the computer awake
    • Will detect mouse move by user and immediately Stop.
  • Stop MouseEventMonitor:

    • Mouse control returns to normal
    • Computer is free to go into Sleep Mode
  • MouseEventMonitor:

    • Automatically detect monitor resolution (it is recommended to minimize open windows in the main monitor)

    • Constructors:

      • Default

        • public MouseEventMonitor()
          • Will change mouse position randomly every 15 seconds
          • Will perform a Left Button Click every 55 seconds
      • public MouseEventMonitor(TimeSpan mouseMoveInterval, TimeSpan leftButtonClickInterval)

        • Will change mouse position every mouseMoveInterval
        • Will perform a Left Button Click every leftButtonClickInterval
        • Will perform a Right Button Click every rightButtonClickInterval

Installation

Install via Visual Studio Manage Nuget Packages... or download:

https://www.nuget.org/packages/Pistitium.Mouser

.NET CLI
> dotnet add package Pistitium.Mouser --version 1.0.X

Usage

///////////////////////////////////////////////////////////
// Sample of how to use Mouser
///////////////////////////////////////////////////////////
using Pistitium.Win32Library;

private MouseEventMonitor mouseEventMonitor;

public void MouserTest()
{
    // Using Default Constructor
    mouseEventMonitor = new MouseEventMonitor();
    // Using Custom Constructor
    mouseEventMonitor = new MouseEventMonitor(new TimeSpan(0, 0, 20), new TimeSpan(0, 1, 10));
    
    // If you want to monitor move, left, and right click notification use the following constructor
    mouseEventMonitor = new MouseEventMonitor(new TimeSpan(0, 0, 15), new TimeSpan(0, 0, 55), new TimeSpan(0, 0, 20));
	MouseEventMonitor.BroadcastRightButtonClick += new MouseEventMonitor.MouseRightButtonClickNotification(OnMouseRightButtonClickNotification);
    
    MouseEventMonitor.BroadcastMouseMove += new MouseEventMonitor.MouseMoveNotification(OnMouseMoveNotification);
    MouseEventMonitor.BroadcastMouseMoveByUser += new 	 MouseEventMonitor.MouseMoveByUserNotification(OnMouseMoveByUserNotification);
    MouseEventMonitor.BroadcastLeftButtonClick += new 		 MouseEventMonitor.MouseLeftButtonClickNotification(OnMouseLeftButtonClickNotification);
    
    StartMouseController();
}

private void OnMouseMoveNotification(int x, int y)
{
    // your code here
}

private void OnMouseLeftButtonClickNotification(int x, int y) 
{
    // your code here
}

private void OnMouseRightButtonClickNotification(int x, int y)
{
    // your code here
}

private void OnMouseMoveByUserNotification(int x, int y)
{
    // The user moved the mouse
    StopMouseController();
}

// Start monitoring
private void StartMouseController()
{
    mouseEventMonitor.Start();
}

// When you are done call:
private void StopMouseController()
{
    mouseEventMonitor.Stop();
}

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 141 4/1/2024
1.0.4 137 3/24/2024
1.0.2 146 2/10/2024

Updated Readme with sample code.