44
55namespace OpenShock . Desktop . ModuleBase ;
66
7+ /// <summary>
8+ /// The main base class for all desktop modules.
9+ /// </summary>
710public abstract class DesktopModuleBase
811{
12+ /// <summary>
13+ /// Icon path for the module, used in navigation and other UI components.
14+ /// </summary>
15+ [ Obsolete ( "Use Icon property instead. This property will be removed in a future version." ) ]
916 public virtual string ? IconPath { get ; } = null ;
17+
18+ /// <summary>
19+ /// Main icon for the module, used in navigation and other UI components.
20+ /// </summary>
21+ public virtual IconOneOf ? Icon { get ; set ; } = null ;
22+
23+ /// <summary>
24+ /// Main interface for modules to interact with OpenShock Desktop.
25+ /// </summary>
1026 public IModuleInstanceManager ModuleInstanceManager { get ; private set ; } = null ! ;
11-
27+
28+ /// <summary>
29+ /// A collection of navigation components that this module provides.
30+ /// These components will be displayed in the main navigation menu of the application.
31+ /// </summary>
1232 public abstract IReadOnlyCollection < NavigationItem > NavigationComponents { get ; }
1333
34+ /// <summary>
35+ /// Alternative to <see cref="NavigationComponents"/> for modules that have a single main component.
36+ /// </summary>
37+ public virtual Type ? RootComponent { get ; } = null ;
38+
39+ /// <summary>
40+ /// This method is called by OpenShock Desktop to set the context for the module. Do not call this method by yourself.
41+ /// </summary>
42+ /// <param name="moduleInstanceManager"></param>
1443 public void SetContext ( IModuleInstanceManager moduleInstanceManager )
1544 {
1645 ModuleInstanceManager = moduleInstanceManager ;
1746 }
1847
48+ /// <summary>
49+ /// During startup, this method is called to allow the module to perform any necessary setup.
50+ /// </summary>
51+ /// <returns>A <see cref="Task"/> that represents the completion of any asynchronous setup operations required by the module.</returns>
1952 public virtual Task Setup ( )
2053 {
2154 return Task . CompletedTask ;
2255 }
2356
57+ /// <summary>
58+ /// Called after <see cref="Setup"/> to allow the module to start any necessary services or perform additional initialization.
59+ /// </summary>
60+ /// <returns>A <see cref="Task"/> that represents the completion of any startup logic or initialization performed by the module.</returns>
2461 public virtual Task Start ( )
2562 {
2663 return Task . CompletedTask ;
2764 }
2865
66+ /// <summary>
67+ /// Module service provider.
68+ /// You can use the <see cref="ModuleInjectAttribute"/> to resolve services that are registered for this module within blazor components.
69+ ///
70+ /// <example>
71+ /// <code>
72+ /// [ModuleInject] private IModuleConfig<SomeModuleConfig> ModuleConfig { get; set; } = null!;
73+ /// </code>
74+ /// </example>
75+ ///
76+ /// </summary>
2977 public IServiceProvider ModuleServiceProvider { get ; protected set ; } = new ServiceCollection ( ) . BuildServiceProvider ( ) ;
3078}
0 commit comments