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

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

@ -140,7 +140,7 @@ namespace WhackerLinkConsoleV2
{ {
foreach (var channel in zone.Channels) 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)) if (_settingsManager.ChannelPositions.TryGetValue(channel.Name, out var position))
{ {
@ -170,27 +170,30 @@ namespace WhackerLinkConsoleV2
} }
} }
foreach (var alertPath in _settingsManager.AlertToneFilePaths) if (_settingsManager.ShowAlertTones && Codeplug != null)
{ {
var alertTone = new AlertTone(alertPath) foreach (var alertPath in _settingsManager.AlertToneFilePaths)
{ {
IsEditMode = isEditMode var alertTone = new AlertTone(alertPath)
}; {
IsEditMode = isEditMode
};
if (_settingsManager.AlertTonePositions.TryGetValue(alertPath, out var position)) if (_settingsManager.AlertTonePositions.TryGetValue(alertPath, out var position))
{ {
Canvas.SetLeft(alertTone, position.X); Canvas.SetLeft(alertTone, position.X);
Canvas.SetTop(alertTone, position.Y); Canvas.SetTop(alertTone, position.Y);
} }
else else
{ {
Canvas.SetLeft(alertTone, 20); Canvas.SetLeft(alertTone, 20);
Canvas.SetTop(alertTone, 20); Canvas.SetTop(alertTone, 20);
} }
alertTone.MouseRightButtonUp += AlertTone_MouseRightButtonUp; alertTone.MouseRightButtonUp += AlertTone_MouseRightButtonUp;
ChannelsCanvas.Children.Add(alertTone); ChannelsCanvas.Children.Add(alertTone);
}
} }
AdjustCanvasHeight(); AdjustCanvasHeight();
@ -204,6 +207,8 @@ namespace WhackerLinkConsoleV2
{ {
_settingsManager.ShowSystemStatus = widgetSelectionWindow.ShowSystemStatus; _settingsManager.ShowSystemStatus = widgetSelectionWindow.ShowSystemStatus;
_settingsManager.ShowChannels = widgetSelectionWindow.ShowChannels; _settingsManager.ShowChannels = widgetSelectionWindow.ShowChannels;
_settingsManager.ShowAlertTones = widgetSelectionWindow.ShowAlertTones;
GenerateChannelWidgets(); GenerateChannelWidgets();
_settingsManager.SaveSettings(); _settingsManager.SaveSettings();
} }

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

@ -5,7 +5,8 @@
<StackPanel Margin="20"> <StackPanel Margin="20">
<TextBlock Text="Select Widgets to Display:" FontWeight="Bold" Margin="0,0,0,10" /> <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="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" /> <Button Content="Apply" Width="80" Margin="0,20,0,0" HorizontalAlignment="Center" Click="ApplyButton_Click" />
</StackPanel> </StackPanel>
</Window> </Window>

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

Loading…
Cancel
Save

Powered by TurnKey Linux.