private void AddHostingUnit_bt_Click(object sender, RoutedEventArgs e) { try { int key = bl.AddHostingUinit(unit); units.Add(bl.GetHoustingUinit(key)); view.Items.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Close(); } }