2016년 12월 28일 수요일

Howto: How to restart an App


Did a search on this and there didn't seem to be a definitive answer, other than a screen orientation change bug which now doesn't seem to work?

Anyway, had a go at this and came up with the following:

As long as Screen1.Initialize is good enough for you:

1. create a new screen
2. Drag out the Screen2.Initialize block and put a Close Screen block in it
3. You can adjust the look of the screen if you want, put a label in it with a message etc.
4. Add a new button to Screen1 call it Restart or Reset
5. Drag out the Button.Click block for your Restart button and put a "open another screen ScreenName" block in it, with Screen2 as the target.
6. Now when you click on Restart your app is restarted  

--
This will work like this only in the companion app, but not anymore after building the app
This is, because there are some limitations of the companion app, see also chapter "Some Notes" here https://puravidaapps.com/manager.php

Current limitations of the AI Companion app:

1. The close screen block triggers the Initialize event instead of the OtherScreenClosed event.
2. The close screen with value block triggers both the Initialize and OtherScreenClosed events instead of only the OtherScreenClosed event.
3. The close application block does not work, a message 'Closing forms is not currently supported during development' will be displayed instead.

to restart an app, probably the easiest was is to use Tribblehunter's method https://puravidaapps.com/tribblehunter.php

-- 
You are right of course Taifun. But I used the wrong block!

On the second screen use the "open another screen ScreenName" block and put Screen1

In testing I put in a clock timer for good effect.

Then it works in a built app :)

-- 
well, never use the open another screen block together with "Screen1", else you open the already opened Screen1 the second time

if you only use the open another screen and never the close screen block, you will run out of memory after a while. Also reopening an already opened screen is a bad idea. For example if you open Screen1 twice, you also have to close your app twice!

the only exception to that rule is to use the Tribblehunter method in all screens https://puravidaapps.com/tribblehunter.php

-- 
OK you win :)


--

댓글 없음:

댓글 쓰기