Fix system box; fix alert tone

pull/1/head
firealarmss 11 months ago
parent 47bc4a17aa
commit 209aadd0db

@ -37,9 +37,10 @@ namespace WhackerLinkConsoleV2.Controls
private bool _emergency; private bool _emergency;
private string _lastSrcId = "0"; private string _lastSrcId = "0";
private double _volume = 1.0; private double _volume = 1.0;
private LinearGradientBrush grayGradient;
private LinearGradientBrush redGradient; internal LinearGradientBrush grayGradient;
private LinearGradientBrush orangeGradient; internal LinearGradientBrush redGradient;
internal LinearGradientBrush orangeGradient;
public FlashingBackgroundManager _flashingBackgroundManager; public FlashingBackgroundManager _flashingBackgroundManager;

@ -29,14 +29,13 @@
<MenuItem Header="P25 Page" Click="P25Page_Click" /> <MenuItem Header="P25 Page" Click="P25Page_Click" />
<MenuItem Header="Manual QC2" Click="ManualPage_Click" /> <MenuItem Header="Manual QC2" Click="ManualPage_Click" />
</MenuItem> </MenuItem>
<MenuItem Header="Clear Emergency" Click="ClearEmergency_Click" />
</Menu> </Menu>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Grid.Row="2"> <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Grid.Row="2">
<Canvas x:Name="ChannelsCanvas" Background="#FFF2F2F2" VerticalAlignment="Top"/> <Canvas x:Name="ChannelsCanvas" Background="#FFF2F2F2" VerticalAlignment="Top"/>
</ScrollViewer> </ScrollViewer>
<Button Content="1" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="254,0,0,0" VerticalAlignment="Center" Height="46" Width="45" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial"> <Button Content="1" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="254,0,0,0" VerticalAlignment="Center" Height="46" Width="45" x:Name="btnAlert1" Click="btnAlert1_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial">
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
@ -51,8 +50,8 @@
</Button> </Button>
<Image HorizontalAlignment="Left" Height="26" Grid.Row="1" VerticalAlignment="Center" Width="160" Source="/whackerlink-logo.png" Margin="6,0,0,0" Stretch="Fill"/> <Image HorizontalAlignment="Left" Height="26" Grid.Row="1" VerticalAlignment="Center" Width="160" Source="/whackerlink-logo.png" Margin="6,0,0,0" Stretch="Fill"/>
<Image HorizontalAlignment="Left" Margin="259,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False"/> <Image HorizontalAlignment="Left" Margin="259,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False" RenderTransformOrigin="0.5,0.598"/>
<Button Content="2" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="301,0,0,0" VerticalAlignment="Center" Height="46" Width="45" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial"> <Button Content="2" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="301,0,0,0" VerticalAlignment="Center" Height="46" Width="45" x:Name="btnAlert2" Click="btnAlert2_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial">
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
@ -65,8 +64,8 @@
</LinearGradientBrush> </LinearGradientBrush>
</Button.Background> </Button.Background>
</Button> </Button>
<Image HorizontalAlignment="Left" Margin="306,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False"/> <Image HorizontalAlignment="Left" Margin="306,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False" RenderTransformOrigin="0.5,0.598"/>
<Button Content="3" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="348,0,0,0" VerticalAlignment="Center" Height="46" Width="45" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial"> <Button Content="3" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="348,0,0,0" VerticalAlignment="Center" x:Name="btnAlert3" Height="46" Width="45" Click="btnAlert3_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial">
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
@ -80,7 +79,7 @@
</Button.Background> </Button.Background>
</Button> </Button>
<Image HorizontalAlignment="Left" Margin="353,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False"/> <Image HorizontalAlignment="Left" Margin="353,3,0,3" Grid.Row="1" Width="37" Source="/alerttone.png" IsHitTestVisible="False"/>
<Button VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="170,0,0,0" VerticalAlignment="Center" Height="46" Width="82" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial"> <Button VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="170,0,0,0" VerticalAlignment="Center" Height="46" Width="82" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial">
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
@ -94,7 +93,7 @@
</Button.Background> </Button.Background>
</Button> </Button>
<Image HorizontalAlignment="Left" Margin="188,3,0,4" Width="63" Source="/Assets/instantptt.png" IsHitTestVisible="False" Grid.Row="1" /> <Image HorizontalAlignment="Left" Margin="188,3,0,4" Width="63" Source="/Assets/instantptt.png" IsHitTestVisible="False" Grid.Row="1" />
<Button Content="" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="395,0,0,0" VerticalAlignment="Center" Height="46" Width="45" Click="Button_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial"> <Button Content="" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Margin="395,0,0,0" VerticalAlignment="Center" Height="46" Width="45" Click="ClearEmergency_Click" BorderBrush="#FFC1C1C1" BorderThickness="1,1,1,1" Grid.Row="1" FontSize="10" FontFamily="Arial">
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>

