I have a application built for both windows 8.1 and windows phone 8.1. There is a non static class with static members in a portable class library which is being shared by both tablet and phone projects. In phone, on tombstoning the static properties are lost. How do i store the static class members of a portable class library in deactivated event and restore(to the current instance of the non-static class inside the portable class library) in the activated event of the phone life cycle so that the after tombstoning the application continues to run without any crash.
Restoring static properties of a class inside a portable class library, after tombstoning in windows phone 8.1
93 Views Asked by theEternalStudent At
1
There are 1 best solutions below
Related Questions in WINDOWS-PHONE-8.1
- Windows Phone StackPanel control alternative for Xamarin Forms?
- XamlParseException when using the XAML Designer
- Issues while publishing a Windows phone app in the Windows Store
- PublicClientApplication cctor doesn't work on windows phone 8.1 (System.NullReferenceException)
- How to extract String path from ApplicationData.Current.LocalFolder
- Get app purchase date for Windows Phone 8.1 and Windows 8.1 applications
- How to create thumbnail/snapshot from bing maps in c# for universal solution
- When I touch webview content and then somewhere outside after the app crashes
- Unable to load DLL 'sqlite3': in windows phone app.
- How to give dynamic width to gridview items (text block)?
- URI Scheme for Microsoft Equalizer app on Windows Phone 8.1
- Changing style based on trigger with Xamarin.Forms on WinPHone 8.1
- Why does Visual Studio create another *.appx inside a folder Dependecies
- HttpClient hangs for large request
- Windows Phone 8.1/10 App Developement
Related Questions in STATIC-MEMBERS
- How to use the correct instance with static inline member pointer and static member function?
- python class variable not updated when passed to new Process
- Static member initialization and specialization in template classes: differences between const and constexpr
- In-class vs out-of-class static member initialization: const(expr)ness and ODR
- explicit instantiation of static var in class template
- Is a static member function visible inside a templated class before it is declared?
- Is the initialization order of global variables and static inline data members relative to each other guaranteed?
- Can't use constexpr function of nested class
- Why can a "const static int" member be initialized within a class, but not a "const static other" member?
- How to make Java class to initialize another class, and execute static java code block conditionally
- Getting an error of "Reference to non-static member function must be called"
- Inner classes can have the static members inside it in java 17?
- Seeking clarity regards C++ static member initialization
- How do I initialize a static random generator data member?
- Where in C++17 document say that class static member function has external linkage?
Related Questions in PORTABLE-CLASS-LIBRARY
- "MyClassLibraryProjectName" targets 'net5.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'
- C# add reference to sqlite.dll in class library project from another project
- Use .NET 6 class library in >NET 4.7 ASP.NET Website
- Publish is producing .nuget package instead of a class library + dependencies
- How to configure swagger on a class library in .net?
- Adding additional targets to .NET portable project
- how to find systemexception in xamarin forms and the type or namespace name 'SystemException' could not be found in Xamarin.Forms (PCL)
- Exception has been thrown by a target of an invocation error in C# program and VS2017?
- Can we create shared library or assembly like .dll in flutter package project?
- Can I use HttpClient in a netstandard1.0 project?
- SQLCipher integration into Xamarin.Forms; SQLite Library doesn't support encryption exception
- Could not install package "System.Xml.XmlDocument 4.3.0", Does anyone knows the solution?
- Azure Build agent cant´t find class library referance
- HttpClient requests universally fail unless one is created and used in the Main method of the consuming program
- Using async / await in .NET Portable Library project
Related Questions in TOMBSTONING
- MVVMCross 6.4.3 Restore is not working as expected
- Cassandra Read time out on performing query in order to mass delete
- Caliburn.Micro restores ViewModel after navigating back
- How to get the object reference of backstack pages
- Restoring static properties of a class inside a portable class library, after tombstoning in windows phone 8.1
- security exception thrown while testing WP8 app Life cycle?
- PhoneApplicationService.Current.State vs IsolatedStorageSettings windows phone
- Get screen height in WP8 Silverlight app on page initialization after tombstoning
- Suspend/Resume/Tombstone simulation in Windows Phone 8.1 Emulator
- Windows Phone 8 prevent the app from ever being re-activated and restart on next launch
- Azure Mobile Service, Monogame, Windows Phone 8 and resuming a tombstoned app
- How fast WP7 would close app on deactivation via Windows button?
- NavigationContext.QueryString isn't cleared after tombstoning in WP8 Silverlight page app
- WinPhone app event to react on app process termination
- How to save a coordinate list after app is tombstoned?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It depends on the access level of those static members.
If they're public and you can access them directly from your Windows Phone application, then you can just save and restore them as you normally would with your app's state in the appropriate application lifecycle handlers (or with the
SuspensionManagerclass, if that's what you're using). This means that your portable class library doesn't care about "application lifecycle" or "saving/restoring state" or anything like that; instead it is the responsibility of your Windows Phone application to provide this behavior and your portable class library can remain independent of such Windows Phone-specific requirements.If they're non-public, then your portable class library will need to provide some way of saving and restoring its internal state. You could expose static methods to do this which you would call in the appropriate application lifecycle handlers of your Windows Phone application. For example, you might have a method in your portable class library like:
You'd call this method in the suspending handler for your app, for example:
Similarly, you would load the state in your
App.OnLaunchedoverride method whene.PreviousExecutionState == ApplicationExecutionState.Terminated. The Pivot App project template (or similar) contains skeleton code for application lifecycle events that you can work from.The fact that your class is non-static doesn't matter; you have static members in that class which are shared amongst all instances of that class. You can't restore the state of static members of just one instance of your class; that doesn't make any sense.