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

Terminate WPF/Windows forms applications....

Discussion in 'Programming & Webmastering' started by MrSeanKon, Nov 24, 2012.

  1. MrSeanKon

    MrSeanKon New Member

    Nov 14, 2006
    267 (0.07/day)
    Thanks Received:
    Athens in love with Anna :)
    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).

    Attached Files:

    Last edited: Nov 25, 2012
    10 Year Member at TPU
  2. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Feb 6, 2007
    13,817 (3.50/day)
    Thanks Received:
    Cheeseland (Wisconsin, USA)
    If you do want to use something like MDI in WPF you can look at WPDMDI over at Codeplex.
    10 Year Member at TPU
  3. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Oct 13, 2008
    20,849 (6.26/day)
    Thanks Received:
    IA, USA


    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: Dec 1, 2012
    Crunching for Team TPU

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)