-
Notifications
You must be signed in to change notification settings - Fork 0
Initialize
Yannik Höflich edited this page Sep 3, 2023
·
2 revisions
MatrixWeb has two interface to initialize, both service and screen: IInitializable and IAsyncInitializable.
You can already tell the diffrence by the name. IAsyncInitializable initializes asynchronous.
Some services have to be initialized, for example the ConfigService. Thats why you can only use them in the void Init() or Task InitAsync() method.
IInitializable:
public class MyService : IService, IInitializable{
public ConfigLayout ConfigLayout { get; } = ConfigLayout.Empty;
public InitResult Init(){
// your code.
return InitResult.Success;
}
}IAsyncInitializable:
public class MyService : IService, IAsyncInitializable{
public ConfigLayout ConfigLayout { get; } = ConfigLayout.Empty;
public async Task<InitResult> InitAsync(){
// your code.
return InitResult.Success;
}
}