public void Execute_Click(object sender, EventArgs e)
        {
            if (pluginView.GetModel().Plugin == "")
            {
                MessageBox.Show("Please select a plugin in the list above first.", "PhotoTagStudio", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (currentPicture == null)
            {
                return;
            }

            mainForm.WaitCursor(true);

            PluginWorker worker  = new PluginWorker();
            bool         changes = worker.ProcessFile(currentPicture, pluginView.GetModel());

            if (changes)
            {
                if (!currentPicture.SaveChanges())
                {
                    this.ShowFileVanishedMsg(currentPicture.Filename);
                    mainForm.WaitCursor(false);
                    return;
                }

                FireDataChanged();
            }

            mainForm.WaitCursor(false);
        }
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker backgroundWorker = (BackgroundWorker)sender;

            PluginWorker worker = new PluginWorker();

            backgroundWorker.ReportProgress(0);

            List <string> filenames = this.GetAllFileList(this.processFilesInSubdirectories);
            int           i         = 0;

            foreach (string filename in filenames)
            {
                i++;
                PictureMetaData pmd;
                if (this.currentPicture != null &&
                    this.currentPicture.Filename == filename)
                {
                    pmd = currentPicture;
                }
                else
                {
                    if (File.Exists(filename))
                    {
                        pmd = new PictureMetaData(filename);
                    }
                    else
                    {
                        backgroundWorker.ReportProgress(i * 100 / filenames.Count);
                        continue;
                    }
                }

                bool breakForeach = false;
                if (worker.ProcessFile(pmd, pluginView.GetModel()))
                {
                    if (!pmd.SaveChanges())
                    {
                        breakForeach = !this.ShowFileVanishedMsg(pmd.Filename);
                    }
                }

                if (pmd != currentPicture)
                {
                    pmd.Close();
                }

                if (breakForeach)
                {
                    break;
                }

                backgroundWorker.ReportProgress(i * 100 / filenames.Count);
            }
        }