void btnRandomSeries_Click(object sender, RoutedEventArgs e) { GroupFilterVM gf = this.DataContext as GroupFilterVM; if (gf == null) { return; } MainWindow mainwdw = (MainWindow)Window.GetWindow(this); RandomSeriesForm frm = new RandomSeriesForm(); frm.Owner = Window.GetWindow(this);; frm.Init(RandomSeriesEpisodeLevel.GroupFilter, gf); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value && frm.Series != null) { if (mainwdw == null) { return; } mainwdw.ShowPinnedSeries(frm.Series); } }
void btnRandomSeries_Click(object sender, RoutedEventArgs e) { if (!(DataContext is VM_GroupFilter gf)) { return; } MainWindow mainwdw = (MainWindow)Window.GetWindow(this); RandomSeriesForm frm = new RandomSeriesForm { Owner = Window.GetWindow(this) }; frm.Init(RandomSeriesEpisodeLevel.GroupFilter, gf); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value && frm.Series != null) { mainwdw?.ShowPinnedSeries(frm.Series); } }