コード例 #1
0
        private async void BatchUpdate(List <Podcast> batch)
        {
            var progress = new Progress <int>();
            var watch    = Stopwatch.StartNew();

            progress.ProgressChanged += ProgressReported;

            if (batch.Count > 0)
            {
                try
                {
                    InsertCommandConsole("Loading...");
                    await podcastController.UpdatePodcastBatch(batch.ToList(), progress, listBoxConsole);

                    watch.Stop();
                    InsertCommandConsole("Feed updated successfully...");
                    InsertCommandConsole($"Total execution time (ms): " + (watch.ElapsedMilliseconds));
                    if (textBoxFilterCategory.Text.Equals(""))
                    {
                        InsertPodcasts();
                    }
                }
                catch (ExceptionHandle)
                {
                    listBoxConsole.Items.Add("Error, don't add items while its loading.");
                    listBoxConsole.Items.Add("Make sure to be connected to the internet.");
                }
            }
        }