BackgroundWorker + MessageBox

0

Wykonuje dość obszerne operacje i używam backgroundworkera. W niektórych sytuacjach chciałbym wyrzucić MesageBox. Nie miałem problemu z postępem ani z uzupełnieniem etykiety:

public int SetProgress 
        {
            set
            {
                if (this.progressBar.InvokeRequired)
                    this.progressBar.Invoke(new MethodInvoker(delegate { this.progressBar.Value = value; }));
                else
                    this.progressBar.Value = value;
            }
        }
public string SetStatusLabel
        {
            set
            {
                if (this.statusStrip.InvokeRequired)
                    this.statusStrip.Invoke(new MethodInvoker(delegate { this.statusStrip.Items[1].Text = value; }));
                else
                    this.statusStrip.Items[1].Text = value;
            }
        }
 

Jakoś nie mogę sobie poradzić ani wygoglować jak zrobić w podobny sposób wyświetlanie MessageBox.
Dzieki za pomoc

0
 if ( Form1.InvokeRequired ) {
            Form1.Invoke((Action)delegate{MessageBox.Show(Form1,"Hello");});
        }
 

Działa indealnie. Dzieki. Aż mi głupio, że sam tego nie znalazłem.

1 użytkowników online, w tym zalogowanych: 0, gości: 1