private void Button_Click_1(object sender, RoutedEventArgs e)//add unit { try { addUnitWin win = new addUnitWin(myHost); win.ShowDialog(); unitCB.ItemsSource = myBL.getUnitsForHost(myHost); } catch (Exception error) { MessageBox.Show(error.Message); } }
private void Button_Click_2(object sender, RoutedEventArgs e)//add unit { try { Host host = (Host)(hostsLV.SelectedItem); if (host == null) { throw new NullReferenceException("לא נבחר מארח"); } addUnitWin win = new addUnitWin(host); win.ShowDialog(); unitsLV.ItemsSource = myBL.getAllUnits(); } catch (Exception error) { MessageBox.Show(error.Message); } }