locked
How to fully close a desktop ls app RRS feed

  • Question

  • I´d like to add a button that could exit fully my application

    anybody knows the code??

    Tuesday, March 5, 2013 10:10 PM

Answers

  • Replying to your post before you edited it, it sounds like you haven't ticked the box in the extensions tab of the project properties to enable it for your project.

    As soon as you enable the extension, the new command buttons will appear on each screen.

    Oh, one thing that you didn't specify is if you're using LS 2012, & I forgot to ask. I think there's a problem with the extension in LS 2012 (I'm still using LS 2011).

    Here is the C# equivalent of the VB code you found:

    private void ExitApplication()
    {
        Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(
            () => {	System.Windows.Application.Current.MainWindow.Close();
                });
    }
    The Sub() is the VB way of writing a lambda void function.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, March 7, 2013 1:24 AM
    Moderator

All replies

  • My Luminous Commands extension has a global Exit command (which appears on each screen). If you don't want to use that, I'll look up the code that it's executing.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Wednesday, March 6, 2013 2:47 AM
    Moderator
  • My Luminous Commands extension has a global Exit command (which appears on each screen). If you don't want to use that, I'll look up the code that it's executing.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.


    how can i see the code for the exit button?

    Wednesday, March 6, 2013 3:53 PM
  • i found this code that works fine but i dont fully understand vb

     Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(Sub()
                                                                                 System.Windows.Application.Current.MainWindow.Close()

                                                                             End Sub)

    i dont understand the sub()

    can someone explain this to me in c#?

    Wednesday, March 6, 2013 5:59 PM
  • Replying to your post before you edited it, it sounds like you haven't ticked the box in the extensions tab of the project properties to enable it for your project.

    As soon as you enable the extension, the new command buttons will appear on each screen.

    Oh, one thing that you didn't specify is if you're using LS 2012, & I forgot to ask. I think there's a problem with the extension in LS 2012 (I'm still using LS 2011).

    Here is the C# equivalent of the VB code you found:

    private void ExitApplication()
    {
        Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(
            () => {	System.Windows.Application.Current.MainWindow.Close();
                });
    }
    The Sub() is the VB way of writing a lambda void function.

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, March 7, 2013 1:24 AM
    Moderator