mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-16 18:47:28 -05:00
More cleanup and UI work
This commit is contained in:
@@ -193,7 +193,7 @@ public static class LegacyDatabase
|
|||||||
|
|
||||||
foreach (var feed in feeds)
|
foreach (var feed in feeds)
|
||||||
{
|
{
|
||||||
feed.Category = categories.FirstOrDefault(c => c.Id == feed.CategoryId);
|
feed.CategoryId = categories.First(c => c.Id == feed.CategoryId).Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var feedItem in feedItems)
|
foreach (var feedItem in feedItems)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace FeedCenter
|
|||||||
{
|
{
|
||||||
var feed = (Feed) e.Item;
|
var feed = (Feed) e.Item;
|
||||||
|
|
||||||
e.Accepted = (feed.LastReadResult != FeedReadResult.Success);
|
e.Accepted = feed.LastReadResult != FeedReadResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleEditFeedButtonClick(object sender, RoutedEventArgs e)
|
private void HandleEditFeedButtonClick(object sender, RoutedEventArgs e)
|
||||||
@@ -79,11 +79,11 @@ namespace FeedCenter
|
|||||||
|
|
||||||
private void SetFeedButtonStates()
|
private void SetFeedButtonStates()
|
||||||
{
|
{
|
||||||
EditFeedButton.IsEnabled = (FeedDataGrid.SelectedItem != null);
|
EditFeedButton.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||||
DeleteFeedButton.IsEnabled = (FeedDataGrid.SelectedItem != null);
|
DeleteFeedButton.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||||
RefreshCurrent.IsEnabled = (FeedDataGrid.SelectedItem != null);
|
RefreshCurrent.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||||
OpenPage.IsEnabled = (FeedDataGrid.SelectedItem != null);
|
OpenPage.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||||
OpenFeed.IsEnabled = (FeedDataGrid.SelectedItem != null);
|
OpenFeed.IsEnabled = FeedDataGrid.SelectedItem != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleOpenPageButtonClick(object sender, RoutedEventArgs e)
|
private void HandleOpenPageButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace FeedCenter.FeedParsers
|
|||||||
if (childNode.Attributes != null)
|
if (childNode.Attributes != null)
|
||||||
{
|
{
|
||||||
var permaLinkNode = childNode.Attributes.GetNamedItem("isPermaLink");
|
var permaLinkNode = childNode.Attributes.GetNamedItem("isPermaLink");
|
||||||
permaLink = (permaLinkNode == null || permaLinkNode.Value == "true");
|
permaLink = permaLinkNode == null || permaLinkNode.Value == "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permaLink && Uri.IsWellFormedUriString(feedItem.Guid, UriKind.Absolute))
|
if (permaLink && Uri.IsWellFormedUriString(feedItem.Guid, UriKind.Absolute))
|
||||||
|
|||||||
@@ -93,8 +93,6 @@ namespace FeedCenter
|
|||||||
set => MultipleOpenActionRaw = value.ToString();
|
set => MultipleOpenActionRaw = value.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category Category { get; set; }
|
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public IList<FeedItem> Items { get; }
|
public IList<FeedItem> Items { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace FeedCenter
|
|||||||
_currentCategory = category;
|
_currentCategory = category;
|
||||||
|
|
||||||
// Get the current feed list to match the category
|
// Get the current feed list to match the category
|
||||||
_feedList = _currentCategory == null ? _database.Feeds : _database.Feeds.Where(feed => feed.Category.Id == _currentCategory.Id);
|
_feedList = _currentCategory == null ? _database.Feeds : _database.Feeds.Where(feed => feed.CategoryId == _currentCategory.Id);
|
||||||
|
|
||||||
// Refresh the feed index
|
// Refresh the feed index
|
||||||
_feedIndex = -1;
|
_feedIndex = -1;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace FeedCenter
|
|||||||
// Create and configure the new feed
|
// Create and configure the new feed
|
||||||
var feed = Feed.Create();
|
var feed = Feed.Create();
|
||||||
feed.Source = feedUrl;
|
feed.Source = feedUrl;
|
||||||
feed.Category = _database.DefaultCategory;
|
feed.CategoryId = _database.DefaultCategory.Id;
|
||||||
|
|
||||||
// Try to detect the feed type
|
// Try to detect the feed type
|
||||||
var feedTypeResult = feed.DetectFeedType();
|
var feedTypeResult = feed.DetectFeedType();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace FeedCenter
|
|||||||
LoadWindowSettings();
|
LoadWindowSettings();
|
||||||
|
|
||||||
// Set the foreground color to something that can be seen
|
// Set the foreground color to something that can be seen
|
||||||
LinkTextList.Foreground = (System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5)
|
LinkTextList.Foreground = System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5
|
||||||
? Brushes.White
|
? Brushes.White
|
||||||
: Brushes.Black;
|
: Brushes.Black;
|
||||||
HeaderLabel.Foreground = LinkTextList.Foreground;
|
HeaderLabel.Foreground = LinkTextList.Foreground;
|
||||||
@@ -153,7 +153,7 @@ namespace FeedCenter
|
|||||||
|
|
||||||
_feedList = _currentCategory == null
|
_feedList = _currentCategory == null
|
||||||
? _database.Feeds.ToList()
|
? _database.Feeds.ToList()
|
||||||
: _database.Feeds.Where(feed => feed.Category.Id == _currentCategory.Id).ToList();
|
: _database.Feeds.Where(feed => feed.CategoryId == _currentCategory.Id).ToList();
|
||||||
|
|
||||||
UpdateToolbarButtonState();
|
UpdateToolbarButtonState();
|
||||||
|
|
||||||
@@ -178,9 +178,9 @@ namespace FeedCenter
|
|||||||
_feedIndex = newIndex;
|
_feedIndex = newIndex;
|
||||||
|
|
||||||
// Re-get the current feed
|
// Re-get the current feed
|
||||||
_currentFeed = (_feedIndex == -1
|
_currentFeed = _feedIndex == -1
|
||||||
? null
|
? null
|
||||||
: _feedList.OrderBy(feed => feed.Name).AsEnumerable().ElementAt(_feedIndex));
|
: _feedList.OrderBy(feed => feed.Name).AsEnumerable().ElementAt(_feedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -215,7 +215,7 @@ namespace FeedCenter
|
|||||||
// Get the current feed list to match the category
|
// Get the current feed list to match the category
|
||||||
_feedList = _currentCategory == null
|
_feedList = _currentCategory == null
|
||||||
? _database.Feeds
|
? _database.Feeds
|
||||||
: _database.Feeds.Where(feed => feed.Category.Id == _currentCategory.Id);
|
: _database.Feeds.Where(feed => feed.CategoryId == _currentCategory.Id);
|
||||||
|
|
||||||
UpdateToolbarButtonState();
|
UpdateToolbarButtonState();
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ namespace FeedCenter
|
|||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
// Remember our starting position
|
// Remember our starting position
|
||||||
var startIndex = (_feedIndex == -1 ? 0 : _feedIndex);
|
var startIndex = _feedIndex == -1 ? 0 : _feedIndex;
|
||||||
|
|
||||||
// Increment the index and adjust if we've gone around the end
|
// Increment the index and adjust if we've gone around the end
|
||||||
_feedIndex = (_feedIndex + 1) % feedCount;
|
_feedIndex = (_feedIndex + 1) % feedCount;
|
||||||
@@ -319,7 +319,7 @@ namespace FeedCenter
|
|||||||
var found = false;
|
var found = false;
|
||||||
|
|
||||||
// Remember our starting position
|
// Remember our starting position
|
||||||
var startIndex = (_feedIndex == -1 ? 0 : _feedIndex);
|
var startIndex = _feedIndex == -1 ? 0 : _feedIndex;
|
||||||
|
|
||||||
// Decrement the feed index
|
// Decrement the feed index
|
||||||
_feedIndex--;
|
_feedIndex--;
|
||||||
@@ -392,7 +392,7 @@ namespace FeedCenter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the header to the feed title
|
// Set the header to the feed title
|
||||||
FeedLabel.Text = (_currentFeed.Name.Length > 0 ? _currentFeed.Name : _currentFeed.Title);
|
FeedLabel.Text = _currentFeed.Name.Length > 0 ? _currentFeed.Name : _currentFeed.Title;
|
||||||
FeedButton.Visibility = _feedList.Count() > 1 ? Visibility.Visible : Visibility.Hidden;
|
FeedButton.Visibility = _feedList.Count() > 1 ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
// Clear the current list
|
// Clear the current list
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace FeedCenter
|
|||||||
private void HandleDeleteCurrentFeedMenuItemClick(object sender, RoutedEventArgs e)
|
private void HandleDeleteCurrentFeedMenuItemClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Confirm this delete since it is for real
|
// Confirm this delete since it is for real
|
||||||
if (MessageBox.Show(this, Properties.Resources.ConfirmDelete, string.Empty, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
if (MessageBox.Show(this, Properties.Resources.ConfirmDeleteFeed, string.Empty, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the current feed
|
// Get the current feed
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
using ChrisKaczor.ApplicationUpdate;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Windows;
|
||||||
|
using ChrisKaczor.ApplicationUpdate;
|
||||||
|
|
||||||
namespace FeedCenter.Options;
|
namespace FeedCenter.Options;
|
||||||
|
|
||||||
public partial class AboutOptionsPanel
|
public partial class AboutOptionsPanel
|
||||||
{
|
{
|
||||||
public AboutOptionsPanel()
|
public AboutOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryAbout;
|
||||||
|
|
||||||
public override void LoadPanel()
|
public override void LoadPanel()
|
||||||
{
|
{
|
||||||
base.LoadPanel();
|
base.LoadPanel();
|
||||||
@@ -21,6 +24,4 @@ public partial class AboutOptionsPanel
|
|||||||
|
|
||||||
CompanyLabel.Text = ((AssemblyCompanyAttribute) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company;
|
CompanyLabel.Text = ((AssemblyCompanyAttribute) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string CategoryName => Properties.Resources.optionCategoryAbout;
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
using FeedCenter.Properties;
|
using System.Linq;
|
||||||
using System.Linq;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using FeedCenter.Properties;
|
||||||
|
|
||||||
namespace FeedCenter.Options;
|
namespace FeedCenter.Options;
|
||||||
|
|
||||||
public partial class DisplayOptionsPanel
|
public partial class DisplayOptionsPanel
|
||||||
{
|
{
|
||||||
public DisplayOptionsPanel()
|
public DisplayOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryDisplay;
|
||||||
|
|
||||||
public override void LoadPanel()
|
public override void LoadPanel()
|
||||||
{
|
{
|
||||||
base.LoadPanel();
|
base.LoadPanel();
|
||||||
@@ -23,8 +26,6 @@ public partial class DisplayOptionsPanel
|
|||||||
MarkLoaded();
|
MarkLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string CategoryName => Properties.Resources.optionCategoryDisplay;
|
|
||||||
|
|
||||||
private void LockWindowCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void LockWindowCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!HasLoaded) return;
|
if (!HasLoaded) return;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
HeadersVisibility="Column"
|
HeadersVisibility="Column"
|
||||||
Background="{x:Null}"
|
Background="{x:Null}"
|
||||||
PreviewMouseLeftButtonDown="HandleFeedListPreviewMouseLeftButtonDown">
|
PreviewMouseLeftButtonDown="HandleFeedListPreviewMouseLeftButtonDown" SelectionChanged="FeedListBox_SelectionChanged">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Binding="{Binding Name}"
|
<DataGridTextColumn Binding="{Binding Name}"
|
||||||
Header="{x:Static properties:Resources.FeedNameColumnHeader}"
|
Header="{x:Static properties:Resources.FeedNameColumnHeader}"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<DataGrid Name="CategoryListBox"
|
<DataGrid Name="CategoryListBox"
|
||||||
SelectionChanged="HandleCategoryListBoxSelectionChanged"
|
SelectionChanged="HandleCategoryListBoxSelectionChanged"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
SelectionMode="Extended"
|
SelectionMode="Single"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
GridLinesVisibility="None"
|
GridLinesVisibility="None"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.Win32;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -8,16 +7,21 @@ using System.Windows.Data;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using FeedCenter.Data;
|
using FeedCenter.Data;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace FeedCenter.Options
|
namespace FeedCenter.Options
|
||||||
{
|
{
|
||||||
public partial class FeedsOptionsPanel
|
public partial class FeedsOptionsPanel
|
||||||
{
|
{
|
||||||
public FeedsOptionsPanel()
|
private CollectionViewSource _collectionViewSource;
|
||||||
|
|
||||||
|
public FeedsOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryFeeds;
|
||||||
|
|
||||||
public override void LoadPanel()
|
public override void LoadPanel()
|
||||||
{
|
{
|
||||||
base.LoadPanel();
|
base.LoadPanel();
|
||||||
@@ -31,13 +35,11 @@ namespace FeedCenter.Options
|
|||||||
CategoryListBox.SelectedIndex = 0;
|
CategoryListBox.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string CategoryName => Properties.Resources.optionCategoryFeeds;
|
|
||||||
|
|
||||||
private void SetFeedButtonStates()
|
private void SetFeedButtonStates()
|
||||||
{
|
{
|
||||||
AddFeedButton.IsEnabled = true;
|
AddFeedButton.IsEnabled = true;
|
||||||
EditFeedButton.IsEnabled = FeedListBox.SelectedItem != null;
|
EditFeedButton.IsEnabled = FeedListBox.SelectedItems.Count == 1;
|
||||||
DeleteFeedButton.IsEnabled = FeedListBox.SelectedItem != null;
|
DeleteFeedButton.IsEnabled = FeedListBox.SelectedItems.Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddFeed()
|
private void AddFeed()
|
||||||
@@ -46,7 +48,7 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
var category = (Category) CategoryListBox.SelectedItem;
|
var category = (Category) CategoryListBox.SelectedItem;
|
||||||
|
|
||||||
feed.Category = category;
|
feed.CategoryId = category.Id;
|
||||||
|
|
||||||
var feedWindow = new FeedWindow();
|
var feedWindow = new FeedWindow();
|
||||||
|
|
||||||
@@ -74,11 +76,17 @@ namespace FeedCenter.Options
|
|||||||
feedWindow.Display(feed, Window.GetWindow(this));
|
feedWindow.Display(feed, Window.GetWindow(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteSelectedFeed()
|
private void DeleteSelectedFeeds()
|
||||||
{
|
{
|
||||||
var feed = (Feed) FeedListBox.SelectedItem;
|
if (MessageBox.Show(ParentWindow, Properties.Resources.ConfirmDeleteFeeds, Properties.Resources.ConfirmDeleteTitle, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||||
|
return;
|
||||||
|
|
||||||
Database.Entities.Feeds.Remove(feed);
|
var selectedItems = new Feed[FeedListBox.SelectedItems.Count];
|
||||||
|
|
||||||
|
FeedListBox.SelectedItems.CopyTo(selectedItems, 0);
|
||||||
|
|
||||||
|
foreach (var feed in selectedItems)
|
||||||
|
Database.Entities.SaveChanges(() => Database.Entities.Feeds.Remove(feed));
|
||||||
|
|
||||||
SetFeedButtonStates();
|
SetFeedButtonStates();
|
||||||
}
|
}
|
||||||
@@ -95,7 +103,7 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
private void HandleDeleteFeedButtonClick(object sender, RoutedEventArgs e)
|
private void HandleDeleteFeedButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
DeleteSelectedFeed();
|
DeleteSelectedFeeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleImportButtonClick(object sender, RoutedEventArgs e)
|
private void HandleImportButtonClick(object sender, RoutedEventArgs e)
|
||||||
@@ -181,7 +189,7 @@ namespace FeedCenter.Options
|
|||||||
while (xmlReader.NodeType != XmlNodeType.EndElement)
|
while (xmlReader.NodeType != XmlNodeType.EndElement)
|
||||||
{
|
{
|
||||||
var feed = Feed.Create();
|
var feed = Feed.Create();
|
||||||
feed.Category = Database.Entities.Categories.First(c => c.IsDefault);
|
feed.CategoryId = Database.Entities.Categories.First(c => c.IsDefault).Id;
|
||||||
|
|
||||||
while (xmlReader.MoveToNextAttribute())
|
while (xmlReader.MoveToNextAttribute())
|
||||||
{
|
{
|
||||||
@@ -233,8 +241,10 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
var selectedId = ((Category) CategoryListBox.SelectedItem).Id;
|
var selectedId = ((Category) CategoryListBox.SelectedItem).Id;
|
||||||
|
|
||||||
EditCategoryButton.IsEnabled = CategoryListBox.SelectedItem != null && selectedId != Database.Entities.DefaultCategory.Id;
|
EditCategoryButton.IsEnabled = CategoryListBox.SelectedItem != null &&
|
||||||
DeleteCategoryButton.IsEnabled = CategoryListBox.SelectedItem != null && selectedId != Database.Entities.DefaultCategory.Id;
|
selectedId != Database.Entities.DefaultCategory.Id;
|
||||||
|
DeleteCategoryButton.IsEnabled = CategoryListBox.SelectedItem != null &&
|
||||||
|
selectedId != Database.Entities.DefaultCategory.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCategory()
|
private void AddCategory()
|
||||||
@@ -269,11 +279,15 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
private void DeleteSelectedCategory()
|
private void DeleteSelectedCategory()
|
||||||
{
|
{
|
||||||
var defaultCategory = Database.Entities.DefaultCategory;
|
|
||||||
|
|
||||||
var category = (Category) CategoryListBox.SelectedItem;
|
var category = (Category) CategoryListBox.SelectedItem;
|
||||||
|
|
||||||
category.Feeds?.ToList().ForEach(feed => feed.Category = defaultCategory);
|
if (MessageBox.Show(ParentWindow, string.Format(Properties.Resources.ConfirmDeleteCategory, category.Name), Properties.Resources.ConfirmDeleteTitle, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var defaultCategory = Database.Entities.DefaultCategory;
|
||||||
|
|
||||||
|
foreach (var feed in Database.Entities.Feeds.Where(f => f.CategoryId == category.Id))
|
||||||
|
Database.Entities.SaveChanges(() => feed.CategoryId = defaultCategory.Id);
|
||||||
|
|
||||||
var index = CategoryListBox.SelectedIndex;
|
var index = CategoryListBox.SelectedIndex;
|
||||||
|
|
||||||
@@ -302,8 +316,6 @@ namespace FeedCenter.Options
|
|||||||
DeleteSelectedCategory();
|
DeleteSelectedCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CollectionViewSource _collectionViewSource;
|
|
||||||
|
|
||||||
private void HandleCategoryListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void HandleCategoryListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_collectionViewSource == null)
|
if (_collectionViewSource == null)
|
||||||
@@ -330,7 +342,7 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
var feed = (Feed) e.Item;
|
var feed = (Feed) e.Item;
|
||||||
|
|
||||||
e.Accepted = feed.Category.Id == selectedCategory.Id;
|
e.Accepted = feed.CategoryId == selectedCategory.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CategoryListBox_Drop(object sender, DragEventArgs e)
|
private void CategoryListBox_Drop(object sender, DragEventArgs e)
|
||||||
@@ -340,7 +352,7 @@ namespace FeedCenter.Options
|
|||||||
var category = (Category) ((DataGridRow) sender).Item;
|
var category = (Category) ((DataGridRow) sender).Item;
|
||||||
|
|
||||||
foreach (var feed in feedList!)
|
foreach (var feed in feedList!)
|
||||||
feed.Category = category;
|
Database.Entities.SaveChanges(() => feed.CategoryId = category.Id);
|
||||||
|
|
||||||
_collectionViewSource.View.Refresh();
|
_collectionViewSource.View.Refresh();
|
||||||
|
|
||||||
@@ -404,5 +416,10 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
EditSelectedCategory();
|
EditSelectedCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FeedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SetFeedButtonStates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using ChrisKaczor.InstalledBrowsers;
|
using ChrisKaczor.InstalledBrowsers;
|
||||||
using ChrisKaczor.Wpf.Application;
|
using ChrisKaczor.Wpf.Application;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
@@ -7,7 +8,7 @@ namespace FeedCenter.Options;
|
|||||||
|
|
||||||
public partial class GeneralOptionsPanel
|
public partial class GeneralOptionsPanel
|
||||||
{
|
{
|
||||||
public GeneralOptionsPanel()
|
public GeneralOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace FeedCenter.Options;
|
namespace FeedCenter.Options;
|
||||||
|
|
||||||
public class OptionsPanelBase : UserControl
|
public class OptionsPanelBase : UserControl
|
||||||
{
|
{
|
||||||
public bool HasLoaded { get; private set; }
|
protected readonly Window ParentWindow;
|
||||||
|
|
||||||
|
protected OptionsPanelBase(Window parentWindow)
|
||||||
|
{
|
||||||
|
ParentWindow = parentWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string CategoryName => null;
|
||||||
|
|
||||||
|
protected bool HasLoaded { get; private set; }
|
||||||
|
|
||||||
public virtual void LoadPanel()
|
public virtual void LoadPanel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkLoaded()
|
protected void MarkLoaded()
|
||||||
{
|
{
|
||||||
HasLoaded = true;
|
HasLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string CategoryName => null;
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using FeedCenter.Data;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace FeedCenter.Options
|
namespace FeedCenter.Options
|
||||||
@@ -21,11 +20,11 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
private void AddCategories()
|
private void AddCategories()
|
||||||
{
|
{
|
||||||
_optionPanels.Add(new GeneralOptionsPanel());
|
_optionPanels.Add(new GeneralOptionsPanel(this));
|
||||||
_optionPanels.Add(new DisplayOptionsPanel());
|
_optionPanels.Add(new DisplayOptionsPanel(this));
|
||||||
_optionPanels.Add(new FeedsOptionsPanel());
|
_optionPanels.Add(new FeedsOptionsPanel(this));
|
||||||
_optionPanels.Add(new UpdateOptionsPanel());
|
_optionPanels.Add(new UpdateOptionsPanel(this));
|
||||||
_optionPanels.Add(new AboutOptionsPanel());
|
_optionPanels.Add(new AboutOptionsPanel(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadCategories()
|
private void LoadCategories()
|
||||||
@@ -61,13 +60,13 @@ namespace FeedCenter.Options
|
|||||||
|
|
||||||
private class CategoryListItem
|
private class CategoryListItem
|
||||||
{
|
{
|
||||||
public OptionsPanelBase Panel { get; }
|
|
||||||
|
|
||||||
public CategoryListItem(OptionsPanelBase panel)
|
public CategoryListItem(OptionsPanelBase panel)
|
||||||
{
|
{
|
||||||
Panel = panel;
|
Panel = panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OptionsPanelBase Panel { get; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Panel.CategoryName;
|
return Panel.CategoryName;
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
using ChrisKaczor.ApplicationUpdate;
|
using System.Windows;
|
||||||
|
using ChrisKaczor.ApplicationUpdate;
|
||||||
|
|
||||||
namespace FeedCenter.Options;
|
namespace FeedCenter.Options;
|
||||||
|
|
||||||
public partial class UpdateOptionsPanel
|
public partial class UpdateOptionsPanel
|
||||||
{
|
{
|
||||||
public UpdateOptionsPanel()
|
public UpdateOptionsPanel(Window parentWindow) : base(parentWindow)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryUpdate;
|
||||||
|
|
||||||
public override void LoadPanel()
|
public override void LoadPanel()
|
||||||
{
|
{
|
||||||
base.LoadPanel();
|
base.LoadPanel();
|
||||||
@@ -18,8 +21,6 @@ public partial class UpdateOptionsPanel
|
|||||||
MarkLoaded();
|
MarkLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string CategoryName => Properties.Resources.optionCategoryUpdate;
|
|
||||||
|
|
||||||
private void HandleCheckVersionNowButtonClick(object sender, System.Windows.RoutedEventArgs e)
|
private void HandleCheckVersionNowButtonClick(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateCheck.DisplayUpdateInformation(true);
|
UpdateCheck.DisplayUpdateInformation(true);
|
||||||
|
|||||||
33
Application/Properties/Resources.Designer.cs
generated
33
Application/Properties/Resources.Designer.cs
generated
@@ -268,12 +268,41 @@ namespace FeedCenter.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Are you sure you want to delete this category?
|
||||||
|
///
|
||||||
|
///All feeds currently in category "{0}" will be moved to the default category..
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfirmDeleteCategory {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ConfirmDeleteCategory", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Are you sure you want to delete this feed?.
|
/// Looks up a localized string similar to Are you sure you want to delete this feed?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ConfirmDelete {
|
public static string ConfirmDeleteFeed {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ConfirmDelete", resourceCulture);
|
return ResourceManager.GetString("ConfirmDeleteFeed", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Are you sure you want to delete the selected feeds?.
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfirmDeleteFeeds {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ConfirmDeleteFeeds", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Confirm Delete.
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfirmDeleteTitle {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ConfirmDeleteTitle", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@
|
|||||||
<data name="EditMenu" xml:space="preserve">
|
<data name="EditMenu" xml:space="preserve">
|
||||||
<value>Edit...</value>
|
<value>Edit...</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ConfirmDelete" xml:space="preserve">
|
<data name="ConfirmDeleteFeed" xml:space="preserve">
|
||||||
<value>Are you sure you want to delete this feed?</value>
|
<value>Are you sure you want to delete this feed?</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="optionCategoryReading" xml:space="preserve">
|
<data name="optionCategoryReading" xml:space="preserve">
|
||||||
@@ -538,4 +538,15 @@
|
|||||||
<data name="categoryNameLabel" xml:space="preserve">
|
<data name="categoryNameLabel" xml:space="preserve">
|
||||||
<value>_Name:</value>
|
<value>_Name:</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ConfirmDeleteCategory" xml:space="preserve">
|
||||||
|
<value>Are you sure you want to delete this category?
|
||||||
|
|
||||||
|
All feeds currently in category "{0}" will be moved to the default category.</value>
|
||||||
|
</data>
|
||||||
|
<data name="ConfirmDeleteTitle" xml:space="preserve">
|
||||||
|
<value>Confirm Delete</value>
|
||||||
|
</data>
|
||||||
|
<data name="ConfirmDeleteFeeds" xml:space="preserve">
|
||||||
|
<value>Are you sure you want to delete the selected feeds?</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||||
<!-- <dependency>
|
<dependency>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity
|
<assemblyIdentity
|
||||||
type="win32"
|
type="win32"
|
||||||
@@ -43,5 +43,5 @@
|
|||||||
language="*"
|
language="*"
|
||||||
/>
|
/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>-->
|
</dependency>
|
||||||
</asmv1:assembly>
|
</asmv1:assembly>
|
||||||
Reference in New Issue
Block a user