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

77 lines
2.4 KiB
C#

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 existingWindow)
{
existingWindow.Activate();
return;
}
}
var addWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
addWindow.Show();
}
private void OpenDeletePhysicalPersonWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is DeletePhysicalPersonWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var deleteWindow = new DeletePhysicalPersonWindow(_phisicalPersonLogic);
deleteWindow.Show();
}
private void OpenEditPhysicalPersonWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is EditPhysicalPersonWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var editWindow = new EditPhysicalPersonWindow(_phisicalPersonLogic);
editWindow.Show();
}
private void OpenViewPhysicalPersonsWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is ViewPhysicalPersonsWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var viewWindow = new ViewPhysicalPersonsWindow(_phisicalPersonLogic);
viewWindow.Show();
}
}
}