Beispiel #1
0
 private void ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     // Set current progress
     ProgressBar.Value   = e.ProgressPercentage;
     ProgressBar.Content = e.UserState;
     // Send current progress to status view
     OnSearchProgress?.Invoke(ProgressBar);
 }
Beispiel #2
0
        private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (_itemsNotFound)
            {
                // Show alert
                MessageBox.Show("Nothing to show. Please, change your query!",
                                "Info",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
                return;
            }

            if (!e.Cancelled)
            {
                var message = "";
                if (BrokenUrls.Count > 0)
                {
                    message  = "Not all items was copied! \n";
                    message += "Broken links: \n";
                    foreach (var item in BrokenUrls)
                    {
                        message += item + "\n";
                    }
                }
                else
                {
                    message = "Items was successfully copied! \n";
                }
                // Show alert
                MessageBox.Show(message,
                                "Info",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);

                // Send grabbed items to result view
                OnItemsGrabbed?.Invoke(AliItems);
            }
            else
            {
                // Show alert
                MessageBox.Show("Operation was canceled!",
                                "Info",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
            // Clear broken urls list
            BrokenUrls.Clear();
            // clear and hide progress bar
            ProgressBar.Content    = "Ready";
            ProgressBar.Visibility = Visibility.Hidden;
            // Send current progress to status view
            OnSearchProgress?.Invoke(ProgressBar);

            // Enable search button
            ButtonGo.IsEnabled = true;
        }
Beispiel #3
0
 public void Search()
 {
     if (!_bw.IsBusy)
     {
         // Run task at the background
         _bw.RunWorkerAsync();
         // Show progress bar
         ProgressBar.Value      = 0;
         ProgressBar.Content    = "";
         ProgressBar.Visibility = Visibility.Visible;
         // Send current progress to status view
         OnSearchProgress?.Invoke(ProgressBar);
         // Disable start button
         ButtonGo.IsEnabled = false;
     }
 }
Beispiel #4
0
 private void Worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     OnSearchProgress?.Invoke((SearchStatus)e.UserState);
 }