c# - Xamarin.form setpage not worked second time -
I create a new mobile app using the xamarin form. I have to create two page login screens and home screens. I get a sample from
but when I make the same one can not go to another page. It always keeps the login page.
In my Android main activity code
Public category Main Activity: Android Attachment, Login Manager {Secure Override Uncharted (Bundle Bundle) {base.OnCreate (bundle); Xamarin.Forms.Forms.Init (this, bundle); SetPage (App.GetLoginPage (this)); // Setpage (App.GetLoginPage (this)); } #region ILoginManager Implementation Public Zero ShowMainPage () {Set Page (App.GetHomePage (this)); } Public Zero Logout () {Set Page (App.GetLoginPage (this)); } #endregion} The setPage method is called the second time but the page content has not been replaced by any one
There is a work around the second set page problem with Android. Create a second interface and start a new activity instead of using the page set on existing activity where new activity sets the on-crayt page of the call and completes the current activity.
App.cs Public Static ILOGinManager LoginManager; Public stable IAppNavigation SplashManger; Public static page GetLoginPage (IoLOGIN Manager Account) {LoginManager = lmanager; Return new page_group (); } Public Static Page GetShowSplashPage (IAppNavigation iSplashNavigation) {SplashManzer = IceSpaceNation; Return a new page (); } {Activity (label = "", main lantern = true, configuration change = config change). Screencases | configuration changes. Orientation]] Public Class Main Activity: Android Attachivity, IAPNavigation {Safe Override Uncorrect (Bundle Bundle) {//Window.RequestFeature(WindowFeatures.NoTitle); Base.OnCreate (bundle); Xamarin.Forms.Forms.Init (this, bundle); SetPage (App.GetShowSplashPage (this)); } Public Zero GetLoginPage () {StartActivity (new intent (this, LoginActivity)); End(); } Android login activity
[activity (label = "", configuration change = configuration squans. Screensis | config changelog Orientation]] Public Class Login Activity: Android Attachti, iLogin Manager {Secure OpaRide Zero Noncrit (bundle bundle) {base.OnCreate}; Xamarin.Forms.Forms.Init (this, bundle); SetPage (App.GetLoginPage (This));} Public Zero GetMainMenu () {StartActivity (New Intent (Type, MainMenuActivity); End ();} In iOS You do not need to do anything special, just apply all the necessary interfaces that you use in App Delegate.
iOS App Delay
< Code> [Register ("Appadulate")] Public Partial Class App Dealitat: UIPA Application DeliGet, iLogin Manager, IAPNevolution {// Class-level Announcements UI Window Window; Public Override Balls Finish Launching (UIApplication App, NSDictionary Option) {Forms.Init (); Vs DOE = new UIWindow (UIScreen.MainScreen.Bounds); Window.RootViewController = App.GetShowSplashPage (this) .CreateViewController (); Window.MakeKeyAndVisible (); Back true; } Public Zero GetMainMenu () {window.RootViewController = App.GetMainMenu () CreateViewController (); Window.MakeKeyAndVisible (); } Public Zero GetLoginPage () {window.RootViewController = App.GetLoginPage (this) .CreateViewController (); Window.MakeKeyAndVisible (); }
Comments
Post a Comment