Class ProgramController
Base class for all graphical programs in Sociall Distant.
Inherited Members
Namespace: SociallyDistant.Core.Programs
Assembly: SociallyDistant.Framework.dll
Syntax
public abstract class ProgramController
Constructors
ProgramController(ProgramContext)
Creates a new instance of the ProgramController class.
Declaration
protected ProgramController(ProgramController.ProgramContext context)
Parameters
Type | Name | Description |
---|---|---|
ProgramController.ProgramContext | context | Information about the running program. |
Properties
CurrentDirectory
Gets or sets the program's current working directory.
Declaration
protected string CurrentDirectory { get; set; }
Property Value
Type | Description |
---|---|
string |
FileSystem
Gets the device's filesystem.
Declaration
protected IVirtualFileSystem FileSystem { get; }
Property Value
Type | Description |
---|---|
IVirtualFileSystem |
Process
Gets the process this program is bound to.
Declaration
protected ISystemProcess Process { get; }
Property Value
Type | Description |
---|---|
ISystemProcess |
User
Gets the user running the program.
Declaration
protected IUser User { get; }
Property Value
Type | Description |
---|---|
IUser |
Methods
CloseWindow(int)
Close the program.
Declaration
protected void CloseWindow(int exitCode = 0)
Parameters
Type | Name | Description |
---|---|---|
int | exitCode | An optional exit status to kill the process with. Default is 0, indicating no error. |
Create<T>(ISystemProcess, IWindow, IConsoleDriver, string[])
Spawn a program.
Declaration
public static T Create<T>(ISystemProcess process, IWindow window, IConsoleDriver console, string[] args) where T : ProgramController
Parameters
Type | Name | Description |
---|---|---|
ISystemProcess | process | The process to bind the program to. |
IWindow | window | The window to spawn the program in. |
IConsoleDriver | console | A console the program may write to. |
string[] | args | A list of command-line arguments passed to the program. |
Returns
Type | Description |
---|---|
T | A reference to the spawned program. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
Find<T>()
Find a running program of the given type.
Declaration
public static T? Find<T>() where T : ProgramController
Returns
Type | Description |
---|---|
T | The most-recentrly-opened instance of |
Type Parameters
Name | Description |
---|---|
T | Any type deriving from ProgramController. |
Main()
Called when the program is opened.
Declaration
protected abstract void Main()