Stop the recorder from hiding text with a null foreground
Setting Foreground to null is a local value of no brush, so the Record button, connected devices in the list and the status line had no text colour. Clear the value instead. The bitrate step is now 4 kbps. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,14 @@ internal sealed class ChannelRow : Grid
|
||||
Margin = new Thickness(0, 2);
|
||||
|
||||
sources.ItemTemplate = new FuncDataTemplate<SourceChoice>((choice, _) =>
|
||||
new TextBlock { Text = choice?.Label, Foreground = choice?.Brush });
|
||||
{
|
||||
TextBlock text = new() { Text = choice?.Label };
|
||||
if (choice?.Brush is { } brush)
|
||||
{
|
||||
text.Foreground = brush;
|
||||
}
|
||||
return text;
|
||||
});
|
||||
sources.SelectionChanged += (_, _) => OnSourcePicked();
|
||||
|
||||
monitor.Content = new PathIcon { Data = Geometry.Parse(HeadphonesPath), Width = 16, Height = 16 };
|
||||
@@ -90,7 +97,14 @@ internal sealed class ChannelRow : Grid
|
||||
double peak = Math.Sqrt(Math.Min(1.0, Channel.TakePeak()));
|
||||
shown = Math.Max(peak, shown * 0.85);
|
||||
level.Value = shown;
|
||||
sources.Foreground = Channel.IsAvailable ? null : new SolidColorBrush(Color.Parse("#D93025"));
|
||||
if (Channel.IsAvailable)
|
||||
{
|
||||
sources.ClearValue(TemplatedControl.ForegroundProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
sources.Foreground = new SolidColorBrush(Color.Parse("#D93025"));
|
||||
}
|
||||
ToolTip.SetTip(sources, Channel.IsAvailable ? null : Channel.Problem);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Button Name="AddButton" Content="Add channel" />
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6" HorizontalAlignment="Right">
|
||||
<TextBlock Text="Bitrate per channel" VerticalAlignment="Center" />
|
||||
<NumericUpDown Name="BitrateBox" Minimum="6" Maximum="256" Increment="2" Value="32" Width="150" FormatString="0 "kbps"" />
|
||||
<NumericUpDown Name="BitrateBox" Minimum="6" Maximum="256" Increment="4" Value="32" Width="150" FormatString="0 "kbps"" />
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" Grid.ColumnSpan="2" ColumnDefinitions="Auto,*,Auto" ColumnSpacing="8">
|
||||
<TextBlock Text="Save in" VerticalAlignment="Center" />
|
||||
|
||||
@@ -166,7 +166,14 @@ public partial class MainWindow : Window
|
||||
private void ShowRecordState(bool isRecording)
|
||||
{
|
||||
RecordButton.Content = isRecording ? "■ Stop" : "● Record";
|
||||
RecordButton.Foreground = isRecording ? null : new SolidColorBrush(Color.Parse("#D93025"));
|
||||
if (isRecording)
|
||||
{
|
||||
RecordButton.ClearValue(ForegroundProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
RecordButton.Foreground = new SolidColorBrush(Color.Parse("#D93025"));
|
||||
}
|
||||
PauseButton.IsEnabled = isRecording;
|
||||
PauseButton.Content = "Pause";
|
||||
AddButton.IsEnabled = !isRecording && engine is not null;
|
||||
@@ -229,6 +236,13 @@ public partial class MainWindow : Window
|
||||
private void Say(string text, bool isProblem)
|
||||
{
|
||||
StatusText.Text = text;
|
||||
StatusText.Foreground = isProblem ? new SolidColorBrush(Color.Parse("#D93025")) : null;
|
||||
if (isProblem)
|
||||
{
|
||||
StatusText.Foreground = new SolidColorBrush(Color.Parse("#D93025"));
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusText.ClearValue(ForegroundProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user