mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
Rework much of options UI
This commit is contained in:
@@ -126,7 +126,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ChrisKaczor.ApplicationUpdate" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.GenericSettingsProvider" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.InstalledBrowsers" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.InstalledBrowsers" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Application.SingleInstance" Version="1.0.4" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Application.StartWithWindows" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Controls.HtmlTextBlock" Version="1.0.2" />
|
||||
@@ -139,10 +139,11 @@
|
||||
<PackageReference Include="DebounceThrottle" Version="2.0.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
|
||||
<PackageReference Include="HtmlTextWriter" Version="2.1.1" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
||||
<PackageReference Include="Microsoft.SqlServer.Compact" Version="4.0.8876.1" GeneratePathProperty="true">
|
||||
<NoWarn>NU1701</NoWarn>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.1" />
|
||||
<PackageReference Include="NameBasedGrid" Version="0.10.1">
|
||||
<NoWarn>NU1701</NoWarn>
|
||||
</PackageReference>
|
||||
|
||||
@@ -4,21 +4,18 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:applicationUpdate="clr-namespace:ChrisKaczor.ApplicationUpdate;assembly=ChrisKaczor.ApplicationUpdate"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignHeight="150"
|
||||
d:DesignWidth="300">
|
||||
<Grid>
|
||||
<TextBlock Text="Label"
|
||||
Name="ApplicationNameLabel"
|
||||
VerticalAlignment="Top"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Text="Label"
|
||||
Margin="0,22,0,0"
|
||||
Name="VersionLabel"
|
||||
VerticalAlignment="Top" />
|
||||
<TextBlock Text="Label"
|
||||
Margin="0,44,0,0"
|
||||
Name="CompanyLabel"
|
||||
VerticalAlignment="Top" />
|
||||
<StackPanel options:Spacing.Vertical="10">
|
||||
<TextBlock Text="{x:Static properties:Resources.ApplicationDisplayName}"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Source={x:Static applicationUpdate:UpdateCheck.LocalVersion}, StringFormat={x:Static properties:Resources.Version}}"
|
||||
Name="VersionLabel" />
|
||||
<TextBlock Text="Chris Kaczor" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</options:OptionsPanelBase>
|
||||
</options:OptionsPanelBase>
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using ChrisKaczor.ApplicationUpdate;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
@@ -12,16 +10,4 @@ public partial class AboutOptionsPanel
|
||||
}
|
||||
|
||||
public override string CategoryName => Properties.Resources.optionCategoryAbout;
|
||||
|
||||
public override void LoadPanel()
|
||||
{
|
||||
base.LoadPanel();
|
||||
|
||||
ApplicationNameLabel.Text = Properties.Resources.ApplicationDisplayName;
|
||||
|
||||
var version = UpdateCheck.LocalVersion.ToString();
|
||||
VersionLabel.Text = string.Format(Properties.Resources.Version, version);
|
||||
|
||||
CompanyLabel.Text = ((AssemblyCompanyAttribute) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
mc:Ignorable="d"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.ControlBox"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Category}"
|
||||
Title="CategoryWindow"
|
||||
Width="300"
|
||||
@@ -17,7 +18,17 @@
|
||||
FocusManager.FocusedElement="{Binding ElementName=NameTextBox}"
|
||||
controls:ControlBox.HasMinimizeButton="False"
|
||||
controls:ControlBox.HasMaximizeButton="False">
|
||||
<Grid Margin="6,3,6,6">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid Margin="6">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -25,15 +36,13 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="0">
|
||||
<Label Content="{x:Static properties:Resources.categoryNameLabel}"
|
||||
Padding="0"
|
||||
Margin="0,0,0,1"
|
||||
Target="{Binding ElementName=NameTextBox}" />
|
||||
<TextBox Name="NameTextBox"
|
||||
VerticalAlignment="Center"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.categoryNameLabel}"
|
||||
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
@@ -44,7 +53,6 @@
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="{x:Static properties:Resources.OkayButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
@@ -52,7 +60,6 @@
|
||||
IsDefault="True"
|
||||
Click="HandleOkayButtonClick" />
|
||||
<Button Content="{x:Static properties:Resources.CancelButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
|
||||
@@ -5,61 +5,38 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
d:DesignHeight="150"
|
||||
d:DesignWidth="400">
|
||||
<StackPanel options:Spacing.Vertical="8">
|
||||
<CheckBox Content="{x:Static properties:Resources.lockWindowCheckBox}"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left"
|
||||
Name="LockWindowCheckBox"
|
||||
VerticalAlignment="Top"
|
||||
Width="300"
|
||||
Grid.ColumnSpan="2"
|
||||
Click="LockWindowCheckBox_Click" />
|
||||
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=WindowLocked}"
|
||||
Click="OnSaveSettings" />
|
||||
<CheckBox Content="{x:Static properties:Resources.displayEmptyFeedsCheckBox}"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,22,0,0"
|
||||
Name="DisplayEmptyFeedsCheckBox"
|
||||
VerticalAlignment="Top"
|
||||
Width="300"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Column="0"
|
||||
Click="DisplayEmptyFeedsCheckBox_Click" />
|
||||
<Label Grid.Column="0"
|
||||
Content="{x:Static properties:Resources.toolbarLocationLabel}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,50,0,0"
|
||||
Padding="0,5,5,5"
|
||||
Target="{Binding ElementName=ToolbarLocationComboBox}"
|
||||
Width="97" />
|
||||
<ComboBox Margin="8,53,0,0"
|
||||
Name="ToolbarLocationComboBox"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Column="1"
|
||||
SelectionChanged="ToolbarLocationComboBox_SelectionChanged">
|
||||
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=DisplayEmptyFeeds}"
|
||||
Click="OnSaveSettings" />
|
||||
<ComboBox
|
||||
Name="ToolbarLocationComboBox"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.toolbarLocationLabel}"
|
||||
SelectedValue="{Binding Source={x:Static properties:Settings.Default}, Path=ToolbarLocation}"
|
||||
SelectedValuePath="Tag"
|
||||
SelectionChanged="OnSaveSettings">
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Top}"
|
||||
Tag="{x:Static Dock.Top}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Bottom}"
|
||||
Tag="{x:Static Dock.Bottom}" />
|
||||
</ComboBox>
|
||||
<Label Grid.Column="0"
|
||||
Content="{x:Static properties:Resources.multipleLineDisplayLabel}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,82,0,0"
|
||||
Padding="0,5,5,5"
|
||||
Target="{Binding ElementName=MultipleLineDisplayComboBox}"
|
||||
Width="97" />
|
||||
<ComboBox Margin="8,86,0,0"
|
||||
Name="MultipleLineDisplayComboBox"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Column="1"
|
||||
SelectionChanged="MultipleLineDisplayComboBox_SelectionChanged">
|
||||
<ComboBox
|
||||
Name="MultipleLineDisplayComboBox"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.multipleLineDisplayLabel}"
|
||||
SelectedValue="{Binding Source={x:Static properties:Settings.Default}, Path=MultipleLineDisplay}"
|
||||
SelectedValuePath="Tag"
|
||||
SelectionChanged="OnSaveSettings">
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.multipleLineDisplayNormal}"
|
||||
Tag="{x:Static options:MultipleLineDisplay.Normal}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.multipleLineDisplaySingleLine}"
|
||||
@@ -67,5 +44,5 @@
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.multipleLineDisplayFirstLine}"
|
||||
Tag="{x:Static options:MultipleLineDisplay.FirstLine}" />
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</options:OptionsPanelBase>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,16 @@
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Icon="/FeedCenter;component/Resources/Application.ico"
|
||||
FocusManager.FocusedElement="{Binding ElementName=UrlTextBox}">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<TabControl Name="OptionsTabControl"
|
||||
Margin="12,12,12,41">
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
CanUserResizeRows="False"
|
||||
IsReadOnly="True"
|
||||
HeadersVisibility="Column"
|
||||
BorderThickness="1,1,1,1"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
Background="{x:Null}"
|
||||
PreviewMouseLeftButtonDown="HandleFeedListPreviewMouseLeftButtonDown" SelectionChanged="FeedListBox_SelectionChanged">
|
||||
<DataGrid.Columns>
|
||||
@@ -48,12 +50,6 @@
|
||||
Handler="HandleListBoxItemPreviewMouseMove" />
|
||||
</Style>
|
||||
</DataGrid.ItemContainerStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0" />
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
</DataGrid>
|
||||
<DataGrid Name="CategoryListBox"
|
||||
SelectionChanged="HandleCategoryListBoxSelectionChanged"
|
||||
@@ -65,6 +61,8 @@
|
||||
CanUserResizeRows="False"
|
||||
IsReadOnly="True"
|
||||
HeadersVisibility="Column"
|
||||
BorderThickness="1,1,1,1"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
AllowDrop="True"
|
||||
Background="{x:Null}"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Category }">
|
||||
@@ -86,12 +84,6 @@
|
||||
Handler="CategoryListBox_MouseDoubleClick" />
|
||||
</Style>
|
||||
</DataGrid.ItemContainerStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0" />
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
</DataGrid>
|
||||
<Border Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
|
||||
@@ -5,54 +5,33 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:installedBrowsers="clr-namespace:ChrisKaczor.InstalledBrowsers;assembly=ChrisKaczor.InstalledBrowsers"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="15" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel options:Spacing.Vertical="10">
|
||||
<CheckBox Content="{x:Static properties:Resources.startWithWindowsCheckBox}"
|
||||
Name="StartWithWindowsCheckBox"
|
||||
VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
Margin="0,5"
|
||||
Grid.ColumnSpan="2"
|
||||
Click="StartWithWindowsCheckBox_Click" />
|
||||
<Label Content="{x:Static properties:Resources.defaultBrowserLabel}"
|
||||
Target="{Binding ElementName=BrowserComboBox}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Padding="0"
|
||||
VerticalContentAlignment="Center"
|
||||
Margin="0,0,5,0" />
|
||||
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=StartWithWindows}"
|
||||
Click="OnSaveSettings" />
|
||||
<ComboBox Name="BrowserComboBox"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectionChanged="BrowserComboBox_SelectionChanged">
|
||||
</ComboBox>
|
||||
<Label Content="{x:Static properties:Resources.defaultUserAgentLabel}"
|
||||
Target="{Binding ElementName=BrowserComboBox}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="4"
|
||||
Padding="0"
|
||||
VerticalContentAlignment="Center"
|
||||
Margin="0,0,5,0" />
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.defaultBrowserLabel}"
|
||||
d:DataContext="{d:DesignInstance Type=installedBrowsers:InstalledBrowser}"
|
||||
DisplayMemberPath="Name"
|
||||
ItemsSource="{Binding Source={x:Static installedBrowsers:InstalledBrowser.InstalledBrowsers}}"
|
||||
SelectedValuePath="Key"
|
||||
SelectedValue="{Binding Source={x:Static properties:Settings.Default}, Path=Browser}"
|
||||
SelectionChanged="OnSaveSettings" />
|
||||
<ComboBox Name="UserAgentComboBox"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectionChanged="UserAgentComboBox_SelectionChanged">
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.defaultUserAgentLabel}"
|
||||
d:DataContext="{d:DesignInstance Type=options:UserAgentItem}"
|
||||
DisplayMemberPath="Caption"
|
||||
ItemsSource="{Binding Source={x:Static options:UserAgentItem.UserAgents}}"
|
||||
SelectedValuePath="UserAgent"
|
||||
SelectedValue="{Binding Source={x:Static properties:Settings.Default}, Path=DefaultUserAgent}"
|
||||
SelectionChanged="OnSaveSettings" />
|
||||
</StackPanel>
|
||||
</options:OptionsPanelBase>
|
||||
@@ -1,8 +1,6 @@
|
||||
using ChrisKaczor.InstalledBrowsers;
|
||||
using ChrisKaczor.Wpf.Application;
|
||||
using ChrisKaczor.Wpf.Application;
|
||||
using FeedCenter.Properties;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
@@ -19,87 +17,20 @@ public partial class GeneralOptionsPanel
|
||||
{
|
||||
base.LoadPanel();
|
||||
|
||||
var settings = Properties.Settings.Default;
|
||||
|
||||
StartWithWindowsCheckBox.IsChecked = settings.StartWithWindows;
|
||||
|
||||
LoadBrowserComboBox(BrowserComboBox, settings.Browser);
|
||||
|
||||
LoadUserAgentComboBox(UserAgentComboBox, settings.DefaultUserAgent);
|
||||
|
||||
MarkLoaded();
|
||||
}
|
||||
|
||||
private static void LoadBrowserComboBox(Selector selector, string selected)
|
||||
private void OnSaveSettings(object sender, RoutedEventArgs e)
|
||||
{
|
||||
selector.SelectedIndex = 0;
|
||||
|
||||
ComboBoxItem selectedItem = null;
|
||||
|
||||
var browsers = InstalledBrowser.GetInstalledBrowsers(true);
|
||||
foreach (var browser in browsers)
|
||||
{
|
||||
var item = new ComboBoxItem { Content = browser.Value.Name, Tag = browser.Key };
|
||||
|
||||
selector.Items.Add(item);
|
||||
|
||||
if (browser.Key == selected)
|
||||
selectedItem = item;
|
||||
}
|
||||
|
||||
if (selectedItem != null)
|
||||
selector.SelectedItem = selectedItem;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private static void LoadUserAgentComboBox(Selector selector, string selected)
|
||||
{
|
||||
selector.SelectedIndex = 0;
|
||||
|
||||
ComboBoxItem selectedItem = null;
|
||||
|
||||
var userAgents = UserAgentItem.GetUserAgents();
|
||||
foreach (var userAgent in userAgents)
|
||||
{
|
||||
var item = new ComboBoxItem { Content = userAgent.Caption, Tag = userAgent.UserAgent };
|
||||
|
||||
selector.Items.Add(item);
|
||||
|
||||
if (userAgent.UserAgent == selected)
|
||||
selectedItem = item;
|
||||
}
|
||||
|
||||
if (selectedItem != null)
|
||||
selector.SelectedItem = selectedItem;
|
||||
}
|
||||
|
||||
private void StartWithWindowsCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
private void SaveSettings()
|
||||
{
|
||||
if (!HasLoaded) return;
|
||||
|
||||
var settings = Properties.Settings.Default;
|
||||
Settings.Default.Save();
|
||||
|
||||
if (StartWithWindowsCheckBox.IsChecked.HasValue &&
|
||||
settings.StartWithWindows != StartWithWindowsCheckBox.IsChecked.Value)
|
||||
settings.StartWithWindows = StartWithWindowsCheckBox.IsChecked.Value;
|
||||
|
||||
System.Windows.Application.Current.SetStartWithWindows(settings.StartWithWindows);
|
||||
}
|
||||
|
||||
private void BrowserComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!HasLoaded) return;
|
||||
|
||||
var settings = Properties.Settings.Default;
|
||||
|
||||
settings.Browser = (string) ((ComboBoxItem) BrowserComboBox.SelectedItem).Tag;
|
||||
}
|
||||
|
||||
private void UserAgentComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!HasLoaded) return;
|
||||
|
||||
var settings = Properties.Settings.Default;
|
||||
|
||||
settings.DefaultUserAgent = (string) ((ComboBoxItem) UserAgentComboBox.SelectedItem).Tag;
|
||||
Application.Current.SetStartWithWindows(Settings.Default.StartWithWindows);
|
||||
}
|
||||
}
|
||||
73
Application/Options/MarginSetter.cs
Normal file
73
Application/Options/MarginSetter.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using JetBrains.Annotations;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class MarginSetter
|
||||
{
|
||||
private static Thickness GetLastItemMargin(DependencyObject obj)
|
||||
{
|
||||
return (Thickness) obj.GetValue(LastItemMarginProperty);
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public static Thickness GetMargin(DependencyObject obj)
|
||||
{
|
||||
return (Thickness) obj.GetValue(MarginProperty);
|
||||
}
|
||||
|
||||
private static void MarginChangedCallback(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
// Make sure this is put on a panel
|
||||
if (sender is not Panel panel)
|
||||
return;
|
||||
|
||||
// Avoid duplicate registrations
|
||||
panel.Loaded -= OnPanelLoaded;
|
||||
panel.Loaded += OnPanelLoaded;
|
||||
|
||||
if (panel.IsLoaded)
|
||||
{
|
||||
OnPanelLoaded(panel, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnPanelLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var panel = (Panel) sender;
|
||||
|
||||
// Go over the children and set margin for them:
|
||||
for (var i = 0; i < panel.Children.Count; i++)
|
||||
{
|
||||
var child = panel.Children[i];
|
||||
|
||||
if (child is not FrameworkElement fe)
|
||||
continue;
|
||||
|
||||
var isLastItem = i == panel.Children.Count - 1;
|
||||
fe.Margin = isLastItem ? GetLastItemMargin(panel) : GetMargin(panel);
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public static void SetLastItemMargin(DependencyObject obj, Thickness value)
|
||||
{
|
||||
obj.SetValue(LastItemMarginProperty, value);
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public static void SetMargin(DependencyObject obj, Thickness value)
|
||||
{
|
||||
obj.SetValue(MarginProperty, value);
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for Margin. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty MarginProperty =
|
||||
DependencyProperty.RegisterAttached("Margin", typeof(Thickness), typeof(MarginSetter),
|
||||
new UIPropertyMetadata(new Thickness(), MarginChangedCallback));
|
||||
|
||||
public static readonly DependencyProperty LastItemMarginProperty =
|
||||
DependencyProperty.RegisterAttached("LastItemMargin", typeof(Thickness), typeof(MarginSetter),
|
||||
new UIPropertyMetadata(new Thickness(), MarginChangedCallback));
|
||||
}
|
||||
@@ -8,21 +8,44 @@
|
||||
ResizeMode="CanResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Icon="/FeedCenter;component/Resources/Application.ico">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<ListBox HorizontalAlignment="Left"
|
||||
Name="CategoryListBox"
|
||||
Width="126"
|
||||
SelectionChanged="HandleSelectedCategoryChanged"
|
||||
Margin="12,12,0,41" />
|
||||
<ContentControl Margin="144,12,12,41"
|
||||
Name="ContentControl"
|
||||
IsTabStop="False" />
|
||||
<Button Content="{x:Static properties:Resources.CloseButton}"
|
||||
Margin="0,0,12,12"
|
||||
Height="23"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"
|
||||
Width="75"
|
||||
IsCancel="True" />
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="130" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Name="CategoryListBox"
|
||||
SelectionChanged="HandleSelectedCategoryChanged" />
|
||||
<ContentControl
|
||||
Grid.Column="2"
|
||||
Grid.Row="0"
|
||||
Margin="0,6,6,6"
|
||||
Name="ContentControl"
|
||||
IsTabStop="False" />
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="0,6,6,6"
|
||||
Content="{x:Static properties:Resources.CloseButton}"
|
||||
HorizontalAlignment="Right"
|
||||
IsCancel="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
55
Application/Options/Spacing.cs
Normal file
55
Application/Options/Spacing.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using JetBrains.Annotations;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
{
|
||||
public class Spacing
|
||||
{
|
||||
public static double GetHorizontal(DependencyObject obj)
|
||||
{
|
||||
return (double) obj.GetValue(HorizontalProperty);
|
||||
}
|
||||
|
||||
public static double GetVertical(DependencyObject obj)
|
||||
{
|
||||
return (double) obj.GetValue(VerticalProperty);
|
||||
}
|
||||
|
||||
private static void HorizontalChangedCallback(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var space = (double) e.NewValue;
|
||||
var obj = (DependencyObject) sender;
|
||||
|
||||
MarginSetter.SetMargin(obj, new Thickness(0, 0, space, 0));
|
||||
MarginSetter.SetLastItemMargin(obj, new Thickness(0));
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public static void SetHorizontal(DependencyObject obj, double space)
|
||||
{
|
||||
obj.SetValue(HorizontalProperty, space);
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public static void SetVertical(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(VerticalProperty, value);
|
||||
}
|
||||
|
||||
private static void VerticalChangedCallback(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var space = (double) e.NewValue;
|
||||
var obj = (DependencyObject) sender;
|
||||
MarginSetter.SetMargin(obj, new Thickness(0, 0, 0, space));
|
||||
MarginSetter.SetLastItemMargin(obj, new Thickness(0));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty VerticalProperty =
|
||||
DependencyProperty.RegisterAttached("Vertical", typeof(double), typeof(Spacing),
|
||||
new UIPropertyMetadata(0d, VerticalChangedCallback));
|
||||
|
||||
public static readonly DependencyProperty HorizontalProperty =
|
||||
DependencyProperty.RegisterAttached("Horizontal", typeof(double), typeof(Spacing),
|
||||
new UIPropertyMetadata(0d, HorizontalChangedCallback));
|
||||
}
|
||||
}
|
||||
@@ -6,19 +6,15 @@
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300">
|
||||
<Grid>
|
||||
d:DesignHeight="150"
|
||||
d:DesignWidth="250">
|
||||
<StackPanel options:Spacing.Vertical="10">
|
||||
<CheckBox Content="{x:Static properties:Resources.checkVersionOnStartupCheckBox}"
|
||||
Name="CheckVersionOnStartupCheckBox"
|
||||
VerticalAlignment="Top"
|
||||
Click="CheckVersionOnStartupCheckBox_Click" />
|
||||
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=CheckVersionAtStartup}"
|
||||
Click="OnSaveSettings" />
|
||||
<Button Content="{x:Static properties:Resources.checkVersionNowButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,22,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="75"
|
||||
Click="HandleCheckVersionNowButtonClick" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</options:OptionsPanelBase>
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using ChrisKaczor.ApplicationUpdate;
|
||||
using ChrisKaczor.ApplicationUpdate;
|
||||
using FeedCenter.Properties;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
@@ -12,25 +13,20 @@ public partial class UpdateOptionsPanel
|
||||
|
||||
public override string CategoryName => Properties.Resources.optionCategoryUpdate;
|
||||
|
||||
public override void LoadPanel()
|
||||
{
|
||||
base.LoadPanel();
|
||||
|
||||
CheckVersionOnStartupCheckBox.IsChecked = Properties.Settings.Default.CheckVersionAtStartup;
|
||||
|
||||
MarkLoaded();
|
||||
}
|
||||
|
||||
private void HandleCheckVersionNowButtonClick(object sender, System.Windows.RoutedEventArgs e)
|
||||
private void HandleCheckVersionNowButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateCheck.DisplayUpdateInformation(true);
|
||||
}
|
||||
|
||||
private void CheckVersionOnStartupCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
private void OnSaveSettings(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private void SaveSettings()
|
||||
{
|
||||
if (!HasLoaded) return;
|
||||
|
||||
if (CheckVersionOnStartupCheckBox.IsChecked.HasValue && Properties.Settings.Default.CheckVersionAtStartup != CheckVersionOnStartupCheckBox.IsChecked.Value)
|
||||
Properties.Settings.Default.CheckVersionAtStartup = CheckVersionOnStartupCheckBox.IsChecked.Value;
|
||||
Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
@@ -2,38 +2,33 @@
|
||||
|
||||
namespace FeedCenter.Options
|
||||
{
|
||||
internal class UserAgentItem
|
||||
public class UserAgentItem
|
||||
{
|
||||
internal string Caption { get; set; }
|
||||
internal string UserAgent { get; set; }
|
||||
public string Caption { get; set; }
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
internal static List<UserAgentItem> GetUserAgents()
|
||||
public static List<UserAgentItem> UserAgents => new()
|
||||
{
|
||||
var userAgents = new List<UserAgentItem>
|
||||
new UserAgentItem
|
||||
{
|
||||
new()
|
||||
{
|
||||
Caption = Properties.Resources.DefaultUserAgentCaption,
|
||||
UserAgent = string.Empty
|
||||
},
|
||||
new()
|
||||
{
|
||||
Caption = "Windows RSS Platform 2.0",
|
||||
UserAgent = "Windows-RSS-Platform/2.0 (MSIE 9.0; Windows NT 6.1)"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Caption = "Feedly 1.0",
|
||||
UserAgent = "Feedly/1.0"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Caption = "curl",
|
||||
UserAgent = "curl/7.47.0"
|
||||
}
|
||||
};
|
||||
|
||||
return userAgents;
|
||||
}
|
||||
Caption = Properties.Resources.DefaultUserAgentCaption,
|
||||
UserAgent = string.Empty
|
||||
},
|
||||
new UserAgentItem
|
||||
{
|
||||
Caption = "Windows RSS Platform 2.0",
|
||||
UserAgent = "Windows-RSS-Platform/2.0 (MSIE 9.0; Windows NT 6.1)"
|
||||
},
|
||||
new UserAgentItem
|
||||
{
|
||||
Caption = "Feedly 1.0",
|
||||
UserAgent = "Feedly/1.0"
|
||||
},
|
||||
new UserAgentItem
|
||||
{
|
||||
Caption = "curl",
|
||||
UserAgent = "curl/7.47.0"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
12
Application/Properties/Resources.Designer.cs
generated
12
Application/Properties/Resources.Designer.cs
generated
@@ -215,7 +215,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Name:.
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
public static string categoryNameLabel {
|
||||
get {
|
||||
@@ -508,7 +508,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default _browser:.
|
||||
/// Looks up a localized string similar to Default browser.
|
||||
/// </summary>
|
||||
public static string defaultBrowserLabel {
|
||||
get {
|
||||
@@ -526,7 +526,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default _user agent:.
|
||||
/// Looks up a localized string similar to Default user agent.
|
||||
/// </summary>
|
||||
public static string defaultUserAgentLabel {
|
||||
get {
|
||||
@@ -994,7 +994,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Multi-line items:.
|
||||
/// Looks up a localized string similar to Multiline titles.
|
||||
/// </summary>
|
||||
public static string multipleLineDisplayLabel {
|
||||
get {
|
||||
@@ -1444,7 +1444,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Tool bar location:.
|
||||
/// Looks up a localized string similar to Toolbar location.
|
||||
/// </summary>
|
||||
public static string toolbarLocationLabel {
|
||||
get {
|
||||
@@ -1462,7 +1462,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Version: {0}.
|
||||
/// Looks up a localized string similar to Version {0}.
|
||||
/// </summary>
|
||||
public static string Version {
|
||||
get {
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
<value>< no title ></value>
|
||||
</data>
|
||||
<data name="Version" xml:space="preserve">
|
||||
<value>Version: {0}</value>
|
||||
<value>Version {0}</value>
|
||||
</data>
|
||||
<data name="SplashCheckingForUpdate" xml:space="preserve">
|
||||
<value>Checking for update...</value>
|
||||
@@ -320,7 +320,7 @@
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="toolbarLocationLabel" xml:space="preserve">
|
||||
<value>_Tool bar location:</value>
|
||||
<value>Toolbar location</value>
|
||||
</data>
|
||||
<data name="Top" xml:space="preserve">
|
||||
<value>Top</value>
|
||||
@@ -347,7 +347,7 @@
|
||||
<value>_Register as default feed reader</value>
|
||||
</data>
|
||||
<data name="defaultBrowserLabel" xml:space="preserve">
|
||||
<value>Default _browser:</value>
|
||||
<value>Default browser</value>
|
||||
</data>
|
||||
<data name="DefaultBrowserCaption" xml:space="preserve">
|
||||
<value>< Windows Default ></value>
|
||||
@@ -365,7 +365,7 @@
|
||||
<value>Edit Category</value>
|
||||
</data>
|
||||
<data name="multipleLineDisplayLabel" xml:space="preserve">
|
||||
<value>_Multi-line items:</value>
|
||||
<value>Multiline titles</value>
|
||||
</data>
|
||||
<data name="multipleLineDisplayFirstLine" xml:space="preserve">
|
||||
<value>Show only first line</value>
|
||||
@@ -527,7 +527,7 @@
|
||||
<value>Feed Center</value>
|
||||
</data>
|
||||
<data name="defaultUserAgentLabel" xml:space="preserve">
|
||||
<value>Default _user agent:</value>
|
||||
<value>Default user agent</value>
|
||||
</data>
|
||||
<data name="SplashLoadingDatabase" xml:space="preserve">
|
||||
<value>Loading database...</value>
|
||||
@@ -536,7 +536,7 @@
|
||||
<value>Migrating legacy database...</value>
|
||||
</data>
|
||||
<data name="categoryNameLabel" xml:space="preserve">
|
||||
<value>_Name:</value>
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="ConfirmDeleteCategory" xml:space="preserve">
|
||||
<value>Are you sure you want to delete this category?
|
||||
|
||||
Reference in New Issue
Block a user