private void LoadSessionsFromPocketConferenceModel(PocketConferenceModel conferenceModel) { ClearExistingSessions(); // patch up the sessions with slots foreach (var session in conferenceModel.Sessions.Values) { Slot slot; if (conferenceModel.Slots.TryGetValue(session.SlotId, out slot)) { session.Slot = slot; } } Sessions = conferenceModel.Sessions.Select(x => new SessionWithFavoriteFlag() { Session = x.Value, IsFavorite = false }).ToDictionary(x => x.Session.Id, x => x); foreach (var sessionWithFavoriteFlag in Sessions.Values) { sessionWithFavoriteFlag.PropertyChanged += SessionWithFavoriteFlagOnPropertyChanged; } }
private bool TryLoadSessionsFromStorage(out PocketConferenceModel conferenceModel) { conferenceModel = null; var fileStore = this.GetService <IMvxSimpleFileStoreService>(); string fileStoreContents; if (!fileStore.TryReadTextFile(Constants.SessionsFileName, out fileStoreContents)) { return(false); } try { conferenceModel = JsonConvert.DeserializeObject <PocketConferenceModel>(fileStoreContents); } catch (Exception exception) { Trace.Warn("Masking error in loading sessions from disk {0}", exception.ToLongString()); } return(true); }