1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-31 07:26:09 +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,15 +243,26 @@ namespace AideDeJeu.ViewModels.Library
} }
items.Add(linkItem); items.Add(linkItem);
await SaveBookmarksAsync(key, items); await SaveBookmarksAsync(key, items);
if (Repository.BookmarkCollectionNames.IndexOf(key) >= 0)
{
Repository.BookmarkCollectionIndex = Repository.BookmarkCollectionNames.IndexOf(key); 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()
{
if (Repository.BookmarkCollectionIndex >= 0)
{ {
App.Current.Properties[Repository.BookmarkCollectionNames[Repository.BookmarkCollectionIndex]] = ToString(Repository.BookmarkCollection); App.Current.Properties[Repository.BookmarkCollectionNames[Repository.BookmarkCollectionIndex]] = ToString(Repository.BookmarkCollection);
await App.Current.SavePropertiesAsync(); await App.Current.SavePropertiesAsync();
} }
}
public async Task SaveBookmarksAsync(string key, List<Item> items) public async Task SaveBookmarksAsync(string key, List<Item> items)
{ {