As stated by Microsoft, it's not possible to programatically navigate from the main page. I have a EULA page that I need to show if the user is using the app for the first time. My plan was to determine on the main page if the app has been used before. If not, I had planned to navigate to the EULA page, but this is not possible. How can I get around this navigation limitation?
The issue with a dedicated EULA page that is automatically pushed on the back stack is that the application won't quit when the user presses the Back key when in the EULA page.
You should instead use a Popup control that you show and hide when appropriate.
See Peter Torr's post on how to exit an application for more details and background.
It should be possible to navigate from the main page easily using:
if (!eulaAgreed)
NavigationService.Navigate(new Uri("/EULAPage.xaml", UriKind.Relative));
Probably best to put this code in OnNavigatedTo of your main page or even later in the page cycle using Dispatcher.BeginInvoke(...). Putting it before that (i.e. in the constructor or Loaded) may not work.
What do you think happens to the Navigation stack?
Would the users be able to access the EULA page again? maybe by clicking back from the MainPage ?
Related
I'm developing a UWP app for both mobile and PCs.
I need to ask for a passcode every time the app start, also when resumed after suspension.
When the app is resumed I navigate to a pin check page, then, if the passcode is correct I navigate to the page which was shown before suspending.
The problem is that I have a page with a textbox and other control, how can I resume the text in TextBox?
When I resume the app without using pin page, I have no problem because the content of the page is totally resumed.
Thanks
The problem is that I have a page with a textbox and other control, how can I resume the text in TextBox?
You can use UIElement.CacheMode property and Frame.CacheSize property to cache the content of the page. You can refer to my another case UWP page state manage.
Or if you're using some templates for example template 10 to develop your app, you can use its own cache method, you can refer to Docs | Navigation Cache.
I've just started developing for Windows Store App and I have an app which requires a login screen. This login is just to select user records and should not be related to any social network.
My first approach was create a XAML page and load that page when the app starts, in the App.xaml.cs
Then I saw some people using Popups to ask for login, handling the code in the Main.xaml code behind.
What would be the best approach?
Thanks.
I think both options are possible. Based on your comments I would suggest build a Login usercontrol that you can use at multiple places. Because you have to login everytime the user starts the app, I would build a loginpage where the app default navigates to from the app.xaml.cs
In case where the app is resumed and you determine that the user has to login again to continue using the app, I would use an overlay over the page where the user already was and load the usercontrol. When the user is logged in again, you can just hide the overlay and the user can continue where he left.
Pro: No logic for remembering where the user came from.
Con: Overlay should be added on every page.
Microsoft give some Guidelines for login. You can get it here.
Guidelines are not an obligation. It is just classic and valid way to do something. Maybe a pop up is an accepted idea, for now maybe you should follow the "basic" way.
I'm using a
system.windows.forms.webbrowser
to login into facebook. When the next user logs in I want the login form to be totally blank and not have the name of the previous user in there. How can I do that?
The WebBrowser control stores Web pages from recently visited sites in a cache on the local hard disk.
When the control navigates to a page, it saves time by displaying a cached version, if one is available, rather than downloading the page again.
Use the Refresh method to force the WebBrowser control to reload the current page by downloading it, ensuring that the control displays the latest version.
You could use JavaScript to do this (Not pretty but it does it in 1-2 lines of code).
The markup below is not correct, it is an example.
WebBrowrower1.Navigate("javascript: void Document(somegetelementbyID/Tagname('').value = '')");
In my Silverlight app how can I determine if the Back button is pressed and to not logout, as it is currently doing. I may have a problem as the app is primarily a grid with drill down but at least if it could return to the start page, would be great.
I think the only way to trap that is with javascript. And the only thing you can do that way is to get an OK Cancel standard messagebox.
Or what you can do if you want to manage different pages with silvelight; create a Silverlight Navigation application (with the appropritate template).
I have a silverlight navigation application, and I thought it would be no problem to add a page that's not part of the "navigation" app. What I would like to do is move the user from the application to a new "fullscreen" page where there's only a text covering the page saying, thanks for using....... click here to login again, and that will take the user back to my already implemented login page.
The question is how can I implement a page that's not part of the user, then I guess all I need to do is navigationservice.navigate(..)
Thanks
I believe that if you add the new page as a "Silverlight User Control" instead of a "Silverlight Page" from the Visual Studio Silverlight templates you will get the results you are looking for.