private void MenuItem_Click(object sender, RoutedEventArgs e) { AddSourceDialog asd = new AddSourceDialog(); var x = asd.ShowDialog(); if (x.HasValue && x.Value) { _chat.AddSource( asd.chatSourceCB.SelectedItem as TwoRatChat.Main.Sources.Source, asd.chatSourceUri.Text, asd.chatMessageID.Text); } }