private void Window_Closing(object sender, CancelEventArgs e) { TimelineConfig config = DataContext as TimelineConfig; if (config != null) { string errorMessage = ""; if (!config.Validate(out errorMessage)) { MessageBox.Show(errorMessage); e.Cancel = true; } } }
private void TimeConfig_Click(object sender, RoutedEventArgs e) { TimelineViewModel timeViewModel = DataContext as TimelineViewModel; TimelineConfig configuration = new TimelineConfig(timeViewModel.TimelineStart, timeViewModel.TimelineEnd, timeViewModel.PlaybackStart, timeViewModel.PlaybackEnd, TimelineTickDisplayMode.Ticks, timeViewModel.LoopPlayback, timeViewModel.Reverse); TimelineConfigWindow timeConfigWindow = new TimelineConfigWindow(configuration); timeConfigWindow.ShowDialog(); timeViewModel.TimelineStart = configuration.TimelineViewStart; timeViewModel.TimelineEnd = configuration.TimelineViewEnd; timeViewModel.PlaybackStart = configuration.PlaybackStart; timeViewModel.PlaybackEnd = configuration.PlaybackEnd; timeViewModel.LoopPlayback = configuration.Loop; timeViewModel.Reverse = configuration.Reverse; }
public TimelineConfigWindow(TimelineConfig config) { InitializeComponent(); DataContext = config; }