-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSliceViewModel.cs
More file actions
55 lines (44 loc) · 1.82 KB
/
Copy pathSliceViewModel.cs
File metadata and controls
55 lines (44 loc) · 1.82 KB
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
51
52
53
54
55
using CommunityToolkit.Mvvm.ComponentModel;
using SDRIQStreamer.FlexRadio;
namespace SDRIQStreamer.App;
/// <summary>
/// Presentation wrapper around <see cref="SliceInfo"/>.
/// </summary>
public partial class SliceViewModel : ObservableObject
{
public SliceInfo Slice { get; private set; }
public int DaxIqChannel { get; private set; }
public string DisplayLabel => Slice.DisplayLabel;
public string ClientStation => Slice.ClientStation;
public bool HasDaxIqChannel => DaxIqChannel > 0;
// Clean, summarized fields for the Launch-page slice list (issue #28):
// "Slice X | band (freq) | DAX IQ n | DAX RX n".
public string SliceLabel => $"Slice {Slice.Letter}";
public string BandFreqDisplay => HamBands.BandFreq(Slice.FreqMHz);
/// <summary>DAX-IQ (panadapter) channel label, e.g. "DAX IQ 1" (empty when none).</summary>
public string DaxIqDisplay => HasDaxIqChannel ? $"DAX IQ {DaxIqChannel}" : string.Empty;
/// <summary>DAX RX audio channel label, e.g. "DAX RX 1" (empty when none).</summary>
public string DaxRxDisplay => Slice.DaxAudioChannel > 0 ? $"DAX RX {Slice.DaxAudioChannel}" : string.Empty;
[ObservableProperty]
private bool _isSkimmerRunning;
public SliceViewModel(SliceInfo slice, int daxIqChannel)
{
Slice = slice;
DaxIqChannel = daxIqChannel;
}
public void Update(SliceInfo updated)
{
Slice = updated;
OnPropertyChanged(nameof(DisplayLabel));
OnPropertyChanged(nameof(BandFreqDisplay));
OnPropertyChanged(nameof(DaxRxDisplay));
}
public void UpdateDaxIqChannel(int daxIqChannel)
{
if (DaxIqChannel == daxIqChannel)
return;
DaxIqChannel = daxIqChannel;
OnPropertyChanged(nameof(HasDaxIqChannel));
OnPropertyChanged(nameof(DaxIqDisplay));
}
}