using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace Firewatch_2._0 { /// /// Логика взаимодействия для TeamWindow.xaml /// public partial class TeamWindow : Window { public TeamWindow() { InitializeComponent(); Load(); DataContext = new Team(); } public TeamWindow(Team team) { InitializeComponent(); Load(); DataContext = team; } private void Load() { CmbFirehouse.ItemsSource = Helper.context.Firehouses.ToList(); } private void Team_OK(object sender, RoutedEventArgs e) { if (DataContext is Team team && team.Team_ID == 0) { Helper.context.Teams.Add(team); } Helper.context.SaveChanges(); Close(); } private void Team_Close(object sender, RoutedEventArgs e) { Close(); } } }