Files
Prog4_Beadando/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllEmployees.xaml.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2024-04-30 20:34:23 +02:00
using System.Windows;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
2024-04-28 18:00:25 +02:00
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
/// <summary>
/// Interaction logic for GetAllEmployees.xaml
/// </summary>
public partial class GetAllEmployees : Window
{
public GetAllEmployees()
{
InitializeComponent();
}
2024-04-29 22:57:48 +02:00
private void CreateNewEmployee(object sender, RoutedEventArgs e)
{
CreateNewEmployeeViewModel viewModel = new CreateNewEmployeeViewModel();
viewModel.NewEmployeeCreated += (newEmployee) =>
{
var getAllEmployeesViewModel = (GetAllEmployeesViewModel)DataContext;
if (getAllEmployeesViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllEmployeesViewModel.Employees.Add(newEmployee);
});
}
};
Window window = new CreateNewEmployee(viewModel);
2024-04-29 22:57:48 +02:00
window.Show();
}
2024-04-28 18:00:25 +02:00
}
}