private void Add_Group(object sender, RoutedEventArgs e) { ParentGroup p = new ParentGroup(); rootWrapPanel.Children.Add(p); }
public MainWindow(Data data) { InitializeComponent(); isEdit = true; show_data.Visibility = Visibility.Hidden; editData = data; if (data != null) { title.Text = data.Title; link.Text = data.Link; // style var elements = style.Children; foreach (var e in elements) { CheckBox c = e as CheckBox; if (data.Style.Contains(c.Content.ToString())) { c.IsChecked = true; } } // type ListBox typeListBox = type as ListBox; foreach (ListBoxItem item in typeListBox.Items) { if (item.Content.ToString() == data.Type) { typeListBox.SelectedItem = item; } } // total time try { total_time.Value = data.TotalTime; } catch (Exception ex) { } // target audience elements = target_audience.Children; foreach (var e in elements) { CheckBox c = e as CheckBox; if (data.TargetAudience.Contains(c.Content.ToString())) { c.IsChecked = true; } } // purpose elements = purpose.Children; foreach (var e in elements) { CheckBox c = e as CheckBox; if (data.Purpose.Contains(c.Content.ToString())) { c.IsChecked = true; } } // voice over elements = voiceover.Children; foreach (var e in elements) { CheckBox c = e as CheckBox; if (data.VoiceOver.Contains(c.Content.ToString())) { c.IsChecked = true; } } // music vfx elements = music_vfx.Children; foreach (var e in elements) { CheckBox c = e as CheckBox; if (data.MusicVFX.Contains(c.Content.ToString())) { c.IsChecked = true; } } // global rating ListBox grListBox = global_rating as ListBox; foreach (ListBoxItem item in grListBox.Items) { if (item.Content.ToString() == data.GlobalRating) { grListBox.SelectedItem = item; } } // color scheme ListBox csc = color_scheme_color as ListBox; ListBox csn = color_scheme_number as ListBox; ListBox csy = color_scheme_yesno as ListBox; foreach (ListBoxItem item in csc.Items) { if (item.Content.ToString() == data.ColorScheme.Color) { csc.SelectedItem = item; } } foreach (ListBoxItem item in csn.Items) { if (item.Content.ToString() == data.ColorScheme.Number) { csn.SelectedItem = item; } } foreach (ListBoxItem item in csy.Items) { if (item.Content.ToString() == data.ColorScheme.YesNo) { csy.SelectedItem = item; } } // Sequences foreach (var g in data.Groups) { ParentGroup p = new ParentGroup(); p.group.Header = g.Name; rootWrapPanel.Children.Add(p); foreach (var s in g.Sequences) { Sequence sequence = new Sequence(); sequence.what.Text = s.What; sequence.from.Text = s.TimeSec.From; sequence.to.Text = s.TimeSec.To; sequence.duration.Text = s.TimeSec.Duration; ComboBox style = sequence.style; foreach (var item in style.Items) { CheckBox checkBox = (item as ComboBoxItem).Content as CheckBox; if (s.Style.Contains(checkBox.Content.ToString())) { checkBox.IsChecked = true; } } // voice list ListBox voiceOverListBox = sequence.voiceList as ListBox; foreach (ListBoxItem item in voiceOverListBox.Items) { if (item.Content.ToString() == s.VoiceMusic.Type) { voiceOverListBox.SelectedItem = item; } } sequence.voiceDropDown.Value = (int?)s.VoiceMusic.Level; sequence.energy.Value = (int?)s.Energy; //sequence.rtb2.SetValue() sequence.rtb2.Document.Blocks.Clear(); sequence.rtb2.Document.Blocks.Add(new Paragraph(new Run(s.Description))); try { BitmapImage logo = new BitmapImage(); logo.BeginInit(); string home = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string directory = home + @"\AnimationSequencingData\Images\"; logo.UriSource = new Uri(directory + s.ImageSource); logo.EndInit(); sequence.image.Source = logo; sequence.ImageSource = s.ImageSource; } catch (Exception ex) { } sequence.keywords.Text = s.Keywords; p.rootWrapPanel.Children.Add(sequence); } } } }