diff --git a/App.axaml b/App.axaml new file mode 100644 index 0000000..89a7161 --- /dev/null +++ b/App.axaml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/App.axaml.cs b/App.axaml.cs new file mode 100644 index 0000000..8b7ca73 --- /dev/null +++ b/App.axaml.cs @@ -0,0 +1,23 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; + +namespace SddpViewer; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow(); + } + + base.OnFrameworkInitializationCompleted(); + } +} \ No newline at end of file diff --git a/DiscoveredDeviceViewModel.cs b/DiscoveredDeviceViewModel.cs new file mode 100644 index 0000000..897ebc8 --- /dev/null +++ b/DiscoveredDeviceViewModel.cs @@ -0,0 +1,53 @@ +namespace SddpViewer +{ + using System; + using System.Threading.Tasks; + + using CommunityToolkit.Mvvm.ComponentModel; + + using Rssdp; + + public partial class DiscoveredDeviceViewModel : ObservableObject + { + private readonly DiscoveredSsdpDevice device; + + public DiscoveredDeviceViewModel(DiscoveredSsdpDevice device) + { + this.device = device; + } + + /// + /// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice. + /// + public string NotificationType => this.device.NotificationType; + + /// + /// Sets or returns the universal service name (USN) of the device. + /// + public string Usn => this.device.Usn; + + /// + /// Sets or returns a URL pointing to the device description document for this device. + /// + public Uri DescriptionLocation => this.device.DescriptionLocation; + + /// + /// Sets or returns the length of time this information is valid for (from the time). + /// + public TimeSpan CacheLifetime => this.device.CacheLifetime; + + /// + /// Sets or returns the date and time this information was received. + /// + public DateTimeOffset AsAt => this.device.AsAt; + + [ObservableProperty] + private string _friendlyName = ""; + + public async Task GetFurtherInformationAsync() + { + var ssdpDevice = await this.device.GetDeviceInfo().ConfigureAwait(false); + FriendlyName = ssdpDevice.FriendlyName; + } + } +} \ No newline at end of file diff --git a/MainWindow.axaml b/MainWindow.axaml new file mode 100644 index 0000000..76c9f27 --- /dev/null +++ b/MainWindow.axaml @@ -0,0 +1,36 @@ + + + + + + + + + +