private void OkButton_Click(object sender, RoutedEventArgs e) { if (NameTextBox.Text.Trim() == string.Empty) { return; } if (EditGrid.DataContext == null) { _cc.AddWorkerGroup(NameTextBox.Text.Trim(), UnitToFactoryCheckBox.IsChecked == true); } _cc.SaveWorkerGroups(); EditGrid.DataContext = null; NameTextBox.Text = string.Empty; UnitToFactoryCheckBox.IsChecked = false; HideEditGrid(); }