private void Button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; TextBlock textblock = button.Content as TextBlock; string GeneratorName = textblock.Text; try { UserControl usc; switch (GeneratorName) { case "Generator Progowy": usc = new UserControl_progowy(); break; case "Generator Samodecymujący Rueppela": usc = new UserControl_rueppela(); break; case "Generator Geffego": usc = new UserControl_geffego(); break; case "Przemienny Generator stop-and-go": usc = new UserControl_stop_and_go(); break; case "Kaskada Gollmana": usc = new UserControl_gollmana(); break; case "Generator Obcinający": usc = new UserControl_obcinający(); break; case "Generator Samoobcinający": usc = new UserControl_samoobcinający(); break; default: throw new Exception("Generatory - brak takiego generatora"); } UserControlChange.Children.Add(usc); }catch (Exception catchedException) { Console.WriteLine(catchedException.Message); } }
private void Progowy_Click(object sender, RoutedEventArgs e) { UserControl usc = null; GridGeneratory.Children.Clear(); usc = new UserControl_progowy(); GridGeneratory.Children.Add(usc); Progowy.Background = active; Rueppela.Background = normal; Rozrzedzający.Background = normal; Geffego.Background = normal; Stop_and_go.Background = normal; Gollmana.Background = normal; Obcinający.Background = normal; Samoobcinający.Background = normal; }