mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Bookmarks
This commit is contained in:
		
							parent
							
								
									144861c12d
								
							
						
					
					
						commit
						39e1d6866f
					
				
					 1 changed files with 36 additions and 3 deletions
				
			
		|  | @ -73,6 +73,18 @@ namespace AideDeJeu.ViewModels | |||
|             else if(BookmarkCollectionIndex == BookmarkCollectionNames.Count - 1) | ||||
|             { | ||||
|                 var result = await Main.Navigator.OpenCancellableTextInputAlertDialog(""); | ||||
|                 if(result.Item2 == Navigator.PopupResultEnum.Save) | ||||
|                 { | ||||
|                     var index = BookmarkCollectionNames.Count - 1; | ||||
|                     BookmarkCollectionNames.Insert(index, result.Item1); | ||||
|                     //BookmarkCollectionIndex = index; | ||||
|                     BookmarkCollectionIndex = 0; | ||||
|                     await SaveBookmarksAsync(); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     BookmarkCollectionIndex = 0; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -161,8 +173,22 @@ namespace AideDeJeu.ViewModels | |||
|             if (result.Item2 == Navigator.PopupResultEnum.Delete) | ||||
|             { | ||||
|                 var confirm = await App.Current.MainPage.DisplayAlert("Supprimer ?", "Etes vous sûr de vouloir supprimer la liste ?", "Supprimer", "Annuler"); | ||||
|                 if (confirm) | ||||
|                 { | ||||
|                     var index = BookmarkCollectionIndex; | ||||
|                     var name = BookmarkCollectionNames[BookmarkCollectionIndex]; | ||||
|                     await SaveBookmarksAsync(name, null); | ||||
|                     BookmarkCollectionNames.Remove(name); | ||||
|                     BookmarkCollectionIndex = 0; | ||||
|                 } | ||||
|             } | ||||
|             else if (result.Item2 == Navigator.PopupResultEnum.Save) | ||||
|             { | ||||
|                 var items = await GetBookmarkCollection(BookmarkCollectionNames[BookmarkCollectionIndex]); | ||||
|                 await SaveBookmarksAsync(BookmarkCollectionNames[BookmarkCollectionIndex], null); | ||||
|                 BookmarkCollectionNames[BookmarkCollectionIndex] = result.Item1; | ||||
|                 await SaveBookmarksAsync(BookmarkCollectionNames[BookmarkCollectionIndex], items); | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -212,8 +238,15 @@ namespace AideDeJeu.ViewModels | |||
|         } | ||||
| 
 | ||||
|         public async Task SaveBookmarksAsync(string key, List<Item> items) | ||||
|         { | ||||
|             if (items == null) | ||||
|             { | ||||
|                 App.Current.Properties.Remove(key); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 App.Current.Properties[key] = ToString(items); | ||||
|             } | ||||
|             await App.Current.SavePropertiesAsync(); | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez