Add support to show/hide alert tone widgets

pull/1/head
php 1 year ago
parent ab67de1668
commit 61df187dcd

@ -14,7 +14,7 @@
<TextBlock Text="{Binding ChannelName}" FontWeight="Bold" Foreground="White" FontSize="14" Grid.Row="0"/>
<TextBlock Text="{Binding SystemName}" Foreground="LightGray" FontSize="12" Grid.Row="1"/>
<TextBlock Text="{Binding TGID}" Foreground="LightGray" FontSize="12" Grid.Row="2"/>
<TextBlock Text="{Binding LastSrcId}" Foreground="LightGray" FontSize="12" Grid.Row="2"/>
<Button Content="PTT" Width="80" Margin="0,5,0,0" Background="Green" Foreground="White"
HorizontalAlignment="Left" Grid.Row="3" Click="PTTButton_Click"/>

@ -29,7 +29,7 @@ namespace WhackerLinkConsoleV2.Controls
{
public string ChannelName { get; set; }
public string SystemName { get; set; }
public string TGID { get; set; }
public string LastSrcId { get; set; } = "0";
public event EventHandler<ChannelBox> PTTButtonClicked;
@ -48,14 +48,14 @@ namespace WhackerLinkConsoleV2.Controls
}
}
public ChannelBox(SelectedChannelsManager selectedChannelsManager, string channelName, string systemName, string tgid)
public ChannelBox(SelectedChannelsManager selectedChannelsManager, string channelName, string systemName)
{
InitializeComponent();
DataContext = this;
_selectedChannelsManager = selectedChannelsManager;
ChannelName = channelName;
SystemName = $"System: {systemName}";
TGID = $"TGID: {tgid}";
LastSrcId = $"Last SRC: {LastSrcId}";
UpdateBackground();
MouseLeftButtonDown += ChannelBox_MouseLeftButtonDown;
}

@ -140,7 +140,7 @@ namespace WhackerLinkConsoleV2
{
foreach (var channel in zone.Channels)
{
var channelBox = new ChannelBox(_selectedChannelsManager, channel.Name, channel.System, channel.Tgid);
var channelBox = new ChannelBox(_selectedChannelsManager, channel.Name, channel.System);
if (_settingsManager.ChannelPositions.TryGetValue(channel.Name, out var position))
{
@ -170,6 +170,8 @@ namespace WhackerLinkConsoleV2
}
}
if (_settingsManager.ShowAlertTones && Codeplug != null)
{
foreach (var alertPath in _settingsManager.AlertToneFilePaths)
{
var alertTone = new AlertTone(alertPath)
@ -192,6 +194,7 @@ namespace WhackerLinkConsoleV2
ChannelsCanvas.Children.Add(alertTone);
}
}
AdjustCanvasHeight();
}
@ -204,6 +207,8 @@ namespace WhackerLinkConsoleV2
{
_settingsManager.ShowSystemStatus = widgetSelectionWindow.ShowSystemStatus;
_settingsManager.ShowChannels = widgetSelectionWindow.ShowChannels;
_settingsManager.ShowAlertTones = widgetSelectionWindow.ShowAlertTones;
GenerateChannelWidgets();
_settingsManager.SaveSettings();
}

@ -29,6 +29,8 @@ namespace WhackerLinkConsoleV2
public bool ShowSystemStatus { get; set; } = true;
public bool ShowChannels { get; set; } = true;
public bool ShowAlertTones { get; set; } = true;
public string LastCodeplugPath { get; set; } = null;
public Dictionary<string, ChannelPosition> ChannelPositions { get; set; } = new Dictionary<string, ChannelPosition>();
@ -49,6 +51,7 @@ namespace WhackerLinkConsoleV2
{
ShowSystemStatus = loadedSettings.ShowSystemStatus;
ShowChannels = loadedSettings.ShowChannels;
ShowAlertTones = loadedSettings.ShowAlertTones;
LastCodeplugPath = loadedSettings.LastCodeplugPath;
ChannelPositions = loadedSettings.ChannelPositions ?? new Dictionary<string, ChannelPosition>();
SystemStatusPositions = loadedSettings.SystemStatusPositions ?? new Dictionary<string, ChannelPosition>();

@ -5,7 +5,8 @@
<StackPanel Margin="20">
<TextBlock Text="Select Widgets to Display:" FontWeight="Bold" Margin="0,0,0,10" />
<CheckBox x:Name="SystemStatusCheckBox" Content="System Status" IsChecked="True" />
<CheckBox x:Name="ChannelCheckBox" Content="Channel" IsChecked="True" />
<CheckBox x:Name="ChannelCheckBox" Content="Channels" IsChecked="True" />
<CheckBox x:Name="AlertToneCheckBox" Content="Alert Tones" IsChecked="True" />
<Button Content="Apply" Width="80" Margin="0,20,0,0" HorizontalAlignment="Center" Click="ApplyButton_Click" />
</StackPanel>
</Window>

@ -26,6 +26,7 @@ namespace WhackerLinkConsoleV2
{
public bool ShowSystemStatus { get; private set; } = true;
public bool ShowChannels { get; private set; } = true;
public bool ShowAlertTones { get; private set; } = true;
public WidgetSelectionWindow()
{
@ -36,6 +37,7 @@ namespace WhackerLinkConsoleV2
{
ShowSystemStatus = SystemStatusCheckBox.IsChecked ?? false;
ShowChannels = ChannelCheckBox.IsChecked ?? false;
ShowAlertTones = AlertToneCheckBox.IsChecked ?? false;
DialogResult = true;
Close();
}

Loading…
Cancel
Save

Powered by TurnKey Linux.