Rework much of options UI

This commit is contained in:
2023-04-13 20:05:55 -04:00
parent ace251fd4f
commit 5c0c84a068
18 changed files with 322 additions and 331 deletions

View File

@@ -1,7 +1,5 @@
using System.Linq;
using FeedCenter.Properties;
using System.Windows;
using System.Windows.Controls;
using FeedCenter.Properties;
namespace FeedCenter.Options;
@@ -18,43 +16,18 @@ public partial class DisplayOptionsPanel
{
base.LoadPanel();
LockWindowCheckBox.IsChecked = Settings.Default.WindowLocked;
DisplayEmptyFeedsCheckBox.IsChecked = Settings.Default.DisplayEmptyFeeds;
ToolbarLocationComboBox.SelectedItem = ToolbarLocationComboBox.Items.Cast<ComboBoxItem>().First(comboBoxItem => (Dock) comboBoxItem.Tag == Settings.Default.ToolbarLocation);
MultipleLineDisplayComboBox.SelectedItem = MultipleLineDisplayComboBox.Items.Cast<ComboBoxItem>().First(comboBoxItem => (MultipleLineDisplay) comboBoxItem.Tag == Settings.Default.MultipleLineDisplay);
MarkLoaded();
}
private void LockWindowCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
private void OnSaveSettings(object sender, RoutedEventArgs e)
{
if (!HasLoaded) return;
if (LockWindowCheckBox.IsChecked.HasValue && Settings.Default.WindowLocked != LockWindowCheckBox.IsChecked.Value)
Settings.Default.WindowLocked = LockWindowCheckBox.IsChecked.Value;
SaveSettings();
}
private void DisplayEmptyFeedsCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
private void SaveSettings()
{
if (!HasLoaded) return;
if (DisplayEmptyFeedsCheckBox.IsChecked.HasValue && Settings.Default.DisplayEmptyFeeds != DisplayEmptyFeedsCheckBox.IsChecked.Value)
Settings.Default.DisplayEmptyFeeds = DisplayEmptyFeedsCheckBox.IsChecked.Value;
}
private void ToolbarLocationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!HasLoaded) return;
var dock = (Dock) ((ComboBoxItem) ToolbarLocationComboBox.SelectedItem).Tag;
Settings.Default.ToolbarLocation = dock;
}
private void MultipleLineDisplayComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!HasLoaded) return;
var multipleLineDisplay = (MultipleLineDisplay) ((ComboBoxItem) MultipleLineDisplayComboBox.SelectedItem).Tag;
Settings.Default.MultipleLineDisplay = multipleLineDisplay;
Settings.Default.Save();
}
}