Working version
This commit is contained in:
+35
-3
@@ -26,6 +26,11 @@ public partial class MainWindow : Window
|
||||
EndCardBox.Text = _loadedSettings.EndCardPath;
|
||||
FfmpegPathBox.Text = _loadedSettings.FfmpegPath;
|
||||
FfprobePathBox.Text = _loadedSettings.FfprobePath;
|
||||
TrimBox.Text = _loadedSettings.TrimStart;
|
||||
FadeBox.Text = _loadedSettings.FadeSeconds;
|
||||
HoldBox.Text = _loadedSettings.EndCardHoldSeconds;
|
||||
IntervalBox.Text = _loadedSettings.ThumbnailInterval;
|
||||
SelectEncoder(_loadedSettings.Encoder);
|
||||
SelectTheme(_loadedSettings.Theme);
|
||||
ApplyTheme(_loadedSettings.Theme);
|
||||
Closing += (_, _) => SaveSettings();
|
||||
@@ -65,6 +70,14 @@ public partial class MainWindow : Window
|
||||
if (dialog.ShowDialog(this) == true) FfprobePathBox.Text = dialog.FileName;
|
||||
}
|
||||
|
||||
private void OpenSettings_Click(object sender, RoutedEventArgs e) => SettingsOverlay.Visibility = Visibility.Visible;
|
||||
|
||||
private void CloseSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SettingsOverlay.Visibility = Visibility.Collapsed;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private async void Render_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -174,10 +187,16 @@ public partial class MainWindow : Window
|
||||
EndCardBox.Text.Trim(),
|
||||
FfmpegPathBox.Text.Trim(),
|
||||
FfprobePathBox.Text.Trim(),
|
||||
SelectedTheme()));
|
||||
SelectedTheme(),
|
||||
SelectedEncoder(),
|
||||
TrimBox.Text.Trim(),
|
||||
FadeBox.Text.Trim(),
|
||||
HoldBox.Text.Trim(),
|
||||
IntervalBox.Text.Trim()));
|
||||
}
|
||||
|
||||
private string SelectedTheme() => ((ComboBoxItem)ThemeBox.SelectedItem).Tag!.ToString()!;
|
||||
private string SelectedEncoder() => ((ComboBoxItem)EncoderBox.SelectedItem).Tag!.ToString()!;
|
||||
|
||||
private void SelectTheme(string theme)
|
||||
{
|
||||
@@ -193,6 +212,20 @@ public partial class MainWindow : Window
|
||||
ThemeBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void SelectEncoder(string encoder)
|
||||
{
|
||||
foreach (ComboBoxItem item in EncoderBox.Items)
|
||||
{
|
||||
if (string.Equals(item.Tag?.ToString(), encoder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
EncoderBox.SelectedItem = item;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EncoderBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void ApplyTheme(string theme)
|
||||
{
|
||||
bool light = string.Equals(theme, "Light", StringComparison.OrdinalIgnoreCase);
|
||||
@@ -217,7 +250,6 @@ public partial class MainWindow : Window
|
||||
|
||||
private void SetBrush(string key, string color)
|
||||
{
|
||||
if (Application.Current.Resources[key] is SolidColorBrush brush)
|
||||
brush.Color = (Color)ColorConverter.ConvertFromString(color);
|
||||
Application.Current.Resources[key] = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user