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 Stop_and_go_Click(object sender, RoutedEventArgs e) { UserControl usc = null; GridGeneratory.Children.Clear(); usc = new UserControl_stop_and_go(); Progowy.Background = normal; Rueppela.Background = normal; Rozrzedzający.Background = normal; Geffego.Background = normal; Stop_and_go.Background = active; Gollmana.Background = normal; Obcinający.Background = normal; Samoobcinający.Background = normal; }