Ticket B193153
Visible to All Users

Closing XAF Window closes entire application

created 14 years ago

I am showing a XAF window from a standard windows form. If I show the XAF window with a target of NewModalWindow my application stays running after I close the XAF window.
However, If I show the XAF window with a target of NewWindow my application shuts down when I close the XAF window.
I have attached a sample project that shows this behavior.

Answers approved by DevExpress Support

created 14 years ago (modified 6 years ago)

Hi Charles,
This issue is caused by the fact that the WinShowViewStrategyBase calls the Application.Exit method if there are no other XAF windows. The windows you are opening manually are modal, and are not taken into account.

UPDATED:
To overcome this issue, create a custom ShowViewStrategy and override the WinShowViewStrategyBase.ExitApplication method without calling the base method as follows:

C#
public class MyShowViewStrategy : ShowInMultipleWindowsStrategy { public MyShowViewStrategy(XafApplication app) : base(app) { } protected override void ExitApplication() { //base.ExitApplication(); } }

I have modified your project accordingly. It is attached. Please let us know if this makes sense.
Thanks,
Michael.

    Comments (3)

      That works perfectly. Thank you.

      DD DD
      David Desiderà 6 years ago

        Hi Michael,

        I have the same issue with a Xaf Win Application version 18.1.4, but your code not working with this version… please could you show me how to prevent this behavior with my DevEx version?

        Thanks,

        Davide

        DevExpress Support Team 6 years ago

          @Davide: In the current version, to avoid this issue, you can override the WinShowViewStrategyBase.ExitApplication method without calling the base method.
          I have updated the answer.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.