private void WorkCompleted(object sender, RunWorkerCompletedEventArgs e) { var error = e.Error; if (error != null) { MessageBox.Show(error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { convertedDocumentView = new ConvertedDocumentView(caller, this, convertButton, predictions, partitions, template, new Size(inputImage.Width, inputImage.Height), filePath) { Text = Text, Location = new Point(Location.X + 50, Location.Y + 25), MdiParent = caller }; convertedDocumentView.Show(); MessageBox.Show("File is successfully converted!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } bw.DoWork -= DoWork; bw.RunWorkerCompleted -= WorkCompleted; }
public void DeleteReference() { convertedDocumentView = null; }