locked
Is there a built-in cycle to when things execute in Lightswitch? RRS feed

  • Question

  • In an effort to avoid spaghetti code I am trying to understand the cycle of execution of a Lightswitch application more precisely.

    If there are any dinosaurs out there (like me) who possess experience programming in RPGIII you will understand what I'm after... if not then in a nutshell I need to know when things run and what runs them. What runs first, followed by what, followed by what etc., and where is the Main Line code that is running them?

    For example... Lightswitch has an Entity Designer and a Screen Designer. Both create code which is accessible via the Write Code button, which I presume displays all the code associated with that Entity or Screen (whichever one you are working with)... or via the drop-down to the right of the Write Code button which is used to displays specific methods (it may simply get you to the portion of the code where that method resides).

    My question is... how do I decide where to put code that does not fall into any of the pre-defined categories. Again... as an example, the Screen Designer lists the following methods along with some cryptic definitions:

    _Activated _Closing _Created _InitilizeDataWorkspace _Run _SaveError _Saved _Saving

    The cryptic definitions are things like "Runs just before screen is displayed. Runs on Client." My question is "what runs it" and can it be altered? Also... when would I add code to the Screen Designer versus when would I add code to the Entity Designer?

    The methods accessible via the Write Code button appear to be Private Sub-routines. Can I write my own? If so, where do I put the code to execute them and what is the format of the code?   Can I only execute sub-routines from within the predefined sub-routines or is there some section of code someplace (that I know nothing about) where I would place such code.  For example… what happens when the tab key is pressed?  I assume some code someplace will execute… but where?   

    Perhaps my entire question/confusion can be summed up by asking... "Where is the Main Line code that is calling all of these sub-routines"?

    Thanks

     

        

      

      

    Tuesday, August 13, 2013 12:25 PM

Answers

  • Hi

    As with most "how it works" questions, my strong suggestion is for you to check out a couple of books that contain detailed explanations regarding your queries.

    For the LS HTML5 client, I recommend Michael Washington's book "Creating Web Pages Using the LightSwitch HTML Client: In Visual Studio 2012".

    And "Microsoft Visual Studio LightSwitch Unleashed" by Alessandro Del Sole, who's book focusses on the SL side of things, whereas Michael's book is all about the HTML5 client.

    I have both in eBook and paper version and constantly refer to them.

    I promise you, all will be revealed. These are two very clever guys ;-)

    All the best, Mark.


    Mark

    • Proposed as answer by ITPSB Tuesday, August 13, 2013 2:07 PM
    • Marked as answer by Yunjie Pei - MSFT Tuesday, August 20, 2013 12:16 PM
    Tuesday, August 13, 2013 1:49 PM
  • Get the book that Mark (ITPSB) recommends. Also this may help:

    Getting the Most Out of the Save Pipeline in Visual Studio LightSwitch by Dan Seefeldt (http://www.code-magazine.com/articleprint.aspx?quickid=1103071)


    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com



    Tuesday, August 13, 2013 4:28 PM

All replies

  • Hi

    As with most "how it works" questions, my strong suggestion is for you to check out a couple of books that contain detailed explanations regarding your queries.

    For the LS HTML5 client, I recommend Michael Washington's book "Creating Web Pages Using the LightSwitch HTML Client: In Visual Studio 2012".

    And "Microsoft Visual Studio LightSwitch Unleashed" by Alessandro Del Sole, who's book focusses on the SL side of things, whereas Michael's book is all about the HTML5 client.

    I have both in eBook and paper version and constantly refer to them.

    I promise you, all will be revealed. These are two very clever guys ;-)

    All the best, Mark.


    Mark

    • Proposed as answer by ITPSB Tuesday, August 13, 2013 2:07 PM
    • Marked as answer by Yunjie Pei - MSFT Tuesday, August 20, 2013 12:16 PM
    Tuesday, August 13, 2013 1:49 PM
  • Hi

    Forgot to add, I'm also one of those Dinosaurs.

    I go back to IBM Assembler days when COBOL was for wimps ;-)

    Regards, Mark
    PS: Who said you can't teach an old dog new tricks.


    Mark

    Tuesday, August 13, 2013 1:54 PM
  • ...For the LS HTML5 client, I recommend Michael Washington's book "Creating Web Pages Using the LightSwitch HTML Client: In Visual Studio 2012".

    And "Microsoft Visual Studio LightSwitch Unleashed" by Alessandro Del Sole, who's book focusses on the SL side of things, whereas Michael's book is all about the HTML5 client.

    I have both in eBook and paper version and constantly refer to them...

    Thanks!

    I also have both books in paper and E-book and constantly refer to them :)


    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com

    Tuesday, August 13, 2013 3:13 PM
  • Get the book that Mark (ITPSB) recommends. Also this may help:

    Getting the Most Out of the Save Pipeline in Visual Studio LightSwitch by Dan Seefeldt (http://www.code-magazine.com/articleprint.aspx?quickid=1103071)


    Unleash the Power - Get the LightSwitch HTML Client book

    http://LightSwitchHelpWebsite.com



    Tuesday, August 13, 2013 4:28 PM