@ -138,7 +138,7 @@ namespace WhackerLinkConsoleV2
double offsetX = 20; double offsetX = 20;
double offsetY = 20; double offsetY = 20;
if (_settingsManager.ShowSystemStatus && Codeplug != null) if (Codeplug != null)
{ {
foreach (var system in Codeplug.Systems) foreach (var system in Codeplug.Systems)
{ {
@ -177,6 +177,9 @@ namespace WhackerLinkConsoleV2
handler.OnAudioData += HandleReceivedAudio; handler.OnAudioData += HandleReceivedAudio;
handler.OnAffiliationUpdate += HandleAffiliationUpdate; handler.OnAffiliationUpdate += HandleAffiliationUpdate;
if (!_settingsManager.ShowSystemStatus)
systemStatusBox.Visibility = Visibility.Collapsed;
handler.OnUnitRegistrationResponse += (response) => handler.OnUnitRegistrationResponse += (response) =>
{ {
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
@ -476,15 +479,23 @@ namespace WhackerLinkConsoleV2
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
//channel.PageState = false; // TODO: Investigate //channel.PageState = false; // TODO: Investigate
channel.PageSelectButton.Background = channel.grayGradient;
}); });
} }
} }
} }
} }
private async void SendAlertTone(AlertTone e) private void SendAlertTone(AlertTone e)
{
Task.Run(() => SendAlertTone(e.AlertFilePath));
}
private async void SendAlertTone(string filePath)
{ {
if (!string.IsNullOrEmpty(e.AlertFilePath) && File.Exists(e.AlertFilePath)) Console.WriteLine(filePath);
Console.WriteLine(File.Exists(filePath));
if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
{ {
try try
{ {
@ -498,7 +509,7 @@ namespace WhackerLinkConsoleV2
{ {
byte[] pcmData; byte[] pcmData;
using (var waveReader = new WaveFileReader(e.AlertFilePath)) using (var waveReader = new WaveFileReader(filePath))
{ {
if (waveReader.WaveFormat.Encoding != WaveFormatEncoding.Pcm || if (waveReader.WaveFormat.Encoding != WaveFormatEncoding.Pcm ||
waveReader.WaveFormat.SampleRate != 8000 || waveReader.WaveFormat.SampleRate != 8000 ||
@ -579,7 +590,7 @@ namespace WhackerLinkConsoleV2
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
channel.PageSelectButton.Background = channel.grayGradient;
}); });
} }
} }
@ -1015,9 +1026,29 @@ namespace WhackerLinkConsoleV2
} }
} }
private void Button_Click(object sender, RoutedEventArgs e) private void btnAlert1_Click(object sender, RoutedEventArgs e)
{ {
Dispatcher.Invoke(() => {
SendAlertTone("alert1.wav");
});
}
private void btnAlert2_Click(object sender, RoutedEventArgs e)
{
Dispatcher.Invoke(() =>
{
SendAlertTone("alert2.wav");
});
}
private void btnAlert3_Click(object sender, RoutedEventArgs e)
{
Dispatcher.Invoke(() =>
{
SendAlertTone("alert3.wav");
});
} }
private void Button_Click(object sender, RoutedEventArgs e) { /* sub */ }
} }
} }

@ -4,8 +4,8 @@
Width="105" Height="55" Background="#FF0B004B" BorderBrush="Gray" BorderThickness="1"> Width="105" Height="55" Background="#FF0B004B" BorderBrush="Gray" BorderThickness="1">
<Border Background="{Binding Background, RelativeSource={RelativeSource AncestorType=UserControl}}" CornerRadius="5" Padding="10" BorderThickness="1,1,1,1"> <Border Background="{Binding Background, RelativeSource={RelativeSource AncestorType=UserControl}}" CornerRadius="5" Padding="10" BorderThickness="1,1,1,1">
<StackPanel Margin="-3,-1,-4,1"> <StackPanel Margin="-3,-1,-4,1">
<TextBlock Text="System 1" FontWeight="Bold" Foreground="White" FontSize="12"/> <TextBlock Text="{Binding SystemName}" FontWeight="Bold" Foreground="White" FontSize="12"/>
<TextBlock Text="Connected" Foreground="Gold" FontSize="10"/> <TextBlock Text="{Binding ConnectionState}" Foreground="Gold" FontSize="10"/>
</StackPanel> </StackPanel>
</Border> </Border>
</UserControl> </UserControl>
Loading…
Cancel
Save

Powered by TurnKey Linux.