c# - Windows Forms OpenFileDialog, prevent opening instance if dialog already showing -
i have openfiledialog instance on class, this.
public myclass { public openfiledialog dialog { get; set; } public myclass() { dialog = new openfiledialog(); } public void showdialog() { if (dialog.showdialog() == dialogresult.ok) { dostuff(dialog.filenames); } } }
the issue if spam click button open dialog 3 times, dialog pop open once. once close first dialog, show additional 2 times. there way can detect if dialog showing prevent popping open?
edit: using unity3d experience utilizing mono version of system.windows.forms. because of this, there isn't form "owning" dialog, unity game window. button pushed gui element inside game.
thanks
try:
dialog.showdialog(this);
assuming here this
form contains button. should display dialog modal form it's owner preventing activating or using controls on form until dialog dismissed.
Comments
Post a Comment