i showing window on button click this:
private void showwindow(object obj) { var dialog = new additemview(); dialog.show(); }
if button clicked again, while window still open, how bring window front , not create new one?
just store dialog object , check whether it's been created in showwindow.
used windows closed event clear reference dialog object.
additemview dialog; private void showwindow(object obj) { if ( dialog == null ) { dialog = new additemview(); dialog.show(); dialog.owner = this; dialog.closed += new eventhandler(additemview_closed); } else dialog.activate(); } void additemview_closed(object sender, eventargs e) { dialog = null; }
Comments
Post a Comment