locked
Catch Unhandled exceptions in LightSwitch or Save temporaty Data client-side RRS feed

  • Question

  • Hello

    This is the scenario:

    LightSwitch Web Application working perfect but the notebooks are connected to a weak Wifi hotspot, some others over unstable GSM network.

    As the LightSwitch application needs to send requests to the server many times... sometimes the connection is lost and the screen crashes causing the data loss...

    I need to find the way to keep the data and the screen availability until the connection has been restablished.

    1. Is there a way to catch unhandled exceptions in the LS App to avoid the screen closes and show a warning to the user?

    2. If anybody has a similar scenario.. is there a way, technique or Extension to make LS save the data in client side and avoid new requests during the connection lost and send the request when is done...

    If someone has any idea, please help...

    This is causing me many problems..

    Thanks


    SebaXOR

    Wednesday, January 30, 2013 1:15 AM

Answers

  • It seems what you are looking for is something like this link here written by Paul van Bladel. I know it is something that I will be asked to do\consider in the future, but as Yann quite rightly said it does seem as if you are using the wrong tool.....

    If the only tool you own is a hammer, every problem looks like a nail

    :)


    If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)

    Thursday, January 31, 2013 4:54 PM

All replies

  • The only way I can think of to do something like this would be to wrap a RIA service around an attached data source. This way, you can use any .NET method you like.

    There's no built-in way to achieve this, or a way to do it with the ApplicationData tables.


    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, January 30, 2013 1:52 AM
    Moderator
  • ._. .......

    I think the 90% or questions I do has a "RIA Service" in the answer... :/

    The application is already done.. changing all the DS to RIA Services would be very complicated now..

    And even If I would do that, the "customizcable code" would be at server, not at client side.. and is client side Where I need to handle the connection lost...

    So.. any other Ideas Yann... (Yeah... me and my odd scenarios.. I know ._. or strange costumers with strange requeriments... )

    Thanks


    SebaXOR

    Wednesday, January 30, 2013 2:12 AM
  • You could have a database on the client PC and have it sync up when the client comes back to connectivity.  This is an out-of-LS solution, and one that I really don't recommend, but you asked for something that is not RIA Services...

    Wednesday, January 30, 2013 3:32 AM
  • Yeah... I have thought that.. but obiously I don't want to do an out-LS development...

    The only thing I have reach is to check connectivity every 10 seconds generating a request.. if the request fails, so the timer assumes that the server is not reachable and it shows a message to the user.. but if the user interacts with anything in the screen that requeries a query to the database, the screen will crash :(

    Any other idea from this... to improve this?...

    Thanks


    SebaXOR

    Wednesday, January 30, 2013 3:45 AM
  • I certainly understand your dilemma.  I have worked on projects where we knew there would be disconnected clients, like way out in the field for a long time, and then back up when they return.  Dealing with intermittent connectivity is different and will need a different solution.  If I think of something better than what you have tried I will let you know.
    Wednesday, January 30, 2013 4:01 AM
  • "I think the 90% or questions I do has a 'RIA Service' in the answer"

    That's because you keep wanting to do things that LightSwitch doesn't cater for. :-P Often, the only way to do these things are with a RIA Service.

    Part of being a good developer is managing your "customers' expectations". Another part is using the right tool for the right job. The saying "when all you have is a hammer, everything looks like a nail" comes to mind, lol.

    LightSwitch is simple to use when you use it for what it was designed to do, & it does a LOT of work for you. When you want to do things outside of those boundaries, you usually can, but you have to do extra work to achieve them.

    As for "other ideas", no I'm afraid I don't have any. You can certainly handle the displaying of unexpected errors to the user, but the offline/syncing data scenario is not going to be simple or easy.


    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, January 30, 2013 9:23 AM
    Moderator
  • ._. .... well.. the costumer never mentioned "unstable wifi"... if he would mentined it I would choose to do that specific module in a desktop envioronment... 

    Well.. anyway, do you still think I can control data transfer with a RIA Service?

    How can I do that?

    If better ideas come.. great

    Thanks :D


    SebaXOR

    Wednesday, January 30, 2013 4:43 PM
  • It seems what you are looking for is something like this link here written by Paul van Bladel. I know it is something that I will be asked to do\consider in the future, but as Yann quite rightly said it does seem as if you are using the wrong tool.....

    If the only tool you own is a hammer, every problem looks like a nail

    :)


    If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)

    Thursday, January 31, 2013 4:54 PM
  • This is exactly what I was thinking, but with a great post behind it!! +1
    Friday, February 1, 2013 4:22 AM
  • This is exactly what I was thinking, but with a great post behind it!! +1

    Hi, thanks for mentioning my article.

    Nonetheless, keep in mind that this is just an high level architecture for a mix between a disconnected client and a regular LS app, but... with one code base.  Working out in every detail, what I clearly didn't do,  such a scenario might reveal other issues. 

    Anyhow, good luck with giving it a try !


    paul van bladel

    Friday, February 1, 2013 6:06 AM