mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
More UI updates
This commit is contained in:
@@ -8,10 +8,10 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class App
|
||||
{
|
||||
public partial class App
|
||||
{
|
||||
// ReSharper disable ConvertPropertyToExpressionBody
|
||||
private static bool IsDebugBuild
|
||||
{
|
||||
@@ -124,5 +124,4 @@ namespace FeedCenter
|
||||
{
|
||||
Log.Logger.Error(e.Exception, "Exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.IO;
|
||||
|
||||
namespace FeedCenter.Data
|
||||
namespace FeedCenter.Data;
|
||||
|
||||
public static class Database
|
||||
{
|
||||
public static class Database
|
||||
{
|
||||
public static string DatabaseFile { get; set; }
|
||||
public static string DatabasePath { get; set; }
|
||||
|
||||
@@ -21,5 +21,4 @@ namespace FeedCenter.Data
|
||||
|
||||
Loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace FeedCenter.Data
|
||||
namespace FeedCenter.Data;
|
||||
|
||||
public class RealmObservableCollection<T> : ObservableCollection<T> where T : IRealmObject
|
||||
{
|
||||
public class RealmObservableCollection<T> : ObservableCollection<T> where T : IRealmObject
|
||||
{
|
||||
private readonly Realm _realm;
|
||||
|
||||
public RealmObservableCollection(Realm realm) : base(realm.All<T>())
|
||||
@@ -25,5 +25,4 @@ namespace FeedCenter.Data
|
||||
|
||||
base.OnCollectionChanged(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using Realms;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public class FeedCenterEntities
|
||||
{
|
||||
public class FeedCenterEntities
|
||||
{
|
||||
public Realm RealmInstance { get; }
|
||||
|
||||
public RealmObservableCollection<Category> Categories { get; }
|
||||
@@ -49,5 +49,4 @@ namespace FeedCenter
|
||||
{
|
||||
get { return Categories.First(c => c.IsDefault); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Controls.HtmlTextBlock" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Controls.Link" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Controls.Toolbar" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Validation" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Validation" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Windows.ControlBox" Version="1.0.2" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Windows.SnappingWindow" Version="1.0.2" />
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
|
||||
@@ -14,12 +14,24 @@
|
||||
FocusManager.FocusedElement="{Binding ElementName=FeedDataGrid}"
|
||||
controlBox:ControlBox.HasMaximizeButton="False"
|
||||
controlBox:ControlBox.HasMinimizeButton="False">
|
||||
<Grid>
|
||||
<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="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid AutoGenerateColumns="False"
|
||||
<DataGrid Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
AutoGenerateColumns="False"
|
||||
x:Name="FeedDataGrid"
|
||||
CanUserReorderColumns="False"
|
||||
GridLinesVisibility="None"
|
||||
@@ -27,16 +39,11 @@
|
||||
IsReadOnly="True"
|
||||
CanUserResizeRows="False"
|
||||
HeadersVisibility="Column"
|
||||
Margin="6"
|
||||
BorderThickness="1,1,1,1"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
Background="{x:Null}"
|
||||
CanUserSortColumns="True"
|
||||
MouseDoubleClick="HandleMouseDoubleClick">
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0" />
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static my:Resources.FeedNameColumnHeader}"
|
||||
Binding="{Binding Item2}"
|
||||
@@ -44,22 +51,24 @@
|
||||
SortDirection="Ascending" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="{x:Static my:Resources.OkayButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
Margin="0,0,5,0"
|
||||
IsDefault="True"
|
||||
Width="75"
|
||||
Click="HandleOkayButtonClick"
|
||||
Margin="0,0,90,10"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right" />
|
||||
Click="HandleOkayButtonClick" />
|
||||
<Button Content="{x:Static my:Resources.CancelButton}"
|
||||
Height="23"
|
||||
IsCancel="True"
|
||||
Width="75"
|
||||
Margin="0,0,10,10"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right" />
|
||||
Width="75"
|
||||
IsCancel="True" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class FeedChooserWindow
|
||||
{
|
||||
public partial class FeedChooserWindow
|
||||
{
|
||||
private string _returnLink;
|
||||
|
||||
public FeedChooserWindow()
|
||||
@@ -48,5 +48,4 @@ namespace FeedCenter
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:linkControl="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
|
||||
xmlns:controlBox="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.ControlBox"
|
||||
xmlns:controlBox="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.ControlBox" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:feedCenter="clr-namespace:FeedCenter"
|
||||
mc:Ignorable="d"
|
||||
x:Class="FeedCenter.FeedErrorWindow"
|
||||
Title="{x:Static my:Resources.FeedErrorWindow}"
|
||||
Height="300"
|
||||
@@ -11,29 +13,40 @@
|
||||
Icon="/FeedCenter;component/Resources/Application.ico"
|
||||
controlBox:ControlBox.HasMaximizeButton="False"
|
||||
controlBox:ControlBox.HasMinimizeButton="False">
|
||||
<Grid>
|
||||
<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="225*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid AutoGenerateColumns="False"
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
AutoGenerateColumns="False"
|
||||
x:Name="FeedDataGrid"
|
||||
CanUserReorderColumns="False"
|
||||
GridLinesVisibility="None"
|
||||
SelectionMode="Single"
|
||||
IsReadOnly="True"
|
||||
CanUserResizeRows="False"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
HeadersVisibility="Column"
|
||||
Margin="6,6,6,0"
|
||||
Background="{x:Null}"
|
||||
CanUserSortColumns="True">
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0" />
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
CanUserSortColumns="True"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Feed}" SelectionChanged="FeedDataGrid_SelectionChanged">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static my:Resources.FeedNameColumnHeader}"
|
||||
Binding="{Binding Name}"
|
||||
@@ -49,7 +62,6 @@
|
||||
</DataGrid>
|
||||
<Border Grid.Row="1"
|
||||
BorderThickness="1,0,1,1"
|
||||
Margin="6,0,6,3"
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
|
||||
@@ -80,19 +92,12 @@
|
||||
ToolTip="{x:Static my:Resources.OpenFeed}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Grid DockPanel.Dock="Right"
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Margin="6,3,6,6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static my:Resources.CloseButton}"
|
||||
Height="23"
|
||||
IsCancel="True"
|
||||
Width="75"
|
||||
Grid.Column="2" />
|
||||
</Grid>
|
||||
Grid.Column="0"
|
||||
Margin="0,6,0,0"
|
||||
Content="{x:Static my:Resources.CloseButton}"
|
||||
HorizontalAlignment="Right"
|
||||
IsCancel="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -9,10 +9,10 @@ using FeedCenter.Data;
|
||||
using FeedCenter.Options;
|
||||
using FeedCenter.Properties;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class FeedErrorWindow
|
||||
{
|
||||
public partial class FeedErrorWindow
|
||||
{
|
||||
private CollectionViewSource _collectionViewSource;
|
||||
|
||||
public FeedErrorWindow()
|
||||
@@ -81,10 +81,12 @@ namespace FeedCenter
|
||||
|
||||
private void SetFeedButtonStates()
|
||||
{
|
||||
EditFeedButton.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||
DeleteFeedButton.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||
RefreshCurrent.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||
OpenPage.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||
var feed = FeedDataGrid.SelectedItem as Feed;
|
||||
|
||||
EditFeedButton.IsEnabled = feed != null;
|
||||
DeleteFeedButton.IsEnabled = feed != null;
|
||||
RefreshCurrent.IsEnabled = feed != null;
|
||||
OpenPage.IsEnabled = feed != null && !string.IsNullOrEmpty(feed.Link);
|
||||
OpenFeed.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||
}
|
||||
|
||||
@@ -132,5 +134,9 @@ namespace FeedCenter
|
||||
Mouse.OverrideCursor = null;
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
private void FeedDataGrid_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
SetFeedButtonStates();
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
internal class AtomParser : FeedParserBase
|
||||
{
|
||||
internal class AtomParser : FeedParserBase
|
||||
{
|
||||
public AtomParser(Feed feed) : base(feed) { }
|
||||
|
||||
public override FeedReadResult ParseFeed(string feedText)
|
||||
@@ -139,5 +139,4 @@ namespace FeedCenter.FeedParsers
|
||||
|
||||
return node.Attributes[attributeName, node.NamespaceURI] ?? node.Attributes[attributeName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
internal enum FeedParseError
|
||||
{
|
||||
internal enum FeedParseError
|
||||
{
|
||||
Unknown = 0,
|
||||
InvalidXml = 1
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
internal class FeedParseException : ApplicationException
|
||||
{
|
||||
internal class FeedParseException : ApplicationException
|
||||
{
|
||||
public FeedParseException(FeedParseError feedParseError)
|
||||
{
|
||||
ParseError = feedParseError;
|
||||
}
|
||||
|
||||
public FeedParseError ParseError { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,19 +3,19 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
[Serializable]
|
||||
internal class InvalidFeedFormatException : ApplicationException
|
||||
{
|
||||
[Serializable]
|
||||
internal class InvalidFeedFormatException : ApplicationException
|
||||
{
|
||||
internal InvalidFeedFormatException(Exception exception)
|
||||
: base(string.Empty, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class FeedParserBase
|
||||
{
|
||||
internal abstract class FeedParserBase
|
||||
{
|
||||
#region Member variables
|
||||
|
||||
protected readonly Feed Feed;
|
||||
@@ -157,5 +157,4 @@ namespace FeedCenter.FeedParsers
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using Serilog;
|
||||
using System.Xml;
|
||||
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
internal class RdfParser : FeedParserBase
|
||||
{
|
||||
internal class RdfParser : FeedParserBase
|
||||
{
|
||||
public RdfParser(Feed feed) : base(feed) { }
|
||||
|
||||
public override FeedReadResult ParseFeed(string feedText)
|
||||
@@ -110,5 +110,4 @@ namespace FeedCenter.FeedParsers
|
||||
|
||||
return feedItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using Serilog;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace FeedCenter.FeedParsers
|
||||
namespace FeedCenter.FeedParsers;
|
||||
|
||||
internal class RssParser : FeedParserBase
|
||||
{
|
||||
internal class RssParser : FeedParserBase
|
||||
{
|
||||
public RssParser(Feed feed) : base(feed) { }
|
||||
|
||||
public override FeedReadResult ParseFeed(string feedText)
|
||||
@@ -119,5 +119,4 @@ namespace FeedCenter.FeedParsers
|
||||
|
||||
return feedItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Realms;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public class Category : RealmObject, INotifyDataErrorInfo
|
||||
{
|
||||
public class Category : RealmObject, INotifyDataErrorInfo
|
||||
{
|
||||
public const string DefaultName = "< default >";
|
||||
|
||||
private readonly DataErrorDictionary _dataErrorDictionary;
|
||||
@@ -72,5 +72,4 @@ namespace FeedCenter
|
||||
if (string.IsNullOrWhiteSpace(Name))
|
||||
_dataErrorDictionary.AddError(nameof(Name), "Name cannot be empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
internal class DataErrorDictionary : Dictionary<string, List<string>>
|
||||
{
|
||||
internal class DataErrorDictionary : Dictionary<string, List<string>>
|
||||
{
|
||||
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
|
||||
|
||||
private void OnErrorsChanged(string propertyName)
|
||||
@@ -39,5 +39,4 @@ namespace FeedCenter
|
||||
Remove(propertyName);
|
||||
OnErrorsChanged(propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,26 +20,26 @@ using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FeedCenter
|
||||
{
|
||||
#region Enumerations
|
||||
namespace FeedCenter;
|
||||
|
||||
public enum MultipleOpenAction
|
||||
{
|
||||
#region Enumerations
|
||||
|
||||
public enum MultipleOpenAction
|
||||
{
|
||||
IndividualPages,
|
||||
SinglePage
|
||||
}
|
||||
}
|
||||
|
||||
public enum FeedType
|
||||
{
|
||||
public enum FeedType
|
||||
{
|
||||
Unknown,
|
||||
Rss,
|
||||
Rdf,
|
||||
Atom
|
||||
}
|
||||
}
|
||||
|
||||
public enum FeedReadResult
|
||||
{
|
||||
public enum FeedReadResult
|
||||
{
|
||||
Success,
|
||||
NotModified,
|
||||
NotDue,
|
||||
@@ -52,13 +52,14 @@ namespace FeedCenter
|
||||
Timeout,
|
||||
ConnectionFailed,
|
||||
ServerError,
|
||||
Moved
|
||||
}
|
||||
Moved,
|
||||
TemporarilyUnavailable
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public partial class Feed : RealmObject, INotifyDataErrorInfo
|
||||
{
|
||||
public partial class Feed : RealmObject, INotifyDataErrorInfo
|
||||
{
|
||||
private static HttpClient _httpClient;
|
||||
|
||||
private readonly DataErrorDictionary _dataErrorDictionary;
|
||||
@@ -135,7 +136,26 @@ namespace FeedCenter
|
||||
}
|
||||
}
|
||||
|
||||
public string Password { get; set; }
|
||||
[MapTo("Password")]
|
||||
public string RawPassword { get; set; }
|
||||
|
||||
public string Password
|
||||
{
|
||||
get => RawPassword;
|
||||
set
|
||||
{
|
||||
RawPassword = value;
|
||||
|
||||
if (!Authenticate)
|
||||
{
|
||||
_dataErrorDictionary.ClearErrors(nameof(Password));
|
||||
return;
|
||||
}
|
||||
|
||||
ValidateString(nameof(Password), RawPassword);
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[MapTo("Name")]
|
||||
private string RawName { get; set; } = string.Empty;
|
||||
@@ -156,7 +176,27 @@ namespace FeedCenter
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
public string Username { get; set; }
|
||||
|
||||
[MapTo("Username")]
|
||||
public string RawUsername { get; set; }
|
||||
|
||||
public string Username
|
||||
{
|
||||
get => RawUsername;
|
||||
set
|
||||
{
|
||||
RawUsername = value;
|
||||
|
||||
if (!Authenticate)
|
||||
{
|
||||
_dataErrorDictionary.ClearErrors(nameof(Username));
|
||||
return;
|
||||
}
|
||||
|
||||
ValidateString(nameof(Username), RawUsername);
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasErrors => _dataErrorDictionary.Any();
|
||||
|
||||
@@ -228,7 +268,18 @@ namespace FeedCenter
|
||||
return new Tuple<FeedType, string>(FeedType.Unknown, string.Empty);
|
||||
}
|
||||
|
||||
return new Tuple<FeedType, string>(FeedParserBase.DetectFeedType(retrieveResult.Item2), retrieveResult.Item2);
|
||||
var feedType = FeedType.Unknown;
|
||||
|
||||
try
|
||||
{
|
||||
feedType = FeedParserBase.DetectFeedType(retrieveResult.Item2);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
|
||||
return new Tuple<FeedType, string>(feedType, retrieveResult.Item2);
|
||||
}
|
||||
|
||||
private Tuple<FeedReadResult, string> RetrieveFeed()
|
||||
@@ -299,6 +350,9 @@ namespace FeedCenter
|
||||
|
||||
switch (httpRequestException.StatusCode)
|
||||
{
|
||||
case HttpStatusCode.ServiceUnavailable:
|
||||
return Tuple.Create(FeedReadResult.TemporarilyUnavailable, string.Empty);
|
||||
|
||||
case HttpStatusCode.InternalServerError:
|
||||
return Tuple.Create(FeedReadResult.ServerError, string.Empty);
|
||||
|
||||
@@ -319,16 +373,12 @@ namespace FeedCenter
|
||||
if (httpRequestException.InnerException is not SocketException socketException)
|
||||
return Tuple.Create(FeedReadResult.UnknownError, string.Empty);
|
||||
|
||||
switch (socketException.SocketErrorCode)
|
||||
return socketException.SocketErrorCode switch
|
||||
{
|
||||
case SocketError.NoData:
|
||||
return Tuple.Create(FeedReadResult.NoResponse, string.Empty);
|
||||
|
||||
case SocketError.HostNotFound:
|
||||
return Tuple.Create(FeedReadResult.NotFound, string.Empty);
|
||||
}
|
||||
|
||||
return Tuple.Create(FeedReadResult.UnknownError, string.Empty);
|
||||
SocketError.NoData => Tuple.Create(FeedReadResult.NoResponse, string.Empty),
|
||||
SocketError.HostNotFound => Tuple.Create(FeedReadResult.NotFound, string.Empty),
|
||||
_ => Tuple.Create(FeedReadResult.UnknownError, string.Empty)
|
||||
};
|
||||
}
|
||||
catch (WebException webException)
|
||||
{
|
||||
@@ -446,5 +496,4 @@ namespace FeedCenter
|
||||
private static partial Regex UnescapedAmpersandRegex();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Text.RegularExpressions;
|
||||
using FeedCenter.Options;
|
||||
using Realms;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class FeedItem : RealmObject
|
||||
{
|
||||
public partial class FeedItem : RealmObject
|
||||
{
|
||||
public bool BeenRead { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
@@ -82,5 +82,4 @@ namespace FeedCenter
|
||||
|
||||
[GeneratedRegex("\\t")]
|
||||
private static partial Regex TabRegex();
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void DisplayCategory()
|
||||
{
|
||||
CategoryLabel.Text = string.Format(Properties.Resources.CategoryFilterHeader, _currentCategory == null ? Properties.Resources.AllCategory : _currentCategory.Name);
|
||||
@@ -96,5 +96,4 @@ namespace FeedCenter
|
||||
|
||||
Settings.Default.LastCategoryID = _currentCategory?.Id.ToString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void HandleCommandLine(string commandLine)
|
||||
{
|
||||
// If the command line is blank then ignore it
|
||||
@@ -34,5 +34,4 @@ namespace FeedCenter
|
||||
// Create a new feed using the URL
|
||||
HandleNewFeed(feedUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private readonly string[] _chromeExtensions = { "chrome-extension://ehojfdcmnajoklleckniaifaijfnkpbi/subscribe.html?", "chrome-extension://nlbjncdgjeocebhnmkbbbdekmmmcbfjd/subscribe.html?" };
|
||||
|
||||
private void HandleDragOver(object sender, DragEventArgs e)
|
||||
@@ -51,5 +51,4 @@ namespace FeedCenter
|
||||
// Handle the new feed but allow the drag/drop to complete
|
||||
Dispatcher.BeginInvoke(new NewFeedDelegate(HandleNewFeed), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private delegate void NewFeedDelegate(string feedUrl);
|
||||
|
||||
private static string GetAbsoluteUrlString(string baseUrl, string url)
|
||||
@@ -63,7 +64,17 @@ namespace FeedCenter
|
||||
}
|
||||
|
||||
// Read the feed for the first time
|
||||
var feedReadResult = feed.Read();
|
||||
var feedReadResult = feed.Read(true);
|
||||
|
||||
// Check to see if this might be rate limited
|
||||
if (feedReadResult == FeedReadResult.TemporarilyUnavailable)
|
||||
{
|
||||
// Wait a second
|
||||
Thread.Sleep(1000);
|
||||
|
||||
// Try to read again
|
||||
feedReadResult = feed.Read(true);
|
||||
}
|
||||
|
||||
// See if we read the feed okay
|
||||
if (feedReadResult == FeedReadResult.Success)
|
||||
@@ -77,6 +88,11 @@ namespace FeedCenter
|
||||
// Show a tip
|
||||
NotificationIcon.ShowBalloonTip(string.Format(Properties.Resources.FeedAddedNotification, feed.Name), System.Windows.Forms.ToolTipIcon.Info);
|
||||
|
||||
_currentFeed = feed;
|
||||
|
||||
// Refresh the database to current settings
|
||||
ResetDatabase();
|
||||
|
||||
// Re-initialize the feed display
|
||||
DisplayFeed();
|
||||
}
|
||||
@@ -88,15 +104,19 @@ namespace FeedCenter
|
||||
var dialogResult = feedForm.Display(feed, this);
|
||||
|
||||
// Display the new feed form
|
||||
if (dialogResult.HasValue && dialogResult.Value)
|
||||
{
|
||||
if (!dialogResult.HasValue || !dialogResult.Value)
|
||||
return;
|
||||
|
||||
// Add the feed to the feed table
|
||||
_database.SaveChanges(() => _database.Feeds.Add(feed));
|
||||
|
||||
_currentFeed = feed;
|
||||
|
||||
// Refresh the database to current settings
|
||||
ResetDatabase();
|
||||
|
||||
// Re-initialize the feed display
|
||||
DisplayFeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void HandleLinkTextListMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
switch (e.ChangedButton)
|
||||
@@ -131,5 +131,4 @@ namespace FeedCenter
|
||||
// Update the display
|
||||
DisplayFeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private BackgroundWorker _feedReadWorker;
|
||||
|
||||
private class FeedReadWorkerInput
|
||||
@@ -193,5 +193,4 @@ namespace FeedCenter
|
||||
// Sleep for a little bit so the user can see the update
|
||||
Thread.Sleep(Settings.Default.ProgressSleepInterval * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using FeedCenter.Properties;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void HandleHeaderLabelMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// Ignore if the window is locked
|
||||
@@ -29,5 +29,4 @@ namespace FeedCenter
|
||||
if (e.ClickCount == 2 && e.ChangedButton == MouseButton.Left)
|
||||
InstalledBrowser.OpenLink(Settings.Default.Browser, _currentFeed.Link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow : IDisposable
|
||||
{
|
||||
public partial class MainWindow : IDisposable
|
||||
{
|
||||
private Category _currentCategory;
|
||||
private Feed _currentFeed;
|
||||
private FeedCenterEntities _database;
|
||||
@@ -425,5 +425,4 @@ namespace FeedCenter
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private Timer _mainTimer;
|
||||
private DateTime _lastFeedRead;
|
||||
private DateTime _lastFeedDisplay;
|
||||
@@ -55,5 +55,4 @@ namespace FeedCenter
|
||||
// Get the timer going again
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ using ChrisKaczor.InstalledBrowsers;
|
||||
using FeedCenter.Options;
|
||||
using FeedCenter.Properties;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void HandlePreviousToolbarButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PreviousFeed();
|
||||
@@ -232,5 +232,4 @@ namespace FeedCenter
|
||||
|
||||
MarkAllItemsAsRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using FeedCenter.Properties;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private static void InitializeUpdate()
|
||||
{
|
||||
UpdateCheck.Initialize(ServerType.GitHub,
|
||||
@@ -36,5 +36,4 @@ namespace FeedCenter
|
||||
{
|
||||
UpdateCheck.DisplayUpdateInformation(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void LoadWindowSettings()
|
||||
{
|
||||
// Get the last window location
|
||||
@@ -169,5 +169,4 @@ namespace FeedCenter
|
||||
// Watch for setting changes
|
||||
Settings.Default.PropertyChanged += HandlePropertyChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using FeedCenter.Properties;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
internal static class NotificationIcon
|
||||
{
|
||||
internal static class NotificationIcon
|
||||
{
|
||||
private static MainWindow _mainForm;
|
||||
private static NotifyIcon _notificationIcon;
|
||||
|
||||
@@ -74,5 +74,4 @@ namespace FeedCenter
|
||||
{
|
||||
_notificationIcon.ShowBalloonTip(timeout, Resources.ApplicationDisplayName, text, icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using FeedCenter.Data;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class BulkFeedWindow
|
||||
{
|
||||
public partial class BulkFeedWindow
|
||||
{
|
||||
private List<CheckedListItem<Feed>> _checkedListBoxItems;
|
||||
private CollectionViewSource _collectionViewSource;
|
||||
|
||||
@@ -97,5 +97,4 @@ namespace FeedCenter.Options
|
||||
OpenLabel.IsEnabled = !OpenLabel.IsEnabled;
|
||||
OpenComboBox.IsEnabled = !OpenComboBox.IsEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
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"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Category}"
|
||||
Title="CategoryWindow"
|
||||
Width="300"
|
||||
@@ -28,42 +29,23 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid Margin="6">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="0">
|
||||
<TextBox Name="NameTextBox"
|
||||
VerticalAlignment="Center"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
<StackPanel Margin="6"
|
||||
options:Spacing.Vertical="5">
|
||||
<TextBox mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.categoryNameLabel}"
|
||||
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
mah:TextBoxHelper.SelectAllOnFocus="True"
|
||||
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
options:Spacing.Horizontal="5"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="{x:Static properties:Resources.OkayButton}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
Margin="0,0,5,0"
|
||||
IsDefault="True"
|
||||
Click="HandleOkayButtonClick" />
|
||||
<Button Content="{x:Static properties:Resources.CancelButton}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
IsCancel="True" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -2,10 +2,10 @@
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using FeedCenter.Data;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class CategoryWindow
|
||||
{
|
||||
public partial class CategoryWindow
|
||||
{
|
||||
public CategoryWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -47,5 +47,4 @@ namespace FeedCenter.Options
|
||||
// Close the dialog
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Feed}"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
mc:Ignorable="d"
|
||||
Title="FeedWindow"
|
||||
Height="300"
|
||||
Height="350"
|
||||
Width="450"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Icon="/FeedCenter;component/Resources/Application.ico"
|
||||
@@ -23,175 +25,117 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<TabControl Name="OptionsTabControl"
|
||||
Margin="12,12,12,41">
|
||||
<TabItem Header="{x:Static properties:Resources.generalTab}">
|
||||
<Grid>
|
||||
<Grid Margin="6">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="{x:Static properties:Resources.feedUrlLabel}"
|
||||
VerticalContentAlignment="Center"
|
||||
Target="{Binding ElementName=UrlTextBox}"
|
||||
Margin="6"
|
||||
Padding="0" />
|
||||
<TextBox Name="UrlTextBox"
|
||||
<TabControl Name="OptionsTabControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="6"
|
||||
Grid.Column="0"
|
||||
mah:HeaderedControlHelper.HeaderFontSize="16"
|
||||
mah:TabControlHelper.Underlined="SelectedTabItem">
|
||||
<TabItem Header="{x:Static properties:Resources.generalTab}">
|
||||
<StackPanel Margin="0,4"
|
||||
options:Spacing.Vertical="8">
|
||||
<TextBox Name="UrlTextBox"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.feedUrlLabel}"
|
||||
mah:TextBoxHelper.SelectAllOnFocus="True"
|
||||
Text="{Binding Path=Source, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<Label Content="{x:Static properties:Resources.feedNameLabel}"
|
||||
VerticalContentAlignment="Center"
|
||||
Target="{Binding ElementName=NameTextBox}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="6"
|
||||
Padding="0" />
|
||||
<TextBox Name="NameTextBox"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Margin="6"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.feedNameLabel}"
|
||||
mah:TextBoxHelper.SelectAllOnFocus="True"
|
||||
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<Label Content="{x:Static properties:Resources.feedCategoryLabel}"
|
||||
Target="{Binding ElementName=CategoryComboBox}"
|
||||
VerticalContentAlignment="Center"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="6"
|
||||
Padding="0" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Name="CategoryComboBox"
|
||||
<ComboBox Name="CategoryComboBox"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedValuePath="ID"
|
||||
SelectedValue="{Binding Path=Category.Id}"
|
||||
Grid.Row="2"
|
||||
Margin="6" />
|
||||
<CheckBox Grid.ColumnSpan="2"
|
||||
Grid.Column="0"
|
||||
Name="ReadIntervalCheckBox"
|
||||
SelectedValuePath="Id"
|
||||
SelectedValue="{Binding Path=CategoryId}"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.feedCategoryLabel}" />
|
||||
|
||||
<CheckBox Name="ReadIntervalCheckBox"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=Enabled, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}"
|
||||
Grid.Row="3"
|
||||
Margin="6">
|
||||
<DockPanel>
|
||||
IsChecked="{Binding Path=Enabled, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{x:Static properties:Resources.feedReadIntervalPrefix}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
Padding="0" />
|
||||
<TextBox Width="50"
|
||||
Text="{Binding Path=CheckInterval, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}"
|
||||
IsEnabled="{Binding ElementName=ReadIntervalCheckBox, Path=IsChecked}" />
|
||||
<mah:NumericUpDown Width="100"
|
||||
Maximum="10080"
|
||||
Minimum="1"
|
||||
IsEnabled="{Binding ElementName=ReadIntervalCheckBox, Path=IsChecked}"
|
||||
Value="{Binding CheckInterval, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<Label Content="{x:Static properties:Resources.feedReadIntervalSuffix}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Padding="0" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static properties:Resources.readingTab}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="{x:Static properties:Resources.openLabel}"
|
||||
Target="{Binding ElementName=OpenComboBox}"
|
||||
Padding="0"
|
||||
VerticalContentAlignment="Center"
|
||||
Margin="6" />
|
||||
<StackPanel Margin="0,4"
|
||||
options:Spacing.Vertical="8">
|
||||
<ComboBox Name="OpenComboBox"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectedValue="{Binding Path=MultipleOpenAction, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=true}"
|
||||
SelectedValuePath="Tag"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="6">
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.openLabel}">
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.openAllSingleToolbarButton}"
|
||||
Tag="{x:Static feedCenter:MultipleOpenAction.SinglePage}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.openAllMultipleToolbarButton}"
|
||||
Tag="{x:Static feedCenter:MultipleOpenAction.IndividualPages}" />
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static properties:Resources.authenticationTab}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="0,4">
|
||||
<CheckBox Content="{x:Static properties:Resources.requiresAuthenticationCheckBox}"
|
||||
Margin="0,0,0,4"
|
||||
Name="RequiresAuthenticationCheckBox"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
IsChecked="{Binding Path=Authenticate, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}"
|
||||
Margin="6" />
|
||||
<Label Content="{x:Static properties:Resources.authenticationUserNameLabel}"
|
||||
Target="{Binding ElementName=AuthenticationUserNameTextBox}"
|
||||
VerticalContentAlignment="Center"
|
||||
IsEnabled="{Binding ElementName=RequiresAuthenticationCheckBox, Path=IsChecked}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="6"
|
||||
Padding="20,0,0,0" />
|
||||
IsChecked="{Binding Path=Authenticate, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<TextBox Name="AuthenticationUserNameTextBox"
|
||||
Grid.Column="1"
|
||||
Margin="25,0,0,4"
|
||||
IsEnabled="{Binding ElementName=RequiresAuthenticationCheckBox, Path=IsChecked}"
|
||||
Grid.Row="1"
|
||||
Margin="6"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.authenticationUserNameLabel}"
|
||||
Text="{Binding Path=Username, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||
<Label Content="{x:Static properties:Resources.authenticationPasswordLabel}"
|
||||
Target="{Binding ElementName=AuthenticationPasswordTextBox}"
|
||||
VerticalContentAlignment="Center"
|
||||
IsEnabled="{Binding ElementName=RequiresAuthenticationCheckBox, Path=IsChecked}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="6"
|
||||
Padding="20,0,0,0" />
|
||||
<PasswordBox Name="AuthenticationPasswordTextBox"
|
||||
Grid.Column="1"
|
||||
IsEnabled="{Binding ElementName=RequiresAuthenticationCheckBox, Path=IsChecked}"
|
||||
Grid.Row="2"
|
||||
Margin="6" />
|
||||
</Grid>
|
||||
Margin="25,0,0,8"
|
||||
Style="{StaticResource MahApps.Styles.PasswordBox.Button.Revealed}"
|
||||
mah:PasswordBoxBindingBehavior.Password="{Binding Password, UpdateSourceTrigger=Explicit, ValidatesOnDataErrors=True}"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.authenticationPasswordLabel}"
|
||||
IsEnabled="{Binding ElementName=RequiresAuthenticationCheckBox, Path=IsChecked}" />
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="{x:Static properties:Resources.OkayButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
Margin="0,0,5,0"
|
||||
IsDefault="True"
|
||||
Margin="0,0,93,12"
|
||||
Click="HandleOkayButtonClick" />
|
||||
<Button Content="{x:Static properties:Resources.CancelButton}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="75"
|
||||
IsCancel="True"
|
||||
Margin="0,0,12,12" />
|
||||
IsCancel="True" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,15 +1,11 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using FeedCenter.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class FeedWindow
|
||||
{
|
||||
public partial class FeedWindow
|
||||
{
|
||||
public FeedWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -17,19 +13,14 @@ namespace FeedCenter.Options
|
||||
|
||||
public bool? Display(Feed feed, Window owner)
|
||||
{
|
||||
// Bind the category combo box
|
||||
CategoryComboBox.ItemsSource = Database.Entities.Categories;
|
||||
|
||||
// Set the data context
|
||||
DataContext = feed;
|
||||
|
||||
// Set the title based on the state of the feed
|
||||
Title = string.IsNullOrWhiteSpace(feed.Link) ? Properties.Resources.FeedWindowAdd : Properties.Resources.FeedWindowEdit;
|
||||
|
||||
// Set the window owner
|
||||
Owner = owner;
|
||||
|
||||
// Show the dialog and result the result
|
||||
return ShowDialog();
|
||||
}
|
||||
|
||||
@@ -37,60 +28,17 @@ namespace FeedCenter.Options
|
||||
{
|
||||
var transaction = Database.Entities.BeginTransaction();
|
||||
|
||||
var feed = (Feed) DataContext;
|
||||
|
||||
// Get a list of all framework elements and explicit binding expressions
|
||||
var bindingExpressions = this.GetBindingExpressions(new[] { UpdateSourceTrigger.Explicit });
|
||||
|
||||
// Loop over each binding expression and clear any existing error
|
||||
this.ClearAllValidationErrors(bindingExpressions);
|
||||
|
||||
// Force all explicit bindings to update the source
|
||||
this.UpdateAllSources(bindingExpressions);
|
||||
|
||||
// See if there are any errors
|
||||
var hasError = bindingExpressions.Any(b => b.BindingExpression.HasError);
|
||||
|
||||
// If there was an error then set focus to the bad controls
|
||||
if (hasError)
|
||||
if (!this.IsValid(OptionsTabControl))
|
||||
{
|
||||
// Get the first framework element with an error
|
||||
var firstErrorElement = bindingExpressions.First(b => b.BindingExpression.HasError).FrameworkElement;
|
||||
|
||||
// Loop over each tab item
|
||||
foreach (TabItem tabItem in OptionsTabControl.Items)
|
||||
{
|
||||
// Cast the content as visual
|
||||
var content = (Visual) tabItem.Content;
|
||||
|
||||
// See if the control with the error is a descendant
|
||||
if (firstErrorElement.IsDescendantOf(content))
|
||||
{
|
||||
// Select the tab
|
||||
tabItem.IsSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set focus
|
||||
firstErrorElement.Focus();
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (RequiresAuthenticationCheckBox.IsChecked.GetValueOrDefault(false))
|
||||
feed.Password = AuthenticationPasswordTextBox.Password;
|
||||
|
||||
transaction.Commit();
|
||||
Database.Entities.Refresh();
|
||||
|
||||
// Dialog is good
|
||||
DialogResult = true;
|
||||
|
||||
// Close the dialog
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ using System.Xml;
|
||||
using FeedCenter.Data;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class FeedsOptionsPanel
|
||||
{
|
||||
public partial class FeedsOptionsPanel
|
||||
{
|
||||
private CollectionViewSource _collectionViewSource;
|
||||
|
||||
public FeedsOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||
@@ -421,5 +421,4 @@ namespace FeedCenter.Options
|
||||
{
|
||||
SetFeedButtonStates();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public enum MultipleLineDisplay
|
||||
{
|
||||
public enum MultipleLineDisplay
|
||||
{
|
||||
Normal,
|
||||
SingleLine,
|
||||
FirstLine
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class OptionsWindow
|
||||
{
|
||||
public partial class OptionsWindow
|
||||
{
|
||||
private readonly List<OptionsPanelBase> _optionPanels = new();
|
||||
|
||||
public OptionsWindow()
|
||||
@@ -72,5 +72,4 @@ namespace FeedCenter.Options
|
||||
return Panel.CategoryName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using Realms;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class Setting : RealmObject
|
||||
{
|
||||
public class Setting : RealmObject
|
||||
{
|
||||
[PrimaryKey]
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
[Ignored]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using JetBrains.Annotations;
|
||||
using System.Windows;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class Spacing
|
||||
{
|
||||
public class Spacing
|
||||
{
|
||||
public static double GetHorizontal(DependencyObject obj)
|
||||
{
|
||||
return (double) obj.GetValue(HorizontalProperty);
|
||||
@@ -51,5 +51,4 @@ namespace FeedCenter.Options
|
||||
public static readonly DependencyProperty HorizontalProperty =
|
||||
DependencyProperty.RegisterAttached("Horizontal", typeof(double), typeof(Spacing),
|
||||
new UIPropertyMetadata(0d, HorizontalChangedCallback));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class UserAgentItem
|
||||
{
|
||||
public class UserAgentItem
|
||||
{
|
||||
public string Caption { get; set; }
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
@@ -30,5 +30,4 @@ namespace FeedCenter.Options
|
||||
UserAgent = "curl/7.47.0"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
12
Application/Properties/Resources.Designer.cs
generated
12
Application/Properties/Resources.Designer.cs
generated
@@ -134,7 +134,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Password:.
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
public static string authenticationPasswordLabel {
|
||||
get {
|
||||
@@ -152,7 +152,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _User name:.
|
||||
/// Looks up a localized string similar to User name.
|
||||
/// </summary>
|
||||
public static string authenticationUserNameLabel {
|
||||
get {
|
||||
@@ -679,7 +679,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Category:.
|
||||
/// Looks up a localized string similar to Category.
|
||||
/// </summary>
|
||||
public static string feedCategoryLabel {
|
||||
get {
|
||||
@@ -760,7 +760,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Feed _name:.
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
public static string feedNameLabel {
|
||||
get {
|
||||
@@ -868,7 +868,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Feed _URL:.
|
||||
/// Looks up a localized string similar to URL.
|
||||
/// </summary>
|
||||
public static string feedUrlLabel {
|
||||
get {
|
||||
@@ -1102,7 +1102,7 @@ namespace FeedCenter.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to "Open all" _action:.
|
||||
/// Looks up a localized string similar to "Open all" action.
|
||||
/// </summary>
|
||||
public static string openLabel {
|
||||
get {
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
<value>Authentication</value>
|
||||
</data>
|
||||
<data name="feedNameLabel" xml:space="preserve">
|
||||
<value>Feed _name:</value>
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="feedReadIntervalPrefix" xml:space="preserve">
|
||||
<value>_Refresh feed every</value>
|
||||
@@ -275,7 +275,7 @@
|
||||
<value>minutes</value>
|
||||
</data>
|
||||
<data name="feedUrlLabel" xml:space="preserve">
|
||||
<value>Feed _URL:</value>
|
||||
<value>URL</value>
|
||||
</data>
|
||||
<data name="FeedWindowAdd" xml:space="preserve">
|
||||
<value>Add Feed</value>
|
||||
@@ -293,10 +293,10 @@
|
||||
<value>_Check for a new version on startup</value>
|
||||
</data>
|
||||
<data name="authenticationPasswordLabel" xml:space="preserve">
|
||||
<value>_Password:</value>
|
||||
<value>Password</value>
|
||||
</data>
|
||||
<data name="authenticationUserNameLabel" xml:space="preserve">
|
||||
<value>_User name:</value>
|
||||
<value>User name</value>
|
||||
</data>
|
||||
<data name="requiresAuthenticationCheckBox" xml:space="preserve">
|
||||
<value>_Feed requires authentication</value>
|
||||
@@ -353,7 +353,7 @@
|
||||
<value>< Windows Default ></value>
|
||||
</data>
|
||||
<data name="feedCategoryLabel" xml:space="preserve">
|
||||
<value>_Category:</value>
|
||||
<value>Category</value>
|
||||
</data>
|
||||
<data name="optionCategoryCategories" xml:space="preserve">
|
||||
<value>Categories</value>
|
||||
@@ -407,7 +407,7 @@
|
||||
<value>Reading</value>
|
||||
</data>
|
||||
<data name="openLabel" xml:space="preserve">
|
||||
<value>"Open all" _action:</value>
|
||||
<value>"Open all" action</value>
|
||||
</data>
|
||||
<data name="DatabaseUpdate_5" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Scripts\DatabaseUpdate_5.sqlce;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
|
||||
@@ -3,10 +3,10 @@ using FeedCenter.Options;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public static class SettingsStore
|
||||
{
|
||||
public static class SettingsStore
|
||||
{
|
||||
public static object OpenDataStore()
|
||||
{
|
||||
if (!Database.Exists)
|
||||
@@ -52,5 +52,4 @@ namespace FeedCenter
|
||||
setting.Value = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace FeedCenter
|
||||
namespace FeedCenter;
|
||||
|
||||
public static class SystemConfiguration
|
||||
{
|
||||
public static class SystemConfiguration
|
||||
{
|
||||
private static bool UseDebugPath => Environment.CommandLine.IndexOf("/debugPath", StringComparison.InvariantCultureIgnoreCase) != -1;
|
||||
|
||||
public static string DataDirectory => UseDebugPath ? Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) : UserSettingsPath;
|
||||
@@ -31,5 +31,4 @@ namespace FeedCenter
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user