Example #1
0
        private void ReadCoverEventsData()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Object coverEventTitle = localSettings.Values["coverEventTitle"];
            Object coverEventDate  = localSettings.Values["coverEventDate"];

            Object coverEventsCollection = localSettings.Values["coverEventsCollection"];

            Object coverTileToggleData = localSettings.Values["coverTileToggleData"];

            if (coverEventTitle != null && coverEventDate != null)
            {
                string   eventTitle = (string)coverEventTitle;
                DateTime eventDate  = DateTime.Parse((string)coverEventDate);
                CoverEventsManager.AddCoverEvents(eventTitle, eventDate);
                localSettings.Values.Remove("coverEventTitle");
                localSettings.Values.Remove("coverEventDate");
            }
            else
            {
                if (coverEventsCollection != null)
                {
                    String dataString = (string)coverEventsCollection;
                    CoverEventsManager.CoverEventsCollection = ObjectSerializer.CoverEventsFromXml(dataString);
                }
                else
                {
                    var      resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
                    string   eventTitle     = resourceLoader.GetString("DefaultCoverTitle");
                    DateTime eventDate      = DateTimeOffset.Now.Date;
                    CoverEventsManager.AddCoverEvents(eventTitle, eventDate);
                    CoverEventsManager.WriteCoverEventsCollectionData();
                }
            }

            if (coverTileToggleData != null)
            {
                Tile.tileStatus = (bool)coverTileToggleData;
                if (Tile.tileStatus)
                {
                    Tile.UpdateTile();
                }
            }
        }