private void TypeComboBox_Selected(object sender, RoutedEventArgs e) { if (!IsLoaded) { return; } if (TypeComboBox.SelectedIndex < 1) { MainPresenter.Content = null; return; } if (!IsEditing) { //Create a new model. switch ((TaskTypes)TypeComboBox.SelectedIndex) { case TaskTypes.MouseClicks: CurrentTask = MouseClicksViewModel.Default(); break; case TaskTypes.KeyStrokes: CurrentTask = KeyStrokesViewModel.Default(); break; case TaskTypes.Delay: CurrentTask = DelayViewModel.Default(); break; case TaskTypes.Progress: CurrentTask = ProgressViewModel.Default(); break; case TaskTypes.Border: CurrentTask = BorderViewModel.Default(); break; case TaskTypes.Shadow: CurrentTask = ShadowViewModel.Default(); break; } } switch ((TaskTypes)TypeComboBox.SelectedIndex) { case TaskTypes.MouseClicks: MainPresenter.Content = new MouseClicksPanel { DataContext = CurrentTask }; break; case TaskTypes.KeyStrokes: MainPresenter.Content = new KeyStrokesPanel { DataContext = CurrentTask }; break; case TaskTypes.Delay: MainPresenter.Content = new DelayPanel { DataContext = CurrentTask }; break; case TaskTypes.Progress: MainPresenter.Content = new ProgressPanel { DataContext = CurrentTask }; break; case TaskTypes.Border: MainPresenter.Content = new BorderPanel { DataContext = CurrentTask }; break; case TaskTypes.Shadow: MainPresenter.Content = new ShadowPanel { DataContext = CurrentTask }; break; } }