mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
44 lines
950 B
C#
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();
|
|
}
|
|
} |