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

UWP: how to customize the app title
Crystal report SetParameterValue
Connecting Sphero & a Windows UWP app
How To Configure Multiple ISessionFactory in NHibernate?
Xamarin Button IsVisible Binding with ValueConverter not working
Unable to get TSC-TDP247 Printer Status from c#
passing a null value to the database from a dropdownlist in the form of boolean in c#
General function failure [Grid_266]
Sending Lotus Notes email through C# hiding SentBy field
Activityindicator stops spinning in Xamarin.forms
Posting Collection to OData Controller not returning nested collection property to client
How do I modify the rich text box control to simulate a code editor [closed]
How to insert Dot on Each character
UWP Xbox One difference between running in Retail to Dev Mode
MSBuild Build same DLL with two different projects
ILMerge.Merge: ERROR

Categories

HOME
autohotkey
ssh
formatting
data-modeling
ms-application-insights
snmp
open-search-server
markdown
osx-yosemite
yacc
software-collections
gcloud
websharper
jinja2
virtuemart
wallet
alert
project-structure
lotusscript
connectiq
opengraph
pushbullet
v4l2
apdu
poisson
windows-10-mobile
undo
multilanguage
key-bindings
spring-oauth2
cache-control
campaign-monitor
sdl-2
framebuffer
queryover
armadillo
susy
python-venv
automapper-4
cancan
visualizer
htop
sharpssh
try-catch-finally
bipartite
rmq
breadcrumbs
android-tabs
hdr
scriptengine
hoare-logic
normalisation
bytearray
system-integration
jde
archiva
android-progressbar
trendline
ooad
markerspiderfier
google-app-engine-php
cascading
personality-insights
musicbrainz
stderr
system.diagnostics
jeet-grid
copy-on-write
sony-xperia
teamstudio-unplugged
dojox.grid
nsurlrequest
cocos2d-x-2.x
worklight-appcenter
azure-caching
nativequery
node-amqp
imaplib
netbeans-plugins
facebook-likebox
google-oauth-java-client
misfire-instruction
dylan
octokit
asp.net-4.0
generator-expression
boost.build
gpl
screensharing
xcode4.6.3
towerjs
scsf
cherokee
flexbuilder
jexcelapi
azure-appfabric
miniport
hp-trim
content-delivery-network
tracd

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