mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +00:00 
			
		
		
		
	Préparation bookmarks
This commit is contained in:
		
							parent
							
								
									53174a0e0d
								
							
						
					
					
						commit
						fba3966ae9
					
				
					 16 changed files with 393 additions and 19 deletions
				
			
		|  | @ -33,6 +33,11 @@ | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |     <Compile Update="Properties\Resource.Designer.cs"> | ||||||
|  |       <DesignTime>True</DesignTime> | ||||||
|  |       <AutoGen>True</AutoGen> | ||||||
|  |       <DependentUpon>Resource.resx</DependentUpon> | ||||||
|  |     </Compile> | ||||||
|     <Compile Update="Views\AboutPage.xaml.cs"> |     <Compile Update="Views\AboutPage.xaml.cs"> | ||||||
|       <SubType>Code</SubType> |       <SubType>Code</SubType> | ||||||
|     </Compile> |     </Compile> | ||||||
|  | @ -335,6 +340,13 @@ | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |     <EmbeddedResource Update="Properties\Resource.resx"> | ||||||
|  |       <Generator>PublicResXFileCodeGenerator</Generator> | ||||||
|  |       <LastGenOutput>Resource.Designer.cs</LastGenOutput> | ||||||
|  |     </EmbeddedResource> | ||||||
|  |     <EmbeddedResource Update="Views\BookmarksPage.xaml"> | ||||||
|  |       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||||
|  |     </EmbeddedResource> | ||||||
|     <EmbeddedResource Update="Views\DeepSearchPage.xaml"> |     <EmbeddedResource Update="Views\DeepSearchPage.xaml"> | ||||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> |       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||||
|     </EmbeddedResource> |     </EmbeddedResource> | ||||||
|  |  | ||||||
							
								
								
									
										74
									
								
								AideDeJeu/AideDeJeu/Properties/Resource.Designer.cs
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								AideDeJeu/AideDeJeu/Properties/Resource.Designer.cs
									
										
									
										generated
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,74 @@ | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | // <auto-generated> | ||||||
|  | //     Ce code a été généré par un outil. | ||||||
|  | //     Version du runtime :4.0.30319.42000 | ||||||
|  | // | ||||||
|  | //     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si | ||||||
|  | //     le code est régénéré. | ||||||
|  | // </auto-generated> | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeu.Properties { | ||||||
|  |     using System; | ||||||
|  |      | ||||||
|  |      | ||||||
|  |     /// <summary> | ||||||
|  |     ///   Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. | ||||||
|  |     /// </summary> | ||||||
|  |     // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder | ||||||
|  |     // à l'aide d'un outil, tel que ResGen ou Visual Studio. | ||||||
|  |     // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen | ||||||
|  |     // avec l'option /str ou régénérez votre projet VS. | ||||||
|  |     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] | ||||||
|  |     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||||||
|  |     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | ||||||
|  |     public class Resource { | ||||||
|  |          | ||||||
|  |         private static global::System.Resources.ResourceManager resourceMan; | ||||||
|  |          | ||||||
|  |         private static global::System.Globalization.CultureInfo resourceCulture; | ||||||
|  |          | ||||||
|  |         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | ||||||
|  |         internal Resource() { | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         /// <summary> | ||||||
|  |         ///   Retourne l'instance ResourceManager mise en cache utilisée par cette classe. | ||||||
|  |         /// </summary> | ||||||
|  |         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||||||
|  |         public static global::System.Resources.ResourceManager ResourceManager { | ||||||
|  |             get { | ||||||
|  |                 if (object.ReferenceEquals(resourceMan, null)) { | ||||||
|  |                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AideDeJeu.Properties.Resource", typeof(Resource).Assembly); | ||||||
|  |                     resourceMan = temp; | ||||||
|  |                 } | ||||||
|  |                 return resourceMan; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         /// <summary> | ||||||
|  |         ///   Remplace la propriété CurrentUICulture du thread actuel pour toutes | ||||||
|  |         ///   les recherches de ressources à l'aide de cette classe de ressource fortement typée. | ||||||
|  |         /// </summary> | ||||||
|  |         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||||||
|  |         public static global::System.Globalization.CultureInfo Culture { | ||||||
|  |             get { | ||||||
|  |                 return resourceCulture; | ||||||
|  |             } | ||||||
|  |             set { | ||||||
|  |                 resourceCulture = value; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         /// <summary> | ||||||
|  |         ///   Recherche une chaîne localisée semblable à Lancez une recherche pour voir ici vos résultats ! | ||||||
|  |         ///     | ||||||
|  |         ///(Notez que la première recherche peut être assez longue). | ||||||
|  |         /// </summary> | ||||||
|  |         public static string EmptySearchAltText { | ||||||
|  |             get { | ||||||
|  |                 return ResourceManager.GetString("EmptySearchAltText", resourceCulture); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										125
									
								
								AideDeJeu/AideDeJeu/Properties/Resource.resx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								AideDeJeu/AideDeJeu/Properties/Resource.resx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,125 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <root> | ||||||
|  |   <!--  | ||||||
|  |     Microsoft ResX Schema  | ||||||
|  |      | ||||||
|  |     Version 2.0 | ||||||
|  |      | ||||||
|  |     The primary goals of this format is to allow a simple XML format  | ||||||
|  |     that is mostly human readable. The generation and parsing of the  | ||||||
|  |     various data types are done through the TypeConverter classes  | ||||||
|  |     associated with the data types. | ||||||
|  |      | ||||||
|  |     Example: | ||||||
|  |      | ||||||
|  |     ... ado.net/XML headers & schema ... | ||||||
|  |     <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||||
|  |     <resheader name="version">2.0</resheader> | ||||||
|  |     <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||||
|  |     <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||||
|  |     <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||||
|  |     <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||||
|  |     <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||||
|  |         <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||||
|  |     </data> | ||||||
|  |     <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||||
|  |         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||||
|  |         <comment>This is a comment</comment> | ||||||
|  |     </data> | ||||||
|  |                  | ||||||
|  |     There are any number of "resheader" rows that contain simple  | ||||||
|  |     name/value pairs. | ||||||
|  |      | ||||||
|  |     Each data row contains a name, and value. The row also contains a  | ||||||
|  |     type or mimetype. Type corresponds to a .NET class that support  | ||||||
|  |     text/value conversion through the TypeConverter architecture.  | ||||||
|  |     Classes that don't support this are serialized and stored with the  | ||||||
|  |     mimetype set. | ||||||
|  |      | ||||||
|  |     The mimetype is used for serialized objects, and tells the  | ||||||
|  |     ResXResourceReader how to depersist the object. This is currently not  | ||||||
|  |     extensible. For a given mimetype the value must be set accordingly: | ||||||
|  |      | ||||||
|  |     Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||||
|  |     that the ResXResourceWriter will generate, however the reader can  | ||||||
|  |     read any of the formats listed below. | ||||||
|  |      | ||||||
|  |     mimetype: application/x-microsoft.net.object.binary.base64 | ||||||
|  |     value   : The object must be serialized with  | ||||||
|  |             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||||
|  |             : and then encoded with base64 encoding. | ||||||
|  |      | ||||||
|  |     mimetype: application/x-microsoft.net.object.soap.base64 | ||||||
|  |     value   : The object must be serialized with  | ||||||
|  |             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||||
|  |             : and then encoded with base64 encoding. | ||||||
|  | 
 | ||||||
|  |     mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||||
|  |     value   : The object must be serialized into a byte array  | ||||||
|  |             : using a System.ComponentModel.TypeConverter | ||||||
|  |             : and then encoded with base64 encoding. | ||||||
|  |     --> | ||||||
|  |   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||||||
|  |     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||||
|  |     <xsd:element name="root" msdata:IsDataSet="true"> | ||||||
|  |       <xsd:complexType> | ||||||
|  |         <xsd:choice maxOccurs="unbounded"> | ||||||
|  |           <xsd:element name="metadata"> | ||||||
|  |             <xsd:complexType> | ||||||
|  |               <xsd:sequence> | ||||||
|  |                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||||
|  |               </xsd:sequence> | ||||||
|  |               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||||
|  |               <xsd:attribute name="type" type="xsd:string" /> | ||||||
|  |               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||||
|  |               <xsd:attribute ref="xml:space" /> | ||||||
|  |             </xsd:complexType> | ||||||
|  |           </xsd:element> | ||||||
|  |           <xsd:element name="assembly"> | ||||||
|  |             <xsd:complexType> | ||||||
|  |               <xsd:attribute name="alias" type="xsd:string" /> | ||||||
|  |               <xsd:attribute name="name" type="xsd:string" /> | ||||||
|  |             </xsd:complexType> | ||||||
|  |           </xsd:element> | ||||||
|  |           <xsd:element name="data"> | ||||||
|  |             <xsd:complexType> | ||||||
|  |               <xsd:sequence> | ||||||
|  |                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||||
|  |                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||||
|  |               </xsd:sequence> | ||||||
|  |               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||||
|  |               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||||
|  |               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||||
|  |               <xsd:attribute ref="xml:space" /> | ||||||
|  |             </xsd:complexType> | ||||||
|  |           </xsd:element> | ||||||
|  |           <xsd:element name="resheader"> | ||||||
|  |             <xsd:complexType> | ||||||
|  |               <xsd:sequence> | ||||||
|  |                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||||
|  |               </xsd:sequence> | ||||||
|  |               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||||
|  |             </xsd:complexType> | ||||||
|  |           </xsd:element> | ||||||
|  |         </xsd:choice> | ||||||
|  |       </xsd:complexType> | ||||||
|  |     </xsd:element> | ||||||
|  |   </xsd:schema> | ||||||
|  |   <resheader name="resmimetype"> | ||||||
|  |     <value>text/microsoft-resx</value> | ||||||
|  |   </resheader> | ||||||
|  |   <resheader name="version"> | ||||||
|  |     <value>2.0</value> | ||||||
|  |   </resheader> | ||||||
|  |   <resheader name="reader"> | ||||||
|  |     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||||
|  |   </resheader> | ||||||
|  |   <resheader name="writer"> | ||||||
|  |     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||||
|  |   </resheader> | ||||||
|  |   <data name="EmptySearchAltText" xml:space="preserve"> | ||||||
|  |     <value>Lancez une recherche pour voir ici vos résultats ! | ||||||
|  |      | ||||||
|  | (Notez que la première recherche peut être assez longue)</value> | ||||||
|  |   </data> | ||||||
|  | </root> | ||||||
|  | @ -1,10 +1,12 @@ | ||||||
| using AideDeJeu.ViewModels; | using AideDeJeu.ViewModels; | ||||||
| using System; | using System; | ||||||
|  | using System.Collections; | ||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Globalization; | using System.Globalization; | ||||||
| using System.Text; | using System.Text; | ||||||
| using System.Xml; | using System.Xml; | ||||||
| using Xamarin.Forms; | using Xamarin.Forms; | ||||||
|  | using System.Linq; | ||||||
| 
 | 
 | ||||||
| namespace AideDeJeu.Tools | namespace AideDeJeu.Tools | ||||||
| { | { | ||||||
|  | @ -34,6 +36,32 @@ namespace AideDeJeu.Tools | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public class IntToValueConverter<T> : IValueConverter | ||||||
|  |     { | ||||||
|  |         public T NullOrZeroValue { get; set; } | ||||||
|  |         public T NonZeroValue { get; set; } | ||||||
|  | 
 | ||||||
|  |         public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||||||
|  |         { | ||||||
|  |             if(value != null) | ||||||
|  |             { | ||||||
|  |                 int? ivalue = value as int?; | ||||||
|  |                 if(ivalue.HasValue && ivalue > 0) | ||||||
|  |                 { | ||||||
|  |                     return NonZeroValue; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return NullOrZeroValue; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||||||
|  |         { | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public class IntToBooleanConverter : IntToValueConverter<bool> { } | ||||||
|  | 
 | ||||||
|     public class HeaderLevelToStyleConverter : IValueConverter |     public class HeaderLevelToStyleConverter : IValueConverter | ||||||
|     { |     { | ||||||
|         public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |         public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||||||
|  |  | ||||||
							
								
								
									
										21
									
								
								AideDeJeu/AideDeJeu/ViewModels/BookmarksViewModel.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								AideDeJeu/AideDeJeu/ViewModels/BookmarksViewModel.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | using AideDeJeuLib; | ||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Text; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeu.ViewModels | ||||||
|  | { | ||||||
|  |     public class BookmarksViewModel : BaseViewModel | ||||||
|  |     { | ||||||
|  |         public List<KeyValuePair<string, IEnumerable<Item>>> BookmarksKeyValues { get; set; } = new List<KeyValuePair<string, IEnumerable<Item>>>() | ||||||
|  |         { | ||||||
|  |             new KeyValuePair<string, IEnumerable<Item>>("Général", new List<Item>()), | ||||||
|  |             new KeyValuePair<string, IEnumerable<Item>>("Grimoire", new List<Item>()), | ||||||
|  |             new KeyValuePair<string, IEnumerable<Item>>("Bestiaire", new List<Item>()), | ||||||
|  |             new KeyValuePair<string, IEnumerable<Item>>("Sac", new List<Item>()), | ||||||
|  |         }; | ||||||
|  |         public int BookmarksIndex { get; set; } = 0; | ||||||
|  |         public IEnumerable<Item> Bookmarks { get; set; } | ||||||
|  |         public int BookmarksCount { get; set; } = 0; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -19,12 +19,12 @@ namespace AideDeJeu.ViewModels | ||||||
|             set => SetProperty(ref _isLoading, value); |             set => SetProperty(ref _isLoading, value); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         void AddAnchor(Dictionary<string, Item> anchors, Item item) |         void AddAnchor(string source, Dictionary<string, Item> anchors, Item item) | ||||||
|         { |         { | ||||||
|             if (item != null && item.Name != null) |             if (item != null && item.Name != null) | ||||||
|             { |             { | ||||||
|                 var basename = Helpers.IdFromName(item.Name); |                 var basename = Helpers.IdFromName(item.Name); | ||||||
|                 var name = basename; |                 var name = $"{source}.md#{basename}"; | ||||||
|                 int index = 0; |                 int index = 0; | ||||||
|                 while (true) |                 while (true) | ||||||
|                 { |                 { | ||||||
|  | @ -35,18 +35,18 @@ namespace AideDeJeu.ViewModels | ||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|                     index++; |                     index++; | ||||||
|                     name = $"{basename}{index}"; |                     name = $"{source}.md#{basename}{index}"; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         void MakeAnchors(Dictionary<string, Item> anchors, Item baseItem) |         void MakeAnchors(string source, Dictionary<string, Item> anchors, Item baseItem) | ||||||
|         { |         { | ||||||
|             AddAnchor(anchors, baseItem); |             AddAnchor(source, anchors, baseItem); | ||||||
|             if(baseItem is Items) |             if(baseItem is Items) | ||||||
|             { |             { | ||||||
|                 foreach(var item in (baseItem as Items)) |                 foreach(var item in (baseItem as Items)) | ||||||
|                 { |                 { | ||||||
|                     MakeAnchors(anchors, item); |                     MakeAnchors(source, anchors, item); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | @ -77,7 +77,7 @@ namespace AideDeJeu.ViewModels | ||||||
|                             if (item != null) |                             if (item != null) | ||||||
|                             { |                             { | ||||||
|                                 var anchors = new Dictionary<string, Item>(); |                                 var anchors = new Dictionary<string, Item>(); | ||||||
|                                 MakeAnchors(anchors, item); |                                 MakeAnchors(source, anchors, item); | ||||||
|                                 _AllItems[source] = new ItemWithAnchors() { Item = item, Anchors = anchors }; |                                 _AllItems[source] = new ItemWithAnchors() { Item = item, Anchors = anchors }; | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  | @ -139,7 +139,7 @@ namespace AideDeJeu.ViewModels | ||||||
|                     if (item != null) |                     if (item != null) | ||||||
|                     { |                     { | ||||||
|                         var anchors = new Dictionary<string, Item>(); |                         var anchors = new Dictionary<string, Item>(); | ||||||
|                         MakeAnchors(anchors, item); |                         MakeAnchors(source, anchors, item); | ||||||
|                         _AllItems[source] = new ItemWithAnchors() { Item = item, Anchors = anchors }; |                         _AllItems[source] = new ItemWithAnchors() { Item = item, Anchors = anchors }; | ||||||
|                     } |                     } | ||||||
|                     else |                     else | ||||||
|  |  | ||||||
|  | @ -51,6 +51,35 @@ namespace AideDeJeu.ViewModels | ||||||
|             await Navigation.PushAsync(new Views.DeepSearchPage()); |             await Navigation.PushAsync(new Views.DeepSearchPage()); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         private Command _AddToFavoritesCommand = null; | ||||||
|  |         public Command AddToFavoritesCommand | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return _AddToFavoritesCommand ?? (_AddToFavoritesCommand = new Command(async () => await ExecuteAddToFavoritesCommandAsync())); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public async Task ExecuteAddToFavoritesCommandAsync() | ||||||
|  |         { | ||||||
|  |             var tabbedPage = App.Current.MainPage as MainTabbedPage; | ||||||
|  |             var navigationPage = tabbedPage.MainNavigationPage; | ||||||
|  |             var lastPage = navigationPage.Navigation.NavigationStack.LastOrDefault(); | ||||||
|  |             var context = lastPage.BindingContext; | ||||||
|  |             Item item = null; | ||||||
|  |             if(context is ItemDetailViewModel) | ||||||
|  |             { | ||||||
|  |                 item = (context as ItemDetailViewModel).Item; | ||||||
|  |             } | ||||||
|  |             else if(context is ItemsViewModel) | ||||||
|  |             { | ||||||
|  |                 item = (context as ItemsViewModel).Items; | ||||||
|  |             } | ||||||
|  |             await Application.Current.MainPage.DisplayAlert("Id", item.Id, "OK"); | ||||||
|  |             var vm = new BookmarksViewModel(); | ||||||
|  |             await Application.Current.MainPage.DisplayActionSheet("Ajouter à", "Annuler", "Nouvelle liste", vm.BookmarksKeyValues.Select(kv => kv.Key).ToArray()); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         public async Task GotoItemDetailPageAsync(Item item) |         public async Task GotoItemDetailPageAsync(Item item) | ||||||
|         { |         { | ||||||
|             if (item == null) |             if (item == null) | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ | ||||||
|         </StackLayout> |         </StackLayout> | ||||||
|         <StackLayout Grid.Column="1" Grid.Row="0" BackgroundColor="{StaticResource titlered}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill"> |         <StackLayout Grid.Column="1" Grid.Row="0" BackgroundColor="{StaticResource titlered}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill"> | ||||||
|             <StackLayout BackgroundColor="{StaticResource titlered}" Padding="20,20,20,20" Orientation="Vertical" HorizontalOptions="Center" VerticalOptions="Center"> |             <StackLayout BackgroundColor="{StaticResource titlered}" Padding="20,20,20,20" Orientation="Vertical" HorizontalOptions="Center" VerticalOptions="Center"> | ||||||
|                 <Label Text="Haches & Dés " FontSize="32" FontAttributes="Bold" TextColor="{StaticResource bgtan}" HorizontalOptions="Center"/> |                 <Label Text="Haches & Dés " Style="{StaticResource heading1}" FontSize="32" FontAttributes="Bold" TextColor="{StaticResource bgtan}" HorizontalOptions="Center"/> | ||||||
|                 <Label Text="{Binding Version, StringFormat='Version {0}'}" TextColor="{StaticResource bgtan}" HorizontalOptions="Center"/> |                 <Label Text="{Binding Version, StringFormat='Version {0}'}" TextColor="{StaticResource bgtan}" HorizontalOptions="Center"/> | ||||||
|             </StackLayout> |             </StackLayout> | ||||||
|         </StackLayout> |         </StackLayout> | ||||||
|  |  | ||||||
							
								
								
									
										51
									
								
								AideDeJeu/AideDeJeu/Views/BookmarksPage.xaml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								AideDeJeu/AideDeJeu/Views/BookmarksPage.xaml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8" ?> | ||||||
|  | <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||||
|  |              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||||
|  |              xmlns:tools="clr-namespace:AideDeJeu.Tools" | ||||||
|  |              x:Class="AideDeJeu.Views.BookmarksPage" | ||||||
|  |              x:Name="This"> | ||||||
|  |     <ContentPage.Resources> | ||||||
|  |         <ResourceDictionary> | ||||||
|  |             <tools:IntToBooleanConverter x:Key="IntToBooleanConverter" NonZeroValue="False" NullOrZeroValue="True" /> | ||||||
|  |         </ResourceDictionary> | ||||||
|  |     </ContentPage.Resources> | ||||||
|  |     <ContentPage.Content> | ||||||
|  |         <Grid BackgroundColor="{StaticResource bgtan}"> | ||||||
|  |             <Grid.RowDefinitions> | ||||||
|  |                 <RowDefinition Height="Auto" /> | ||||||
|  |                 <RowDefinition Height="*" /> | ||||||
|  |             </Grid.RowDefinitions> | ||||||
|  |              | ||||||
|  |             <Picker Style="{StaticResource heading1}" HorizontalOptions="FillAndExpand" ItemsSource="{Binding BookmarksKeyValues, Mode=OneWay}" ItemDisplayBinding="{Binding Key, Mode=OneWay}" SelectedIndex="{Binding BookmarksIndex, Mode=TwoWay}" /> | ||||||
|  | 
 | ||||||
|  |             <Label Grid.Column="0" Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="15,0,15,0" Style="{StaticResource subsubsection}" Text="Cette liste est vide, ajoutez des éléments à partir de la bibliothèque !" IsVisible="{Binding Bookmarks.Count, Converter={StaticResource IntToBooleanConverter}}" /> | ||||||
|  | 
 | ||||||
|  |             <ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Bookmarks}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}"> | ||||||
|  |                 <ListView.ItemTemplate> | ||||||
|  |                     <DataTemplate> | ||||||
|  |                         <ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop"> | ||||||
|  |                             <StackLayout Padding="10" Orientation="Vertical"> | ||||||
|  |                                 <Label Text="{Binding Name}" LineBreakMode="WordWrap" Style="{DynamicResource subsubsection}" FontSize="16" /> | ||||||
|  |                                 <Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" Style="{DynamicResource subsubsection}" FontSize="12" /> | ||||||
|  |                             </StackLayout> | ||||||
|  |                         </ViewCell> | ||||||
|  |                     </DataTemplate> | ||||||
|  |                 </ListView.ItemTemplate> | ||||||
|  |             </ListView> | ||||||
|  |             <ActivityIndicator  | ||||||
|  |                     Grid.Column="0" Grid.Row="0"  | ||||||
|  |                     VerticalOptions="StartAndExpand" | ||||||
|  |                     HorizontalOptions="End" | ||||||
|  |                     Color="{StaticResource titlered}" | ||||||
|  |                     IsRunning="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"  | ||||||
|  |                     IsVisible="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"> | ||||||
|  |                 <ActivityIndicator.WidthRequest> | ||||||
|  |                     <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="400" Android="50" /> | ||||||
|  |                 </ActivityIndicator.WidthRequest> | ||||||
|  |                 <ActivityIndicator.HeightRequest> | ||||||
|  |                     <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="10" Android="50" /> | ||||||
|  |                 </ActivityIndicator.HeightRequest> | ||||||
|  |             </ActivityIndicator> | ||||||
|  |         </Grid> | ||||||
|  |     </ContentPage.Content> | ||||||
|  | </ContentPage> | ||||||
							
								
								
									
										23
									
								
								AideDeJeu/AideDeJeu/Views/BookmarksPage.xaml.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								AideDeJeu/AideDeJeu/Views/BookmarksPage.xaml.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | ||||||
|  | using AideDeJeu.ViewModels; | ||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Text; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  | 
 | ||||||
|  | using Xamarin.Forms; | ||||||
|  | using Xamarin.Forms.Xaml; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeu.Views | ||||||
|  | { | ||||||
|  | 	[XamlCompilation(XamlCompilationOptions.Compile)] | ||||||
|  | 	public partial class BookmarksPage : ContentPage | ||||||
|  | 	{ | ||||||
|  | 		public BookmarksPage () | ||||||
|  | 		{ | ||||||
|  | 			InitializeComponent (); | ||||||
|  | 
 | ||||||
|  |             BindingContext = new BookmarksViewModel(); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | @ -4,10 +4,16 @@ | ||||||
|     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||||
|     x:Class="AideDeJeu.Views.DeepSearchPage" |     x:Class="AideDeJeu.Views.DeepSearchPage" | ||||||
|     xmlns:tools="clr-namespace:AideDeJeu.Tools"  |     xmlns:tools="clr-namespace:AideDeJeu.Tools"  | ||||||
|  |     xmlns:properties="clr-namespace:AideDeJeu.Properties" | ||||||
|     x:Name="This"  |     x:Name="This"  | ||||||
|     BackgroundColor="{StaticResource bgtan}"  |     BackgroundColor="{StaticResource bgtan}"  | ||||||
|     Title="Recherche" |     Title="Recherche" | ||||||
|     Icon="crystal_ball.png"> |     Icon="crystal_ball.png"> | ||||||
|  |     <ContentPage.Resources> | ||||||
|  |         <ResourceDictionary> | ||||||
|  |             <tools:IntToBooleanConverter x:Key="IntToBooleanConverter" NonZeroValue="False" NullOrZeroValue="True" /> | ||||||
|  |         </ResourceDictionary> | ||||||
|  |     </ContentPage.Resources> | ||||||
|     <ContentPage.ToolbarItems> |     <ContentPage.ToolbarItems> | ||||||
|         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> | ||||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> |         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> | ||||||
|  | @ -18,11 +24,16 @@ | ||||||
|                 <RowDefinition Height="Auto" /> |                 <RowDefinition Height="Auto" /> | ||||||
|                 <RowDefinition Height="*" /> |                 <RowDefinition Height="*" /> | ||||||
|             </Grid.RowDefinitions> |             </Grid.RowDefinitions> | ||||||
|             <SearchBar Grid.Column="0" Grid.Row="0" x:Name="SearchBar" HeightRequest="42" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference SearchBar}}"> |             <SearchBar Style="{StaticResource subsubsection}"  Grid.Column="0" Grid.Row="0" x:Name="SearchBar" HeightRequest="42" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference SearchBar}}"> | ||||||
|                 <!--<SearchBar.Behaviors> |                 <!--<SearchBar.Behaviors> | ||||||
|                     <tools:TextChangedBehavior /> |                     <tools:TextChangedBehavior /> | ||||||
|                 </SearchBar.Behaviors>--> |                 </SearchBar.Behaviors>--> | ||||||
|             </SearchBar> |             </SearchBar> | ||||||
|  | 
 | ||||||
|  |             <!--<Label Grid.Column="0" Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="15,0,15,0" Style="{StaticResource subsubsection}" Text="Lancez une recherche pour voir ici vos résultats !\n\n(Notez que la première recherche peut être assez longue)" IsVisible="{Binding Bookmarks.Count, Converter={StaticResource IntToBooleanConverter}}" />--> | ||||||
|  | 
 | ||||||
|  |             <Label Grid.Column="0" Grid.Row="1" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="15,0,15,0" Style="{StaticResource subsubsection}" Text="{x:Static properties:Resource.EmptySearchAltText}" IsVisible="{Binding Bookmarks.Count, Converter={StaticResource IntToBooleanConverter}}" /> | ||||||
|  | 
 | ||||||
|             <ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped"> |             <ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped"> | ||||||
|                 <ListView.ItemTemplate> |                 <ListView.ItemTemplate> | ||||||
|                     <DataTemplate> |                     <DataTemplate> | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
|     x:Name="This"  |     x:Name="This"  | ||||||
|     Title="{Binding Title}"> |     Title="{Binding Title}"> | ||||||
|     <MasterDetailPage.ToolbarItems> |     <MasterDetailPage.ToolbarItems> | ||||||
|         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.AddToFavoritesCommand}" /> | ||||||
|         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> | ||||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> |         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> | ||||||
|     </MasterDetailPage.ToolbarItems> |     </MasterDetailPage.ToolbarItems> | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ | ||||||
|         </ResourceDictionary> |         </ResourceDictionary> | ||||||
|     </ContentPage.Resources> |     </ContentPage.Resources> | ||||||
|     <ContentPage.ToolbarItems> |     <ContentPage.ToolbarItems> | ||||||
|         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.AddToFavoritesCommand}" /> | ||||||
|         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> | ||||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> |         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> | ||||||
|     </ContentPage.ToolbarItems> |     </ContentPage.ToolbarItems> | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ namespace AideDeJeu.Views | ||||||
|         { |         { | ||||||
|             InitializeComponent(); |             InitializeComponent(); | ||||||
| 
 | 
 | ||||||
|             BindingContext = this.viewModel = new ItemDetailViewModel(new HomeItem()) { Title = "Haches & Dés" }; |             BindingContext = this.viewModel = new ItemDetailViewModel(new HomeItem()) { Title = "Bibliothèque" }; | ||||||
|             //var item = new Item |             //var item = new Item | ||||||
|             //{ |             //{ | ||||||
|             //    Name = "", |             //    Name = "", | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|         </ResourceDictionary> |         </ResourceDictionary> | ||||||
|     </ContentPage.Resources> |     </ContentPage.Resources> | ||||||
|     <ContentPage.ToolbarItems> |     <ContentPage.ToolbarItems> | ||||||
|         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <ToolbarItem Name="AddToFavorites" Text="Ajouter aux favoris" Order="Primary" Icon="round_star" Command="{Binding Main.Navigator.AddToFavoritesCommand}" /> | ||||||
|         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> |         <!--<ToolbarItem Name="DeepSearch" Text="Rechercher..." Order="Primary" Icon="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" /> | ||||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> |         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />--> | ||||||
|     </ContentPage.ToolbarItems> |     </ContentPage.ToolbarItems> | ||||||
|  |  | ||||||
|  | @ -7,17 +7,17 @@ | ||||||
|   <!--Pages can be added as references or inline--> |   <!--Pages can be added as references or inline--> | ||||||
|     <views:MainNavigationPage x:Name="NavigationPage" Icon="spell_book"> |     <views:MainNavigationPage x:Name="NavigationPage" Icon="spell_book"> | ||||||
|         <views:MainNavigationPage.Title> |         <views:MainNavigationPage.Title> | ||||||
|             <OnPlatform x:TypeArguments="x:String" Android="" Default="Grimoire" WinPhone="Grimoire"/> |             <OnPlatform x:TypeArguments="x:String" Android="" Default="Bibliothèque" WinPhone="Bibliothèque"/> | ||||||
|         </views:MainNavigationPage.Title> |         </views:MainNavigationPage.Title> | ||||||
|         <x:Arguments> |         <x:Arguments> | ||||||
|             <views:ItemDetailPage /> |             <views:ItemDetailPage /> | ||||||
|         </x:Arguments> |         </x:Arguments> | ||||||
|     </views:MainNavigationPage> |     </views:MainNavigationPage> | ||||||
|     <ContentPage Icon="stars_stack"> |     <views:BookmarksPage Icon="stars_stack"> | ||||||
|         <ContentPage.Title> |         <views:BookmarksPage.Title> | ||||||
|             <OnPlatform x:TypeArguments="x:String" Android="" Default="Favoris" WinPhone="Favoris"/> |             <OnPlatform x:TypeArguments="x:String" Android="" Default="Favoris" WinPhone="Favoris"/> | ||||||
|         </ContentPage.Title> |         </views:BookmarksPage.Title> | ||||||
|     </ContentPage> |     </views:BookmarksPage> | ||||||
|     <views:DeepSearchPage Icon="crystal_ball"> |     <views:DeepSearchPage Icon="crystal_ball"> | ||||||
|         <views:DeepSearchPage.Title> |         <views:DeepSearchPage.Title> | ||||||
|             <OnPlatform x:TypeArguments="x:String" Android="" Default="Recherche" WinPhone="Recherche" /> |             <OnPlatform x:TypeArguments="x:String" Android="" Default="Recherche" WinPhone="Recherche" /> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez