public interface ISupportNavigationViewState
{
void RestoreState(ParametersCollection state);
ParametersCollection SaveState(); }
var _state = ((ISupportNavigationViewState)this.shell).SaveState();
var _memStream = new MemoryStream();
var _serializer = new XmlSerializer(typeof(ParametersCollection), new Type[] { typeof(Parameter), typeof(PageContentState),
typeof(PageContentState[]), typeof(Object[]), typeof(Object[][]), typeof(Person) }); // note the custom type - Person
_serializer.Serialize(_memStream, _state);
PresistState(Encoding.UTF8.GetString(_memStream.GetBuffer(), 0, Convert.ToInt32(_memStream.Length)));
public partial class Shell : UserControl, ISupportNavigationViewState
{
public void RestoreState(nRoute.Components.ParametersCollection state)
{
var _leftState = state.GetValueOrDefault("LEFT", default(ParametersCollection));
var _rightState = state.GetValueOrDefault("RIGHT", default(ParametersCollection));
if (_leftState != null) ((ISupportNavigationViewState)leftContainer).RestoreState(_leftState);
if (_rightState != null) ((ISupportNavigationViewState)rightContainer).RestoreState(_rightState);
}
public nRoute.Components.ParametersCollection SaveState()
{
return new ParametersCollection()
{
new Parameter("LEFT", ((ISupportNavigationViewState)leftContainer).SaveState()),
new Parameter("RIGHT", ((ISupportNavigationViewState)rightContainer).SaveState()),
};
}
}
Hi Gerhard,
Read this: http://wildermuth.com/2010/10/17/Architecting_WP7_-_Part_5_of_10_Tombstoning
Tombstoning is a windows phone 7 concept whereby an application is closed by the OS under certain conditions, but gets a chance to save its state so it can be resumed from the same “screen” later. I guess a similar term for “tombstoned” would be “suspended”…
Cheers,
Adi
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
-----Ursprüngliche Nachricht-----
Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von
Rishi Oberoi
Gesendet: Donnerstag, 10. Februar 2011 14:11
An: nRoute
Betreff: [nRoute] Re: NEW FEATURE: Application Tombstoning and Cascading
State Management
Hi Gerhard, I'm not looking into designer issues yet - will do so,
I just have a button on the left side and a StatefulNavigationContainer on
the right side.
After putting all together and overriding OnInitialize and ... putting
Debug.Print-statements inside just to have some list, how my app is working,
I found, that every click on the same button fires all that stuff, which may
include complex de/rehydrating, maybe nested, also if there is no change of
the content of the StatefulNavigationContainer, because the correct view is
there, and some silly user (called Gerhard) just clicking the button for no
reason (like a monkey).
With best regards
Gerhard
-----Ursprüngliche Nachricht-----
Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von
Rishi Oberoi
Gesendet: Donnerstag, 10. Februar 2011 14:14
An: nRoute
Betreff: [nRoute] Re: REQUEST: Little performance enhancement of containers
-----Ursprüngliche Nachricht-----
Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von
Rishi Oberoi
Gesendet: Donnerstag, 10. Februar 2011 14:17
An: nRoute
Betreff: [nRoute] Re: ISupportNavigationViewState
Here you see, whats happen, if some silly user (like me) start clicking the
same button over and over. Behind the scenes, the whole (maybe complex)
de/rehydration is triggered, but just for nothing.
With best regards
Gerhard
-----Ursprüngliche Nachricht-----
Von: nro...@googlegroups.com [mailto:nro...@googlegroups.com] Im Auftrag von
Rishi Oberoi
Gesendet: Donnerstag, 10. Februar 2011 14:14
An: nRoute
Betreff: [nRoute] Re: REQUEST: Little performance enhancement of containers
I don't think that's true as none of navigation containers re-use an
Hey,
I’m not sure I understand how tombstoning fits into all of this and how ISupportNavigationViewState is supposed to be used.
Specifically, I have the following questions:
1. Is nRoute now aware of tombstoning events? Do we have to use the ApplicationFrameContainer for this to work?
2. If 1 is true J, I don’t understand how view-models get to persist/restore their state for tombstoning. Does nRoute now call ISupportNavigationState methods also when tombstoning/rehydrating? Or do we have to somehow involve the views into the process and they have to implement ISupportNavigationViewState?
Or maybe a small example would help?...
Thnx,
Adi
Freundliche Grüsse / Best regards
Adrian Hara
Cloud Developer
LinkedIn
coresystems ag
Villa im Park | Dorfstrasse 69
5210 Windisch | Switzerland
Phone +41 56 500 22 22
Fax +41 56 444 20 50
Infoline +41 848 088 088
www.coresystems.ch
www.coresuite.com
follow us on twitter
Visit us at CeBIT:
SAP Partner Booth: Hall 5, Booth A18
Cloud Computing: Hall 4, Booth A58
OS X Business Park: Hall 2, Booth A20
Microsoft Booth: Hall 4, Booth P47
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and / or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.