Home > C#, Windows 8 > Storage in Windows 8

Storage in Windows 8

Oggi volevo usare lo storage di Win8 per una mia app, e mi sono chiesto se ci fosse il famoso IsolatedStorage già visto in WP… Ottima notizia: non c’è! C’è, però, una cosa migliore: Windows.Storage 🙂

Ecco un pezzo del mio codice:

        private void SetRecord(string key, string value)
        {
            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey(key))
            {
                if (Windows.Storage.ApplicationData.Current.LocalSettings.Values[key].ToString() != null)
                {
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] = value;
                }
            }
            else
            {
                Windows.Storage.ApplicationData.Current.LocalSettings.CreateContainer(key, ApplicationDataCreateDisposition.Always);

                if (Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] == null)
                {
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values[key] = value;
                }
            }
        }
Annunci
Categorie:C#, Windows 8
  1. dicembre 19, 2012 alle 10:22 pm

    Thanks for a marvelous posting! I certainly enjoyed reading it,
    you happen to be a great author.I will ensure that I bookmark your blog and will eventually come back down the road.

    I want to encourage that you continue your great posts,
    have a nice evening!

  2. giugno 6, 2013 alle 11:14 pm

    It’s a pity you don’t have a donate button! I’d certainly donate to this superb blog! I guess for now i’ll settle for bookmarking and adding your
    RSS feed to my Google account. I look forward to new updates and
    will share this site with my Facebook group. Talk soon!

  3. marzo 18, 2014 alle 1:37 pm

    Wow that was unusual. I just wrote an very long comment but
    after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say superb blog!

  4. luglio 24, 2014 alle 4:35 pm

    I read this paragraph fully regarding the resemblance of most up-to-date
    and preceding technologies, it’s remarkable article.

  1. No trackbacks yet.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: