Something went wrong. Try again.
Modular scanner/radio client and multi-broadcast server. uniscan.dexrn.me
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556using System;using System.Threading.Tasks;using Avalonia.Controls;using Avalonia.Interactivity;using Shiki.Common.Identity;using UniScan.Network.Client.Serialization;using UniScan.Network.Data.SSR;
namespace UniScan.Client.App.Views.Remote.Device;
public partial class DevicePageView : UserControl, IAsyncDisposable{ private UIContextSubscriptionManager.ISubscription? _ssrContextSubscription; public DevicePageView() { InitializeComponent(); Loaded += OnLoaded; Unloaded += OnUnloaded; }
private async void OnUnloaded(object? sender, RoutedEventArgs e) { if (_ssrContextSubscription != null) { await _ssrContextSubscription.DisposeAsync();
if (DataContext is DevicePageViewModel vm) { vm.SSRViewModel.Node.Value = null; vm.SSRViewModel.NodeMap.Clear(); } } }
private async void OnLoaded(object? sender, RoutedEventArgs e) { if (DataContext is DevicePageViewModel vm) { Identifier ssrId = new("UniScan", "ssr", "context", "device"); if (vm.DeviceViewModel.Device.Parent.Socket.Connected) { _ssrContextSubscription = await vm.DeviceViewModel.Device.Parent.Socket.SubscribeToUIContextAsync(ssrId, new DeviceUIContextSubscribeArgs(vm.DeviceViewModel.Device.Identifier, vm.SSRViewModel.Identifier)); } } }
public async ValueTask DisposeAsync() { if (_ssrContextSubscription != null) { await _ssrContextSubscription.DisposeAsync(); } }}