private void PartnersClick(object sender, RoutedEventArgs e) { string content; if (sender is Button) { Button button = (Button)sender; content = button.Content.ToString(); } else { MenuItem menu = (MenuItem)sender; content = menu.Header.ToString(); } if (content == "Partnerek") { PartnersVM partnersVM = new PartnersVM(); PartnersWindow partners = new PartnersWindow { DataContext = partnersVM, Title = content }; partners.Show(); } else { ContactsVM contacts = new ContactsVM(); PartnersWindow partners = new PartnersWindow { DataContext = contacts, Title = content }; contacts.LoadPartnersList(); partners.Show(); } }
private void ContactAddClick(object sender, RoutedEventArgs e) { ContactsVM contacts = new ContactsVM { IsPartnerAdd = ((PartnerFormVM)DataContext).ChosenPartner.ID, PartnerContactList = ((PartnerFormVM)DataContext).ContactsList }; PartnersWindow partners = new PartnersWindow { DataContext = contacts, Title = "Elérhetőségek" }; contacts.LoadPartnersList(); partners.ShowDialog(); }