Files
FeedCenter/Application/Options/FeedWindow.xaml.cs
2023-04-16 12:57:17 -04:00

44 lines
950 B
C#

using ChrisKaczor.Wpf.Validation;
using FeedCenter.Data;
using System.Windows;
namespace FeedCenter.Options;
public partial class FeedWindow
{
public FeedWindow()
{
InitializeComponent();
}
public bool? Display(Feed feed, Window owner)
{
CategoryComboBox.ItemsSource = Database.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 = Database.Entities.BeginTransaction();
if (!this.IsValid(OptionsTabControl))
{
transaction.Rollback();
return;
}
transaction.Commit();
Database.Entities.Refresh();
DialogResult = true;
Close();
}
}