using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;

namespace WPPersistData
{
    public partial class MainPage : PhoneApplicationPage
    {
        private IsolatedStorageSettings applicationSettings;
        public MainPage()
        {
            
            InitializeComponent();

            SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;

            applicationSettings = IsolatedStorageSettings.ApplicationSettings;
            lbDictionary.ItemsSource = applicationSettings;
        }

        private void btnCreateEntry_Click(object sender, RoutedEventArgs e)
        {
            string newentry = "Eintrag"+applicationSettings.Count.ToString();
            applicationSettings[newentry]=newentry;
            applicationSettings.Save();

            //Hilfscode zum aktualisieren der Darstellung
            lbDictionary.ItemsSource = null;
            lbDictionary.ItemsSource = applicationSettings;
        }
    }
}