Esempio n. 1
0
        private void CopyForUrls(object sender, ExecutedRoutedEventArgs e)
        {
            ScheduledGrab url = e.Parameter as ScheduledGrab;
            if (url == null)
                return;
            var dlg = new WinUserInput()
                          {
                              Prompt = "Enter URLs",
                              AcceptsReturn = true,
                              Owner = this
                          };
            if(dlg.ShowDialog()==true)
            {
                var rawUrls = dlg.UserInput;
                if(string.IsNullOrWhiteSpace(rawUrls))
                    return;
                BackgroundWorker saveWorker = new BackgroundWorker();
            saveWorker.DoWork += (s, dwe) => {

                var db = new SqLiteDal();
                                                 var urls = rawUrls.Split(new[] {"\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries);
                                                 db.DuplicateGrabs(url, urls);
            };
            saveWorker.RunWorkerCompleted += (Fs, rwe) => {
                                                 if(rwe.Error != null) {
                                                     DialogBox.ShowAlert(this, rwe.Error.Message, "Error Saving Job Results");
                                                 }
                NavigationCommands.Refresh.Execute(null, this);
                                             };
            saveWorker.RunWorkerAsync();
            }
        }