mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-16 10:58:31 -05:00
Start adding Miniflux support plus other cleanup
- Modernize old async code - Update to .NET 10 - Adjust namespace - Bypass update check when debugging
This commit is contained in:
@@ -1,24 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class AccountTypeItem
|
||||
{
|
||||
public class AccountTypeItem
|
||||
{
|
||||
public AccountType AccountType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public AccountType AccountType { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public static List<AccountTypeItem> AccountTypes =>
|
||||
[
|
||||
new()
|
||||
{
|
||||
Name = Properties.Resources.AccountTypeFever,
|
||||
AccountType = AccountType.Fever
|
||||
},
|
||||
//new()
|
||||
//{
|
||||
// Name = Properties.Resources.AccountTypeGoogleReader,
|
||||
// AccountType = AccountType.GoogleReader
|
||||
//}
|
||||
];
|
||||
}
|
||||
public static List<AccountTypeItem> AccountTypes =>
|
||||
[
|
||||
new()
|
||||
{
|
||||
Name = Properties.Resources.AccountTypeFever,
|
||||
AccountType = AccountType.Fever
|
||||
},
|
||||
//new()
|
||||
//{
|
||||
// Name = Properties.Resources.AccountTypeGoogleReader,
|
||||
// AccountType = AccountType.GoogleReader
|
||||
//}
|
||||
new()
|
||||
{
|
||||
Name = Properties.Resources.AccountTypeMiniflux,
|
||||
AccountType = AccountType.Miniflux
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:feedCenter="clr-namespace:FeedCenter"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Account}"
|
||||
d:DataContext="{d:DesignInstance Type=feeds:Account}"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
mc:Ignorable="d"
|
||||
Title="AccountWindow"
|
||||
Height="350"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using FeedCenter.Feeds;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
@@ -33,46 +34,46 @@ public partial class AccountWindow
|
||||
return ShowDialog();
|
||||
}
|
||||
|
||||
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
||||
private async void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var transaction = _entities.BeginTransaction();
|
||||
|
||||
if (!this.IsValid(OptionsTabControl))
|
||||
try
|
||||
{
|
||||
transaction.Rollback();
|
||||
return;
|
||||
}
|
||||
var transaction = _entities.BeginTransaction();
|
||||
|
||||
if (_isNew)
|
||||
{
|
||||
_entities.Accounts.Add(_account);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
|
||||
var accountId = _account.Id;
|
||||
|
||||
AccountReadProgressBar.Value = 0;
|
||||
AccountReadProgressBar.Maximum = _account.GetProgressSteps(_entities) + 1;
|
||||
|
||||
AccountReadProgress.Visibility = Visibility.Visible;
|
||||
ButtonPanel.Visibility = Visibility.Collapsed;
|
||||
|
||||
var dispatcher = Dispatcher.CurrentDispatcher;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var entities = new FeedCenterEntities();
|
||||
var account = entities.Accounts.First(a => a.Id == accountId);
|
||||
var accountReadInput = new AccountReadInput(entities, null, true, () => dispatcher.Invoke(() => AccountReadProgressBar.Value++));
|
||||
account.Read(accountReadInput);
|
||||
|
||||
dispatcher.Invoke(() =>
|
||||
if (!this.IsValid(OptionsTabControl))
|
||||
{
|
||||
DialogResult = true;
|
||||
transaction.Rollback();
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
});
|
||||
});
|
||||
if (_isNew)
|
||||
{
|
||||
_entities.Accounts.Add(_account);
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
|
||||
var accountId = _account.Id;
|
||||
|
||||
var accountReadInput = new AccountReadInput(_entities, null, true, () => AccountReadProgressBar.Value++);
|
||||
|
||||
AccountReadProgressBar.Value = 0;
|
||||
AccountReadProgressBar.Maximum = await _account.GetProgressSteps(_account, accountReadInput);
|
||||
|
||||
AccountReadProgress.Visibility = Visibility.Visible;
|
||||
ButtonPanel.Visibility = Visibility.Collapsed;
|
||||
|
||||
//var entities = new FeedCenterEntities();
|
||||
var account = _entities.Accounts.First(a => a.Id == accountId);
|
||||
await account.Read(accountReadInput);
|
||||
|
||||
DialogResult = true;
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MainWindow.HandleException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
|
||||
xmlns:feedCenter="clr-namespace:FeedCenter"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="311"
|
||||
d:DesignWidth="425">
|
||||
@@ -46,7 +47,7 @@
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
AllowDrop="True"
|
||||
Background="{x:Null}"
|
||||
d:DataContext="{d:DesignInstance feedCenter:Account }">
|
||||
d:DataContext="{d:DesignInstance feeds:Account }">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}"
|
||||
Header="{x:Static properties:Resources.AccountNameColumnHeader}"
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:options="clr-namespace:FeedCenter.Options"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Icon="/FeedCenter;component/Resources/Application.ico"
|
||||
FocusManager.FocusedElement="{Binding ElementName=FeedLinkFilterText}">
|
||||
@@ -99,9 +100,9 @@
|
||||
mah:TextBoxHelper.Watermark="{x:Static my:Resources.openLabel}"
|
||||
IsEnabled="{Binding ElementName=OpenCheckBox, Path=IsChecked}">
|
||||
<ComboBoxItem Content="{x:Static my:Resources.openAllMultipleToolbarButton}"
|
||||
Tag="{x:Static feedCenter:MultipleOpenAction.IndividualPages}" />
|
||||
Tag="{x:Static feeds:MultipleOpenAction.IndividualPages}" />
|
||||
<ComboBoxItem Content="{x:Static my:Resources.openAllSingleToolbarButton}"
|
||||
Tag="{x:Static feedCenter:MultipleOpenAction.SinglePage}" />
|
||||
Tag="{x:Static feeds:MultipleOpenAction.SinglePage}" />
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="0"
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
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}"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
d:DataContext="{d:DesignInstance Type=feeds:Category}"
|
||||
Title="CategoryWindow"
|
||||
Width="300"
|
||||
ResizeMode="NoResize"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using System.Windows;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
namespace FeedCenter.Options
|
||||
{
|
||||
public class CheckedFeedListItem : CheckedListItem<Feed>
|
||||
{
|
||||
}
|
||||
}
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public class CheckedFeedListItem : CheckedListItem<Feeds.Feed>;
|
||||
@@ -4,10 +4,11 @@
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:feedCenter="clr-namespace:FeedCenter"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d:DataContext="{d:DesignInstance Type=feedCenter:Feed}"
|
||||
d:DataContext="{d:DesignInstance Type=feeds: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"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
mc:Ignorable="d"
|
||||
Title="FeedWindow"
|
||||
Height="350"
|
||||
@@ -90,9 +91,9 @@
|
||||
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}" />
|
||||
Tag="{x:Static feeds:MultipleOpenAction.SinglePage}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.openAllMultipleToolbarButton}"
|
||||
Tag="{x:Static feedCenter:MultipleOpenAction.IndividualPages}" />
|
||||
Tag="{x:Static feeds:MultipleOpenAction.IndividualPages}" />
|
||||
</ComboBox>
|
||||
<ComboBox Name="UserAgentComboBox"
|
||||
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class FeedWindow
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool? Display(Feed feed, Window owner)
|
||||
public bool? Display(Feeds.Feed feed, Window owner)
|
||||
{
|
||||
CategoryComboBox.ItemsSource = _entities.Categories;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
xmlns:properties="clr-namespace:FeedCenter.Properties"
|
||||
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
|
||||
xmlns:feedCenter="clr-namespace:FeedCenter"
|
||||
xmlns:feeds="clr-namespace:FeedCenter.Feeds"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="311"
|
||||
d:DesignWidth="425">
|
||||
@@ -45,7 +46,7 @@
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
AllowDrop="True"
|
||||
Background="{x:Null}"
|
||||
d:DataContext="{d:DesignInstance feedCenter:Category }">
|
||||
d:DataContext="{d:DesignInstance feeds:Category }">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}"
|
||||
Header="{x:Static properties:Resources.CategoryNameColumnHeader}"
|
||||
@@ -80,7 +81,7 @@
|
||||
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||
Background="{x:Null}"
|
||||
SelectionChanged="HandleFeedDataGridSelectionChanged"
|
||||
d:DataContext="{d:DesignInstance feedCenter:Feed }">
|
||||
d:DataContext="{d:DesignInstance feeds:Feed }">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}"
|
||||
Header="{x:Static properties:Resources.FeedNameColumnHeader}"
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Xml;
|
||||
using FeedCenter.Feeds;
|
||||
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class UserAgentItem
|
||||
{
|
||||
new UserAgentItem
|
||||
{
|
||||
Caption = Properties.Resources.ApplicationUserAgentCaption,
|
||||
Caption = Resources.ApplicationUserAgentCaption,
|
||||
UserAgent = string.Empty
|
||||
},
|
||||
new UserAgentItem
|
||||
|
||||
Reference in New Issue
Block a user