private void AddSoundtrackButton_Click(object sender, RoutedEventArgs e) { if (ProjectIsNotNull()) { var result = openSoundtrackDialog.ShowDialog(this); if (result.GetValueOrDefault()) { if (File.Exists(openSoundtrackDialog.FileName)) { var soundtrackPath = openSoundtrackDialog.FileName; var soundtrack = new ClipSynthSoundtrack() { Path = soundtrackPath, Offset = 0, Checked = true, }; RemoveSoundtrackButton_Click(null, null); project.Soundtrack = soundtrack; SoundtrackListBox_AddItem(soundtrack); project.Dirty = true; } } } }
private void SoundtrackListBox_AddItem(ClipSynthSoundtrack soundtrack) { var item = new ListBoxItem(); var checkBoxContent = new CheckBoxContent(soundtrack.Path, IOPath.GetFileName(soundtrack.Path), ListBoxCheckBox_Checked, String.Empty, soundtrack.Offset, 0, 0); checkBoxContent.UniqueIdLabel.Visibility = System.Windows.Visibility.Collapsed; checkBoxContent.Thumbnail.Visibility = System.Windows.Visibility.Collapsed; checkBoxContent.EndTextBox.Visibility = System.Windows.Visibility.Collapsed; checkBoxContent.Margin = new Thickness(0, 6, 0, 0); checkBoxContent.Tag = soundtrack; checkBoxContent.CheckBox.IsChecked = soundtrack.Checked; checkBoxContent.Label.ToolTip = soundtrack.Path; checkBoxContent.Label.Tag = soundtrack.Path; item.Content = checkBoxContent; checkBoxContent.StartTextBox.TextChanged += ListBoxTextBox_TextChanged; SoundtrackListBox.Items.Add(item); }