PIbd-42_Kashin_M.I_CPO_Cour.../EmployeeManagmentView/PhysicalPerson/PhysicalPersonManagementWindow.xaml.cs

39 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
{
// Проверяем, если окно уже открыто
foreach (Window window in Application.Current.Windows)
{
if (window is AddPhysicalPersonWindow)
{
// Если окно уже открыто, активируем его и ставим на передний план
window.Activate();
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.Topmost = true; // Ставим окно на передний план
return;
}
}
// Если окно не найдено, открываем новое
var physicalPersonWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
physicalPersonWindow.Topmost = true;
physicalPersonWindow.Show();
}
}
}