mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-14 01:25:38 -05:00
- Modernize old async code - Update to .NET 10 - Adjust namespace - Bypass update check when debugging
46 lines
990 B
C#
46 lines
990 B
C#
using ChrisKaczor.Wpf.Validation;
|
|
using System.Windows;
|
|
|
|
namespace FeedCenter.Options;
|
|
|
|
public partial class FeedWindow
|
|
{
|
|
private readonly FeedCenterEntities _entities;
|
|
|
|
public FeedWindow(FeedCenterEntities entities)
|
|
{
|
|
_entities = entities;
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool? Display(Feeds.Feed feed, Window owner)
|
|
{
|
|
CategoryComboBox.ItemsSource = _entities.Categories;
|
|
|
|
DataContext = feed;
|
|
|
|
Title = string.IsNullOrWhiteSpace(feed.Link) ? Properties.Resources.FeedWindowAdd : Properties.Resources.FeedWindowEdit;
|
|
|
|
Owner = owner;
|
|
|
|
return ShowDialog();
|
|
}
|
|
|
|
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var transaction = _entities.BeginTransaction();
|
|
|
|
if (!this.IsValid(OptionsTabControl))
|
|
{
|
|
transaction.Rollback();
|
|
return;
|
|
}
|
|
|
|
transaction.Commit();
|
|
|
|
DialogResult = true;
|
|
|
|
Close();
|
|
}
|
|
} |