-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.axaml.cs
50 lines (42 loc) · 1.4 KB
/
App.axaml.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using AvaloniaMeadow.ViewModels;
using AvaloniaMeadow.Views;
using Meadow;
using Meadow.Foundation.ICs.IOExpanders;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Atmospheric;
using Meadow.Peripherals.Leds;
using Meadow.UI;
using System.Threading.Tasks;
namespace AvaloniaMeadow
{
public partial class App : AvaloniaMeadowApplication<Windows>
{
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
}
base.OnFrameworkInitializationCompleted();
}
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
LoadMeadowOS();
}
public override Task MeadowInitialize()
{
var expander = FtdiExpanderCollection.Devices[0];
var bme680 = new Bme680(expander.CreateSpiBus(), expander.Pins.C7);
Resolver.Services.Add(bme680);
var led = new Led(expander.Pins.C0);
Resolver.Services.Add<ILed>(led);
return Task.CompletedTask;
}
}
}