I have an app which gives me a score at the end of the game and I want the users to share their scores on facebook.
I want scoring information to be restored to the "end game" screen after the user has logged into facebook, and move to the facebook section of the panorama/pivot.
How do I go about this? Do I save that information to storage or to I use a variable in app.xaml.cs?
You should store this data in the page's State property in the OnNavigatingFrom or OnNavigatedFrom events of the page.
You can then access it again in the OnNavigatedTo event.
The situation you are handling is called tombstoning. Read more about it at http://msdn.microsoft.com/en-us/library/ff817008(v=vs.92).aspx
Related
I've been told that you should really only use a database if your data will be updated in some way by the end user. But what if your website is "static" in the sense that the user doesn't update anything?
For example maybe your website displays a map of the USA and you can click on each state, click on a few cities in each state and view data for those areas(population, demographics, climate history, whatever). Is a database in this situation appropriate? The user isn't updating anything but you can end up with some very large datasets depending on what information you want to display. Would a database be appropriate for something like this?
I have an angularjs app with ASP.NET WebAPI2 REST APIs. There is a scenario where I have a display a popup for initiating a survey for end users (both authenticated and anonymous types). On clicking the popup options, the user will be redirected to another applicaiton which captures all the responses provided by the user.
There is no relation between the angularjs app and the survey application.
Now next time if the user revisits the application then in that case based on the previous action taken to fill the survey , I have to take a decision to display or hide the popup for the user.
I thought of cookies and localStorage as the options but I think are not ideal choices for this scenario.
Can anyone help me to know are there any other possible options to handle this scenario?
You can solve this using the redirection link.
For example if he finished correctly the Survey you will redirect him to:
www.myapp.com/survey/success
Than in the App you can do something like: get the URL parameters, if the parameters is success store it on localStorage so next time he revisits the web-page the Popup wont show.
Otherwise direct him to:
www.myapp.com/survey/
I think the best option here is to save this information in the database using your ASP.NET WebAPI2 REST APIs. In the moment that the end user clicks the survey you can also make an Api call which will save in the database info about user's action(this will probably be sth you can do for authenticated users). For not authenticated users you can just save that information in localStorage in the moment they are clicking the survey.
I am working on iOS 6, ARC,storyboards enable iphone app. I am trying to figure out log out functionality and what should happen when user wants to log out. I have a menu like Facebook and a log out option with in the menu. To mimic the menu I am using ECSlidingViewController.
What I really want to find out is, what actually should happen when user logs out in terms of bringing applicaition to it's launch state with nothing in memory.
thank you
When user logs out you usually do the following:
Pop to the root view controller or (main menu / login screen).
Clear out all user data saved in db or userDefaults.
You could use popToRootViewControllerAnimated: to have all your view controllers popped except the original root view controller and then the display will update.
I work in a navigation view. In this navigation view, you can stumble on a profile page.In this profile page you can see others profiles related to the current profile (basically pictures displayed in a dataview). You can navigate to other profile views by taping on these profiles.
Every time, the user click on a profile pictures, I create a new instance of the profile view and a new instance of the profile store.
Now, what I want to do, when the user goes back, (so when the view is popped) is delete the instance of the store associated to the instance of the profile view.
I already know when and how to delete the view, I just want to know how to delete the store and any reference to it.
Update : StoreManager
I just discovered the Ext.StoreManager.unregister function. Is it enough or is there something that should be done, to release the store (in order to free memory)?
Ext.getStore('storeId').destroy();
http://docs.sencha.com/touch/2-0/#!/api/Ext-method-getStore
I have a login page which is shown on first launch. After the user puts in his credentials he is taken to the main page of the application. At this point, if the user presses the back key I want it to skip the login page and exit. I tried what was suggested here: Remove a page from Navigation Stack (in OnNavigatedTo, use NavigationService.GoBack()) but it throws an exception because there is nothing else in the back stack. I read some other places that not handling exceptions is basically the only way to close the app...
The problem with this method of closing the app is, well other than being a hack, it doesn't hit Application_Closing() so my state isn't saved.
Anyone know how I can skip the login page when hitting the back key, save state, and exit the application?
Thanks in advance!
Yeah, this is becoming a huge problem with Navigation in WP7 - many folks are complaining about this same type of issue. The key to remember is that Navigation mimics navigation of a website - it acts a lot less like UserForms and more like web pages and their static history.
The easiest way around this which is both transparent to your users and easy for you is to make that first login page you are reference as User Control that sits on top of your actual main page (i.e. don't use a phone:PhoneApplicationPage for your login page - just a control that is part of your main page phone:PhoneApplicationPage). Use a boolean in your OnNavigatedTo on the main page that says "if user is not logged in, display login control, otherwise, just show main page."
On saving state (i.e. tombstoning), ask another question as that's another topic.
The general best practice is to not use a page for anything you dont want in the navigation stack.
In my case i chose to use a Popup to host my Login Control. I pop it from my mainpage if they are not logged in. If they are i dont show it. This way if they are not logged in and hit back, they exit the app. However if they are logged in and also on teh main page, they see their data, and if they hit back they also exit the app (not see the login page).
For the login / home page scenario one thing you can do is on successful login rather than navigating to the home page you call "GoBack", this will take them back to the home page, but pop the login page off the navigation stack and allow the user to exit the app on the next press of the back button.