-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathComposition.cs
33 lines (27 loc) · 927 Bytes
/
Composition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ReSharper disable UnusedMember.Local
// ReSharper disable UnusedMember.Global
// ReSharper disable RedundantNameQualifier
// ReSharper disable ArrangeTypeMemberModifiers
namespace AvaloniaApp;
using Clock.Models;
using Clock.ViewModels;
using Pure.DI;
using Views;
using static Pure.DI.Lifetime;
internal partial class Composition
{
void Setup() => DI.Setup()
// Provides the composition root for main window
.Root<MainWindow>(nameof(MainWindow))
// Provides the composition root for Clock view model
.Root<IClockViewModel>(nameof(ClockViewModel))
// View Models
.Bind().As(Singleton).To<ClockViewModel>()
// Models
.Bind().To<Log<TT>>()
.Bind().To(_ => TimeSpan.FromSeconds(1))
.Bind().As(Singleton).To<Clock.Models.Timer>()
.Bind().As(PerBlock).To<SystemClock>()
// Infrastructure
.Bind().To<Dispatcher>();
}