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); }
private void ListBox_AddItem(ClipSynthMovie movie) { // Meta data intelligent check/fix if (!File.Exists(movie.Thumbnail)) { var metaDataThumbnail = IOPath.Combine(IOPath.GetDirectoryName(movie.Path), IOPath.GetFileName(movie.Thumbnail)); if (File.Exists(metaDataThumbnail)) { movie.Thumbnail = metaDataThumbnail; // Fix meta data file var metaData = new ClipSynthMetaData(); metaData.Path = movie.MetaData; ClipSynthMetaData.Load(ref metaData); metaData.Movie = movie.Path; metaData.Thumbnail = metaDataThumbnail; ClipSynthMetaData.Save(ref metaData); } } var item = new ListBoxItem(); var checkBoxContent = new CheckBoxContent(movie.Path, IOPath.GetFileName(movie.Path), ListBoxCheckBox_Checked, movie.Thumbnail, movie.Start, movie.End, movie.UniqueId); checkBoxContent.Tag = movie; checkBoxContent.CheckBox.IsChecked = movie.Checked; checkBoxContent.Label.ToolTip = movie.Path; checkBoxContent.Label.Tag = movie.Path; item.Content = checkBoxContent; checkBoxContent.StartTextBox.TextChanged += ListBoxTextBox_TextChanged; checkBoxContent.EndTextBox.TextChanged += ListBoxTextBox_TextChanged; FileListBox.Items.Add(item); }