• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Terminate WPF/Windows forms applications....

MrSeanKon

New Member
Joined
Nov 14, 2006
Messages
267 (0.07/day)
Likes
73
Location
Athens in love with Anna :)
#1
WPF has no concept of MDI applications. In fact Microsoft is trying to discourage any one using that form of application. I'm new to WPF and I really like MDI applications. It allows me to move quickly between windows and compare the content of different windows. Furthermore, sometime the content of one window is useful for another so I can copy and paste. I think it's a great user experience for working mode.
To continue, download the attachment!
It includes two folders, they are very simple code.
The point is how you can terminate an application (Windows Form and WPF).
 

Attachments

Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
21,083 (6.22/day)
Likes
10,212
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#3
http://msdn.microsoft.com/en-us/library/ms597013.aspx

Application.Current.Shutdown()


WPF is just a displayer of data. If you want to "compare the content" then you should compare the underlying, databound collections. Copying and pasting is also performed via the databound collections.


Edit: Technically the correct method to terminate an application is to end all threads...

In console programs, the thread that runs the console is the main thread. Close the application by making sure nothing is keeping the main thread open (e.g. Console.ReadKey() or close all worker threads).

In WinForms and WPF programs, the thread that runs the main form is the main thread. Call this.Close() from within the form to gracefully terminate the application. If there are worker threads that are busy, make sure to close them before calling this.Close().

All applications gracefully terminate when all their threads are closed. The only scenario where Shutdown(), Exit(), or similar should be called is in the case of major, unrecoverable error.
 
Last edited: