c# - MvvmCross backward navigation on Windows Phone 8.1 -


i have windows phone silverlight 8.1 mvvmcross 3.5.1 based application navigates forward , backward between views flawlessly.

to navigate forward, using

mvxviewmodel.showviewmodel()

api. works well. navigate backwards, use button on phone , works well.

i making windows phone 8.1 equivalent of same application use wallet features. navigation forward works expected. however, when click on button on phone, application exits.

this entire content of app.xaml.cs windows phone 8.1 app.

 /// <summary>     /// provides application-specific behavior supplement default application class.     /// </summary>     public sealed partial class app : application     {         private transitioncollection transitions;          /// <summary>         /// initializes singleton application object.  first line of authored code         /// executed, , such logical equivalent of main() or winmain().         /// </summary>         public app()         {             this.initializecomponent();             this.suspending += this.onsuspending;         }          /// <summary>         /// invoked when application launched end user.  other entry points         /// used when application launched open specific file, display         /// search results, , forth.         /// </summary>         /// <param name="e">details launch request , process.</param>         protected override void onlaunched(launchactivatedeventargs e)         {  #if debug         if (system.diagnostics.debugger.isattached)         {             this.debugsettings.enableframeratecounter = true;         } #endif          frame rootframe = window.current.content frame;          // not repeat app initialization when window has content,         // ensure window active         if (rootframe == null)         {             // create frame act navigation context , navigate first page             rootframe = new frame();              // todo: change value cache size appropriate application             rootframe.cachesize = 1;              if (e.previousexecutionstate == applicationexecutionstate.terminated)             {                 // todo: load state suspended application             }              // place frame in current window             window.current.content = rootframe;         }          if (rootframe.content == null)         {             // when navigation stack isn't restored navigate first page,             // configuring new page passing required information navigation             // parameter              var setup = new setup(rootframe);             setup.initialize();                //// removes turnstile navigation startup.             //if (rootframe.contenttransitions != null)             //{             //    this.transitions = new transitioncollection();             //    foreach (var c in rootframe.contenttransitions)             //    {             //        this.transitions.add(c);             //    }             //}              //rootframe.contenttransitions = null;             //rootframe.navigated += this.rootframe_firstnavigated;              //// when navigation stack isn't restored navigate first page,             //// configuring new page passing required information navigation             //// parameter             //if (!rootframe.navigate(typeof(mainpage), e.arguments))             //{             //    throw new exception("failed create initial page");             //}              var starter = cirrious.crosscore.mvx.resolve<cirrious.mvvmcross.viewmodels.imvxappstart>();             starter.start();         }          // ensure current window active         window.current.activate();     }      /// <summary>     /// restores content transitions after app has launched.     /// </summary>     /// <param name="sender">the object handler attached.</param>     /// <param name="e">details navigation event.</param>     private void rootframe_firstnavigated(object sender, navigationeventargs e)     {         var rootframe = sender frame;         rootframe.contenttransitions = this.transitions ?? new transitioncollection() { new navigationthemetransition() };         rootframe.navigated -= this.rootframe_firstnavigated;     }      /// <summary>     /// invoked when application execution being suspended.  application state saved     /// without knowing whether application terminated or resumed contents     /// of memory still intact.     /// </summary>     /// <param name="sender">the source of suspend request.</param>     /// <param name="e">details suspend request.</param>     private void onsuspending(object sender, suspendingeventargs e)     {         var deferral = e.suspendingoperation.getdeferral();          // todo: save application state , stop background activity         deferral.complete();     } } 

what missing?

windows phone 8.1 stuff navigation prevent working correctly.

these issue's contain lot of information on topic: https://github.com/mvvmcross/mvvmcross/pull/760 https://github.com/mvvmcross/mvvmcross/issues/1018 https://gist.github.com/cheesebaron/3d33daf4b76dc091e26e

the code use base class is:

public abstract class baseview<t> : mvxwindowspage<t> t : mvxviewmodel {     private icommand _gobackcommand;      public icommand gobackcommand     {         { return _gobackcommand ?? (_gobackcommand = new mvxcommand(goback, cangoback)); }         set { _gobackcommand = value; }     }      protected baseview()     {         navigationcachemode = navigationcachemode.required;         loaded += (s, e) => {             hardwarebuttons.backpressed += hardwarebuttonsbackpressed;         };          unloaded += (s, e) => {             hardwarebuttons.backpressed -= hardwarebuttonsbackpressed;         };     }      private void hardwarebuttonsbackpressed(object sender, backpressedeventargs e)     {         if (gobackcommand.canexecute(null))         {             e.handled = true;             gobackcommand.execute(null);         }     }      public virtual void goback()     {         if (frame != null && frame.cangoback) frame.goback();     }      public virtual bool cangoback()     {         return frame != null && frame.cangoback;     }      protected override void onnavigatedto(navigationeventargs e)     {         if (e.navigationmode == navigationmode.new)             viewmodel = null;          base.onnavigatedto(e);     } } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -