2024-11-26 22:35:12 +04:00
|
|
|
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace EmployeeManagmentView.PhysicalPerson
|
|
|
|
|
{
|
|
|
|
|
public partial class PhysicalPersonManagementWindow : Window
|
|
|
|
|
{
|
|
|
|
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
|
|
|
|
|
|
|
|
|
public PhysicalPersonManagementWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
|
|
|
|
{
|
|
|
|
|
_phisicalPersonLogic = phisicalPersonLogic;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OpenAddPhysicalPersonWindow(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-11-27 01:21:37 +04:00
|
|
|
|
// Проверяем, если окно уже открыто
|
|
|
|
|
foreach (Window window in Application.Current.Windows)
|
|
|
|
|
{
|
|
|
|
|
if (window is AddPhysicalPersonWindow)
|
|
|
|
|
{
|
|
|
|
|
// Если окно уже открыто, активируем его и ставим на передний план
|
|
|
|
|
window.Activate();
|
|
|
|
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
window.Topmost = true; // Ставим окно на передний план
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Если окно не найдено, открываем новое
|
2024-11-26 22:35:12 +04:00
|
|
|
|
var physicalPersonWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
|
2024-11-27 01:24:40 +04:00
|
|
|
|
physicalPersonWindow.Topmost = true;
|
2024-11-26 22:35:12 +04:00
|
|
|
|
physicalPersonWindow.Show();
|
|
|
|
|
}
|
2024-11-27 01:21:37 +04:00
|
|
|
|
|
2024-11-26 22:35:12 +04:00
|
|
|
|
}
|
|
|
|
|
}
|