Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 551567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:24:27+00:00 2026-05-13T11:24:27+00:00

I have an ALPHA application which allows you grab an obfuscated font from and

  • 0

I have an ALPHA application which allows you grab an obfuscated font from and XPS file and store the .odttf file for use in Silverlight. The application “works” as in it does what it says on the tin, albeit in a very rough sort of way.

In the process of cleaning this tool up to create the BETA I can across an issue. I want the application to be laid out in a wizard style which would gather data from the user, like which font to use, where to save the extracted file, etc.

In the current implementation this is all done in the code behind (Actually it calls a helper class). But implementing a wizard means that each piece of the data is gathered on a different “page”. I did not want to simple pass the data around using the page constructors as I am trying to implement MVVM which aims to keep the code behind clean.

I suppose what I am looking for is a data storage in code that persists windows. that way I can grab the data in my window (view), pass it to my viewmodel via binding and sent it down to the windows model(data class) to be stored somewhere.

I could use a database or XML file but that seems like overpowered storage for the few pieces of information I need.

So in summary, is there a way to have an in memory object that persists window calls and can be referenced by multiple models (classes).

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:24:28+00:00Added an answer on May 13, 2026 at 11:24 am

    Best way would be using the same ViewModel for all pages and then serializing it if you want to use it later.

    public class MyViewModel
    {
        // Properties to be serialized
        public string MyViewModelProperty1 = "";
        public string MyViewModelProperty2 = "";
    
        // Save to file.
        public virtual bool Save(string viewmodelFilePath)
        {
            try
            {
                Directory.CreateDirectory(Path.GetDirectoryName(viewmodelFilePath));
                StreamWriter write = new StreamWriter(viewmodelFilePath);
                XmlSerializer xml = new XmlSerializer(GetType());
                xml.Serialize(write, this);
                write.Close();
            }
            catch
            {
                return false;
            }
            return true;
        }
    
        // Load from file.
        public static object Load(Type type, string viewmodelFilePath)
        {
            StreamReader reader;
            object settings;
            XmlSerializer xml = new XmlSerializer(type);
    
            try
            {
                reader = new StreamReader(viewmodelFilePath);
                viewmodel = xml.Deserialize(reader);
                reader.Close();
            }
            catch
            {
                viewmodel = 
                    type.GetConstructor(System.Type.EmptyTypes).Invoke(null);
            }
            return viewmodel;
        }
    }
    

    Original code from Petzold book

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a virtual folder containing an administration application, like https://www.mysite.com/alpha which requires SSL.
I have a sprite loaded from a PNG that has an alpha channel. The
I have an image (PNG file) that has an alpha channel that is set
I have a 32-bit NSBitmapImageRep which has an alpha channel with essentially 1-bit values
I have a regular expression ^[a-zA-Z+#-.0-9]{1,5}$ which validates that the word contains alpha-numeric characters
Today I faced a strange problem. I have an application which is the same
I created an iPad application in which I would like to have my searchBar
My application have some problem on opening 32bit BMP images. some image has alpha
Let's say I have an application A which is responsible for painting stuff on-screen
I have a simple solid modeling application in which I want to implement several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.