1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00

Correctif rapide bookmarks en attendant refonte

This commit is contained in:
Yan Maniez 2019-10-28 22:08:13 +01:00
parent 1bc5b614c0
commit 1ea384afaf

View file

@ -243,14 +243,25 @@ namespace AideDeJeu.ViewModels.Library
} }
items.Add(linkItem); items.Add(linkItem);
await SaveBookmarksAsync(key, items); await SaveBookmarksAsync(key, items);
Repository.BookmarkCollectionIndex = Repository.BookmarkCollectionNames.IndexOf(key); if (Repository.BookmarkCollectionNames.IndexOf(key) >= 0)
{
Repository.BookmarkCollectionIndex = Repository.BookmarkCollectionNames.IndexOf(key);
}
else
{
Repository.BookmarkCollectionNames.Insert(Repository.BookmarkCollectionNames.Count - 1, key);
Repository.BookmarkCollectionIndex = Repository.BookmarkCollectionNames.IndexOf(key);
}
await LoadBookmarkCollectionAsync(key); await LoadBookmarkCollectionAsync(key);
} }
public async Task SaveBookmarksAsync() public async Task SaveBookmarksAsync()
{ {
App.Current.Properties[Repository.BookmarkCollectionNames[Repository.BookmarkCollectionIndex]] = ToString(Repository.BookmarkCollection); if (Repository.BookmarkCollectionIndex >= 0)
await App.Current.SavePropertiesAsync(); {
App.Current.Properties[Repository.BookmarkCollectionNames[Repository.BookmarkCollectionIndex]] = ToString(Repository.BookmarkCollection);
await App.Current.SavePropertiesAsync();
}
} }
public async Task SaveBookmarksAsync(string key, List<Item> items) public async Task SaveBookmarksAsync(string key, List<Item> items)