public static MutipleDownloadDialog Create <T>(IEnumerable <T> Items, Func <T, MutipleDownloadDialogItem> converter, Func <MutipleDownloadDialogItem, BiliVideoQuality, Task> downloader) { var vm = new MutipleDownloadDialogViewModel { Collection = new ObservableCollection <MutipleDownloadDialogItem>() }; foreach (var item in Items) { vm.Collection.Add(converter.Invoke(item)); } var dialog = new MutipleDownloadDialog(vm, downloader); return(dialog); }
private MutipleDownloadDialog(MutipleDownloadDialogViewModel vm, Func <MutipleDownloadDialogItem, BiliVideoQuality, Task> downloader) { _vm = vm; _downloader = downloader; this.InitializeComponent(); }