mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-16 10:58:31 -05:00
More UI updates
This commit is contained in:
@@ -2,50 +2,49 @@
|
||||
using ChrisKaczor.Wpf.Validation;
|
||||
using FeedCenter.Data;
|
||||
|
||||
namespace FeedCenter.Options
|
||||
namespace FeedCenter.Options;
|
||||
|
||||
public partial class CategoryWindow
|
||||
{
|
||||
public partial class CategoryWindow
|
||||
public CategoryWindow()
|
||||
{
|
||||
public CategoryWindow()
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool? Display(Category category, Window owner)
|
||||
{
|
||||
// Set the data context
|
||||
DataContext = category;
|
||||
|
||||
// Set the title based on the state of the category
|
||||
Title = string.IsNullOrWhiteSpace(category.Name)
|
||||
? Properties.Resources.CategoryWindowAdd
|
||||
: Properties.Resources.CategoryWindowEdit;
|
||||
|
||||
// Set the window owner
|
||||
Owner = owner;
|
||||
|
||||
// Show the dialog and result the result
|
||||
return ShowDialog();
|
||||
}
|
||||
|
||||
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var transaction = Database.Entities.BeginTransaction();
|
||||
|
||||
if (!this.IsValid())
|
||||
{
|
||||
InitializeComponent();
|
||||
transaction.Rollback();
|
||||
return;
|
||||
}
|
||||
|
||||
public bool? Display(Category category, Window owner)
|
||||
{
|
||||
// Set the data context
|
||||
DataContext = category;
|
||||
transaction.Commit();
|
||||
Database.Entities.Refresh();
|
||||
|
||||
// Set the title based on the state of the category
|
||||
Title = string.IsNullOrWhiteSpace(category.Name)
|
||||
? Properties.Resources.CategoryWindowAdd
|
||||
: Properties.Resources.CategoryWindowEdit;
|
||||
// Dialog is good
|
||||
DialogResult = true;
|
||||
|
||||
// Set the window owner
|
||||
Owner = owner;
|
||||
|
||||
// Show the dialog and result the result
|
||||
return ShowDialog();
|
||||
}
|
||||
|
||||
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var transaction = Database.Entities.BeginTransaction();
|
||||
|
||||
if (!this.IsValid())
|
||||
{
|
||||
transaction.Rollback();
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
Database.Entities.Refresh();
|
||||
|
||||
// Dialog is good
|
||||
DialogResult = true;
|
||||
|
||||
// Close the dialog
|
||||
Close();
|
||||
}
|
||||
// Close the dialog
|
||||
Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user