private void BtnAdd_Click(object sender, RoutedEventArgs e) { if (!(sender is Button button)) { return; } FrmPickOne frmPickOne = new FrmPickOne(); Point screenPos = button.PointToScreen(new Point(0, 0)); frmPickOne.Left = screenPos.X; frmPickOne.Top = screenPos.Y; frmPickOne.lbChoices.ItemsSource = Storage.LoadEntriesFromFile <EffectEntry>("AllEffects.json"); if (frmPickOne.ShowDialog() == true) { if (frmPickOne.SelectedEntry is EffectEntry effectEntry) { string entryName = effectEntry.Name; TimeLineEffect newEntry = AddEntry(TimeSpan.Zero, GetEffectDuration(effectEntry), entryName, effectEntry); newEntry.PropertyChanged += Entry_PropertyChanged; OnPropertyChanged(); } } }
private void LbEffectsList_ClickAdd(object sender, RoutedEventArgs e) { if (lbEffectsList.ItemsSource == null) { lbEffectsList.ItemsSource = new ObservableCollection <EffectTimeLines>(); } if (!(lbEffectsList.ItemsSource is ObservableCollection <EffectTimeLines> timeLines)) { return; } FrmPickOne frmPickOne = new FrmPickOne(); Point screenPos = lbEffectsList.PointToScreen(new Point(0, 0)); frmPickOne.Left = screenPos.X; frmPickOne.Top = screenPos.Y; frmPickOne.lbChoices.ItemsSource = GetEffectsList(lbEffectsList.ItemsSource); if (frmPickOne.ShowDialog() == true) { if (frmPickOne.SelectedEntry is EffectEvent effectEvent) { EffectTimeLines effectTimeLines = new EffectTimeLines(); effectTimeLines.Name = effectEvent.Name; timeLines.Add(effectTimeLines); groupEffectBuilder.tlEffects.ItemsSource = effectTimeLines.Entries; groupEffectBuilder.Visibility = Visibility.Visible; OnPropertyChanged("Effects"); //groupEffectBuilder.Entries = null; string entryName = effectEvent.Name; } } }