Table of Contents

Class SingleInstanceActivator

Namespace
Acuit.Pinpoint.Windows
Assembly
Acuit.Pinpoint.Windows.dll

A single-instance application activator.

public class SingleInstanceActivator : IDisposable
Inheritance
SingleInstanceActivator
Implements
Inherited Members

Constructors

SingleInstanceActivator(string)

Initializes a new instance of the SingleInstanceActivator class.

public SingleInstanceActivator(string applicationIdentifier)

Parameters

applicationIdentifier string

A unique identifier for this application, which is used to find and activate another running instance. This is typically a GUID.

Exceptions

ArgumentNullException

applicationIdentifier is null.

Properties

IsFirstInstance

Gets whether this is the first instance of this application.

public bool IsFirstInstance { get; }

Property Value

bool

Methods

ActivateFirstInstance()

Sends a signal to the first running application instance, requesting that it activate itself.

public void ActivateFirstInstance()

Dispose()

Closes and releases all resources used by the object.

public void Dispose()

Dispose(bool)

Closes and releases all resources used by the SingleInstanceActivator.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true when this is in response to a call to Dispose().

Remarks

Derived classes should override this when they have any resources that should be disposed.

OnInstanceActivationRequested()

Called when instance activation is requested from another starting instance. This will be called from a background thread.

protected virtual void OnInstanceActivationRequested()

Remarks

The default behavior raises InstanceActivationRequested, and if it is not canceled, activates this instance.

StartActivator()

Starts the single-instance activator, which watches for signals from other started application instances, activating this instance as they are received.

public void StartActivator()

Exceptions

InvalidOperationException

This is not the first instance of this application.

Events

InstanceActivationRequested

Raised when instance activation is requested from another starting instance. This will be raised from a background thread.

public event EventHandler<CancelEventArgs> InstanceActivationRequested

Event Type

EventHandler<CancelEventArgs>