c#


There is no way to reuse the Window after ShowDialog has been called [on hold]


As the title says - there is no way to reuse the Window after ShowDialog() has been called. Possible outcomes are that the user clicks close button which closes the Window and the expected behaviour is that the Window gets closed and disposed.
But, if user calls Window.Hide() in code, this will also dispose the Window. I found some articles where it says this is a bug but it is so weird thet they would let this out as a bug.
If you check WinForms there you can call ShowDialog() as many times as you want since Hide() just conceals the Window from the user and the ShowDialog() method is just a way of showing the Window to the user while blocking message loop of previous Window.
My question is - is there a way to successfuly call ShowDialog() after calling Hide()?
Any workarounds you might have?
The closes I can get is inheriting the Window and hiding ShowDialog() method with new one where I call Show() method and immediately after it I can call System.Windows.Threading.Dispatcher.Run(). This kinda freezes the previous message loop but the problem with this is I don't know how to pop the main execution frame from the event queue. If I caould 'undo' this method call somehow I would continue with execution of my own implementation of ShowDialog and could return a bool value.
UPDATE
Window.Hide() does not dispose the Window it simply conceals it. The issue is calling Close() or setting DialogResult to anything but null. Both of these approaches will dispose the Window and next call to ShowDialog will produce exception:
Cannot set Visibility or call Show, ShowDialog, or
WindowInteropHelper.EnsureHandle after a Window has closed.
Only Close and setting DialogResult to true/false will cause the ShowDialog() method to return.
So bottom line is that you cannot reuse the Window after calling ShowDialog() once and getting a return value from this method.

Related Links

How to calculate the sum of the datatable column in c#
System.ArgumentException “Parameter is not valid” when comparing image dimensions
Set field via class
how to use ModelState.IsValid in ASP.NET?
protobuf-net : v2 deserialize v1 objects with inheritance
Getting data on ListView Select event and setting it in a div in C#
c# Oledb add list of parameters in a foreach loop
dotnet ef not works with ef tools 1.1.0-preview4-final
Check permission of a PDF using itext [duplicate]
Is there an event fired when WebBrowser content is redrawn?
How can I filter a DataTable without brute-forcing it?
Creating objects using an older version of Google Protobuf
WPF Combo box not calling setter method when item changed
Entity RemoveRange delete all rows
zip is not working in the same way on 4.2 to 6.0
Twilio Error - 12300 - Invalid Content Type only sometimes

Categories

HOME
pact
logging
javafx
kendo-ui-angular2
kendo-ui
openacc
phantomjs
kendo-asp.net-mvc
sitemap
restheart
subprocess
segmentation-fault
wkhtmltopdf
jcodemodel
unreal-engine4
drush
fine-uploader
comma
django-rest-auth
single-page-application
infinite-loop
rvm
pumping-lemma
scrapy-spider
sasl
inspec
symlink
android-cursorloader
arp
lines
webspeech-api
device-driver
anypoint-studio
nscollectionview
mockserver
mybatis-generator
sknode
socketcluster
compiler-warnings
uitextview
nshttpurlresponse
risc
gridgain
denodo
pyopenssl
ng-class
hellosign
google-scholar
turbolinks
deck.js
magick.net
innertext
hana-sql-script
dday
adempiere
musicbrainz
vanilla-forums
autoscaling
eggplant
genome
sicstus-prolog
asp.net-2.0
iphone-6
sync
system.net
selenium-grid2
ccmenuitem
scjp
episerver-7
mdp
xml-validation
myrrix
raddatepicker
listpicker
qmainwindow
phone-state-listener
algol
cryptarithmetic-puzzle
linear-interpolation
m3u
jquery-1.8
nsscrollview
bash4
reflexil
wdm
parallel-python
pex-and-moles
digg
qvariant
noise-reduction
miniport
data-formats
jgrowl

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App