internal static UserDataContext Load(IStorageModel storage) { UserDataContext result = null; try { result = storage.LoadFromStorageAsync<UserDataContext>(ConnectionString).Result; } catch (Exception ex) { var settings = SettingsModelFactory.GetSettingsModel(); settings.AddOrUpdate("currentUser", string.Empty); settings.SaveSettings(); result = new UserDataContext(); } result.UserFavorites.CollectionChanged += UserFavorites_CollectionChanged; return result; }
public static async Task<PinnedForumsProfile> LoadAsync(IStorageModel storage, string username) { PinnedForumsProfile profile = null; try { profile = await storage.LoadFromStorageAsync<PinnedForumsProfile>( string.Format("{0}_pins.dat", username)); } catch (Exception ex) { Debug.WriteLine(ex.Message); profile = new PinnedForumsProfile() { Username = username }; } return profile; }