Interface IAppInstanceController
- Assembly
- VpnHood.AppUi.Hosting.Desktop.Daemon.dll
Defines the running instance, the one process on the machine that holds the app, as the commands start, stop and look at it.
public interface IAppInstanceController
Remarks
It is a systemd unit on Linux and a service on Windows; each platform answers in its own terms. The Show calls
print for a person and return only an exit code.
Properties
NotRunningHint
Gets the sentence a person reads when nothing is running: what it is, and how to start it.
string NotRunningHint { get; }
Property Value
Methods
IsRunning(CancellationToken)
Gets whether the instance is running.
Task<bool> IsRunning(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.- InvalidOperationException
A system tool the platform runs could not be started.
Restart(CancellationToken)
Restarts the instance.
Task<int> Restart(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.- Win32Exception
On Windows, the service control manager refused.
- TimeoutException
On Windows, the service did not stop or start in time.
- InvalidOperationException
A system tool could not be started, or the instance could not be registered or started again.
ShowOfflineLog(bool, int, CancellationToken)
Prints what the platform keeps of the log itself, for when the service gives none, as for a start that failed before the app opened its log.
Task<int> ShowOfflineLog(bool follow, int lines, CancellationToken cancellationToken)
Parameters
followbooltrue to follow the log as it grows, where the platform can; Windows prints what it has.
linesintThe number of the last lines to print.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.- InvalidOperationException
A system tool the platform runs could not be started.
ShowStatus(CancellationToken)
Prints the instance's status for a person.
Task<int> ShowStatus(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.- InvalidOperationException
A system tool the platform runs could not be started.
Start(bool, CancellationToken)
Starts the instance.
Task Start(bool mayRegister, CancellationToken cancellationToken)
Parameters
mayRegisterbooltrue to register a missing instance on the way, behind a prompt, where the app registers its instance itself, as on Windows; a start nobody asked for, as the tray's at sign-in, may not.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- Win32Exception
On Windows, the service control manager refused.
- OperationCanceledException
cancellationTokenwas canceled.- DaemonNotRunningException
The instance is not registered, and
mayRegisteris false.- InvalidOperationException
The instance could not start; the message says why.
- TimeoutException
The instance did not start in time.
Stop(CancellationToken)
Stops the instance.
Task<int> Stop(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
Exceptions
- OperationCanceledException
cancellationTokenwas canceled.- TimeoutException
On Windows, the service did not stop in time.
- InvalidOperationException
A system tool the platform runs could not be started.