1
+ using System . ComponentModel ;
1
2
using System . Reflection ;
2
3
using Avalonia . Controls ;
3
4
using Avalonia . Markup . Xaml . Converters ;
@@ -15,6 +16,51 @@ namespace HotAvalonia;
15
16
/// </summary>
16
17
public static class AvaloniaHotReloadContext
17
18
{
19
+ /// <inheritdoc cref="Create(AvaloniaProjectLocator)"/>
20
+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
21
+ public static IHotReloadContext Create ( )
22
+ => Create ( new AvaloniaProjectLocator ( ) ) ;
23
+
24
+ /// <summary>
25
+ /// Creates a hot reload context for the current environment.
26
+ /// </summary>
27
+ /// <remarks>
28
+ /// This method is opinionated and represents the "best" way to create
29
+ /// a hot reload context for the current environment.
30
+ /// However, the specific details of what constitutes "best" are subject to change.
31
+ /// </remarks>
32
+ /// <param name="projectLocator">The project locator used to find source directories of assemblies.</param>
33
+ /// <returns>A hot reload context for the current environment.</returns>
34
+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
35
+ public static IHotReloadContext Create ( AvaloniaProjectLocator projectLocator )
36
+ {
37
+ IHotReloadContext appDomainContext = FromAppDomain ( AppDomain . CurrentDomain , projectLocator ) ;
38
+ IHotReloadContext assetContext = ForAssets ( AvaloniaServiceProvider . Current , projectLocator ) ;
39
+ return HotReloadContext . Combine ( [ appDomainContext , assetContext ] ) ;
40
+ }
41
+
42
+ /// <inheritdoc cref="CreateLite(AvaloniaProjectLocator)"/>
43
+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
44
+ public static IHotReloadContext CreateLite ( )
45
+ => CreateLite ( new AvaloniaProjectLocator ( ) ) ;
46
+
47
+ /// <summary>
48
+ /// Creates a lightweight hot reload context for the current environment.
49
+ /// </summary>
50
+ /// <remarks>
51
+ /// This method is opinionated and represents the "best" lightweight way to create
52
+ /// a hot reload context for the current environment. However, the specific details
53
+ /// of what constitutes "best" are subject to change.
54
+ /// </remarks>
55
+ /// <param name="projectLocator">The project locator used to find source directories of assemblies.</param>
56
+ /// <returns>A lightweight hot reload context for the current environment.</returns>
57
+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
58
+ public static IHotReloadContext CreateLite ( AvaloniaProjectLocator projectLocator )
59
+ {
60
+ IHotReloadContext appDomainContext = FromAppDomain ( AppDomain . CurrentDomain , projectLocator ) ;
61
+ return appDomainContext ;
62
+ }
63
+
18
64
/// <inheritdoc cref="ForAssets(IServiceProvider)"/>
19
65
public static IHotReloadContext ForAssets ( )
20
66
=> ForAssets ( AvaloniaServiceProvider . Current ) ;
0 commit comments