예제 #1
0
        private async Task ApproveSelectedSeries(bool?approve)
        {
            await CancelPipeline();

            if (!approve.GetValueOrDefault() || !SelectedSeries.Any())
            {
                SeriesSelected?.Invoke(this, new Series[] { });
                return;
            }

            DownloadImagesProgress = 0;

            var selectedSeries = SelectedSeries.Select(vm => vm.Series); // unwrap

            var request = new GetSeriesImagesRequest
            {
                Series = selectedSeries
            };

            request.Progress += (s, e) =>
            {
                DownloadImagesProgress = e;
            };

            await _searchService.GetSeriesImagesAsync(request, CancellationToken.None);

            SeriesSelected?.Invoke(this, selectedSeries.ToArray());

            SelectedSeries.Clear();

            DownloadImagesProgress = 0;
        }
예제 #2
0
        private async void OnSeriesSelected(object sender, ICollection <Series> selectedSeries)
        {
            await Task.Run(() =>
            {
                SeriesSelected?.Invoke(this, EventArgs.Empty);
            });

            await _dispatcher.BeginInvoke((Action)(() =>
            {
                if (selectedSeries.Any())
                {
                    _stripsManager.AddSeries(selectedSeries);
                }
            }), DispatcherPriority.ApplicationIdle);
        }