Class ApplicationBootstrapper
This bootstrapper is made especially to host dapplo "apps". You can protect your application from starting multiple instances by specifying a Mutex-ID
Inheritance
Inherited Members
Namespace:Dapplo.Addons.Bootstrapper
Assembly:Dapplo.Addons.Bootstrapper.dll
Syntax
public class ApplicationBootstrapper : StartupShutdownBootstrapper, IApplicationBootstrapper, IBootstrapper, IServiceLocator, IMefServiceLocator, IServiceExporter, IServiceRepository, IDependencyProvider, IDisposable
Constructors
| Improve this Doc View SourceApplicationBootstrapper(String, String, Boolean)
Create the application bootstrapper, for the specified application name The mutex is created and locked in the contructor, and some of your application logic might depend on this.
Declaration
public ApplicationBootstrapper(string applicationName, string mutexId = null, bool global = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | applicationName | Name of your application |
System.String | mutexId | string with an ID for your mutex, preferably a Guid. If the mutex can't be locked, the bootstapper will not be able to "bootstrap". |
System.Boolean | global | Is the mutex a global or local block (false means only in this Windows session) |
Properties
| Improve this Doc View SourceApplicationName
Returns the application name for this bootstrapper
Declaration
public string ApplicationName { get; }
Property Value
Type | Description |
---|---|
System.String |
IsMutexLocked
Returns if the Mutex is locked, in other words if this ApplicationBootstrapper can continue This also returns true if no mutex is used
Declaration
public bool IsMutexLocked { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceDispose(Boolean)
Implementation of the dispose pattern
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | bool |
Overrides
| Improve this Doc View SourceInitializeAsync(CancellationToken)
Initialize the application bootstrapper, this makes sure the configuration and languages can be loaded
Declaration
public override Task<bool> InitializeAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<System.Boolean> | bool with value of IsInitialized |
Overrides
| Improve this Doc View SourceRunAsync(CancellationToken)
Override the run to prevent starting when the mutex isn't locked
Declaration
public override Task<bool> RunAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<System.Boolean> |