2024-11-13 14:41:01 +04:00
|
|
|
|
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
|
|
|
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
|
|
|
|
using EmployeeManagmentContracts.ViewModels;
|
2024-11-26 22:35:12 +04:00
|
|
|
|
using EmployeeManagmentView.PhysicalPerson;
|
2024-11-12 12:21:29 +04:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace EmployeeManagmentView
|
|
|
|
|
{
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
2024-11-26 21:24:08 +04:00
|
|
|
|
|
2024-11-13 14:41:01 +04:00
|
|
|
|
private readonly IEmployeeLogic _employeeLogic;
|
2024-11-26 22:35:12 +04:00
|
|
|
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
2024-11-13 14:41:01 +04:00
|
|
|
|
|
|
|
|
|
// Constructor with Dependency Injection
|
2024-11-26 22:35:12 +04:00
|
|
|
|
public MainWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
|
2024-11-12 12:21:29 +04:00
|
|
|
|
{
|
2024-11-13 14:41:01 +04:00
|
|
|
|
_employeeLogic = employeeLogic;
|
2024-11-26 22:35:12 +04:00
|
|
|
|
_phisicalPersonLogic = phisicalPersonLogic;
|
2024-11-12 12:21:29 +04:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
2024-11-12 13:07:37 +04:00
|
|
|
|
|
2024-11-26 22:35:12 +04:00
|
|
|
|
private void OpenPhysicalPersonManagementWindow(object sender, RoutedEventArgs e)
|
2024-11-12 13:07:37 +04:00
|
|
|
|
{
|
2024-11-27 01:21:37 +04:00
|
|
|
|
foreach (Window window in Application.Current.Windows)
|
|
|
|
|
{
|
|
|
|
|
if (window is PhysicalPersonManagementWindow)
|
|
|
|
|
{
|
|
|
|
|
// Если окно уже открыто, активируем его и ставим на передний план
|
|
|
|
|
window.Activate();
|
|
|
|
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
window.Topmost = true; // Ставим окно на передний план
|
|
|
|
|
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-12 13:07:37 +04:00
|
|
|
|
|
2024-11-26 22:35:12 +04:00
|
|
|
|
var physicalPersonWindow = new PhysicalPersonManagementWindow(_phisicalPersonLogic);
|
|
|
|
|
physicalPersonWindow.Show();
|
2024-11-12 13:07:37 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 12:21:29 +04:00
|
|
|
|
}
|
2024-11-13 14:41:01 +04:00
|
|
|
|
}
|