41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using UCalc.Controls;
|
|
using UCalc.Models;
|
|
|
|
namespace UCalc
|
|
{
|
|
public partial class TenantWindow
|
|
{
|
|
public TenantProperty Tenant { get; }
|
|
public HouseProperty House { get; }
|
|
|
|
public TenantWindow(TenantProperty tenant, HouseProperty house)
|
|
{
|
|
Tenant = tenant;
|
|
House = house;
|
|
InitializeComponent();
|
|
|
|
((FlatToRentedConverter) FindResource("FlatToRentedConverter")).Tenant = Tenant;
|
|
}
|
|
|
|
private void OnOkClick(object sender, RoutedEventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void OnFlatChecked(object sender, RoutedEventArgs e)
|
|
{
|
|
var flat = (FlatProperty) ((CheckBox) sender).DataContext;
|
|
|
|
Tenant.RentedFlats.Add(flat);
|
|
}
|
|
|
|
private void OnFlatUnchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
var flat = (FlatProperty) ((CheckBox) sender).DataContext;
|
|
|
|
Tenant.RentedFlats.Remove(flat);
|
|
}
|
|
}
|
|
} |