|
12 | 12 | using System.Reflection;
|
13 | 13 | using WpfUsbStickApp.CustomAntDevice;
|
14 | 14 |
|
15 |
| -namespace WpfUsbStickApp.ViewModels |
| 15 | +namespace WpfUsbStickApp |
16 | 16 | {
|
17 | 17 | internal class MainWindowViewModel
|
18 | 18 | {
|
| 19 | + private readonly IHost _host; |
| 20 | + |
19 | 21 | public DeviceCapabilities DeviceCapabilities { get; }
|
20 | 22 | public string ProductDescription { get; }
|
21 | 23 | public uint SerialNumber { get; }
|
22 | 24 | public string HostVersion { get; }
|
23 |
| - |
24 |
| - private readonly IHost _host; |
25 |
| - |
26 | 25 | public AntCollection AntDevices { get; }
|
27 |
| - public static Stream AntImage => AntDevice.AntImage; |
| 26 | + public static Stream? AntImage => typeof(AntDevice).Assembly.GetManifestResourceStream("SmallEarthTech.AntPlus.Images.AntPlus.png"); |
28 | 27 |
|
29 | 28 | public MainWindowViewModel()
|
30 | 29 | {
|
@@ -56,15 +55,15 @@ public MainWindowViewModel()
|
56 | 55 | HostVersion = radio.Version;
|
57 | 56 |
|
58 | 57 | // log app info
|
59 |
| - var antAssemblies = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Where(asm => asm.Name!.StartsWith("Ant")); |
| 58 | + var antAssemblies = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Where(asm => asm.Name!.Contains("Ant")); |
60 | 59 | var logger = _host.Services.GetRequiredService<ILogger<App>>();
|
61 | 60 | logger.LogInformation("{App}", Assembly.GetExecutingAssembly().GetName().FullName);
|
62 | 61 | foreach (var asm in antAssemblies)
|
63 | 62 | {
|
64 | 63 | logger?.LogInformation("{AntAssembly}", asm.FullName);
|
65 | 64 | }
|
66 | 65 |
|
67 |
| - // create the device collection |
| 66 | + // create the device collection and start scanning for broadcasting ANT devices |
68 | 67 | AntDevices = _host.Services.GetRequiredService<AntCollection>();
|
69 | 68 | _ = AntDevices.StartScanning();
|
70 | 69 | }
|
|
0 commit comments