mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-11-04 01:00:23 +00:00 
			
		
		
		
	Fusion
This commit is contained in:
		
						commit
						d41c216128
					
				
					 7 changed files with 164 additions and 150 deletions
				
			
		| 
						 | 
					@ -1,11 +1,11 @@
 | 
				
			||||||
#pragma warning disable 1591
 | 
					#pragma warning disable 1591
 | 
				
			||||||
//------------------------------------------------------------------------------
 | 
					//------------------------------------------------------------------------------
 | 
				
			||||||
// <auto-generated>
 | 
					// <auto-generated>
 | 
				
			||||||
//     Ce code a été généré par un outil.
 | 
					//     This code was generated by a tool.
 | 
				
			||||||
//     Version du runtime :4.0.30319.42000
 | 
					//     Runtime Version:4.0.30319.42000
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
 | 
					//     Changes to this file may cause incorrect behavior and will be lost if
 | 
				
			||||||
//     le code est régénéré.
 | 
					//     the code is regenerated.
 | 
				
			||||||
// </auto-generated>
 | 
					// </auto-generated>
 | 
				
			||||||
//------------------------------------------------------------------------------
 | 
					//------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,6 @@ namespace AideDeJeu.Droid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public string GetDatabasePath(string databaseName)
 | 
					        public string GetDatabasePath(string databaseName)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
			SQLitePCL.Batteries_V2.Init();
 | 
					 | 
				
			||||||
            var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", databaseName);
 | 
					            var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", databaseName);
 | 
				
			||||||
            return databasePath;
 | 
					            return databasePath;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,12 @@
 | 
				
			||||||
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
 | 
					  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
 | 
				
			||||||
    <DebugType>pdbonly</DebugType>
 | 
					    <DebugType>pdbonly</DebugType>
 | 
				
			||||||
    <DebugSymbols>true</DebugSymbols>
 | 
					    <DebugSymbols>true</DebugSymbols>
 | 
				
			||||||
 | 
					    <LangVersion>Latest</LangVersion>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
 | 
				
			||||||
 | 
					    <LangVersion>Latest</LangVersion>
 | 
				
			||||||
 | 
					  </PropertyGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <EmbeddedResource Remove="Resources\AdJTheme.xaml" />
 | 
					    <EmbeddedResource Remove="Resources\AdJTheme.xaml" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,13 +8,15 @@ using System.Diagnostics;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					using System.Text;
 | 
				
			||||||
using System.Windows.Input;
 | 
					using System.Windows.Input;
 | 
				
			||||||
 | 
					using System.Threading;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace AideDeJeu.ViewModels
 | 
					namespace AideDeJeu.ViewModels
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public abstract class FilterViewModel : BaseViewModel
 | 
					    public abstract class FilterViewModel : BaseViewModel
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public ICommand LoadItemsCommand { get; protected set; }
 | 
					        public ICommand LoadItemsCommand { get; protected set; }
 | 
				
			||||||
        public abstract IEnumerable<Item> FilterItems(IEnumerable<Item> items);
 | 
					        public abstract Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken token = default);
 | 
				
			||||||
        public abstract IEnumerable<Filter> Filters { get; }
 | 
					        public abstract IEnumerable<Filter> Filters { get; }
 | 
				
			||||||
        private string _SearchText = "";
 | 
					        private string _SearchText = "";
 | 
				
			||||||
        public string SearchText
 | 
					        public string SearchText
 | 
				
			||||||
| 
						 | 
					@ -111,7 +113,9 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override IEnumerable<Item> FilterItems(IEnumerable<Item> items)
 | 
					        public override async Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken token = default)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return await Task.Run(() =>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var classe = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Class).SelectedKey ?? "";
 | 
					                var classe = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Class).SelectedKey ?? "";
 | 
				
			||||||
                var niveauMin = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinLevel).SelectedKey ?? "0";
 | 
					                var niveauMin = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinLevel).SelectedKey ?? "0";
 | 
				
			||||||
| 
						 | 
					@ -119,9 +123,8 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
                var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? "";
 | 
					                var ecole = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? "";
 | 
				
			||||||
                var rituel = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? "";
 | 
					                var rituel = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? "";
 | 
				
			||||||
                var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? "";
 | 
					                var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? "";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
            return items
 | 
					                return items.Where(item =>
 | 
				
			||||||
                    .Where(item =>
 | 
					 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    var spell = item as Spell;
 | 
					                    var spell = item as Spell;
 | 
				
			||||||
                    return (int.Parse(spell.Level) >= int.Parse(niveauMin)) &&
 | 
					                    return (int.Parse(spell.Level) >= int.Parse(niveauMin)) &&
 | 
				
			||||||
| 
						 | 
					@ -130,10 +133,11 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
                        spell.Source.Contains(source) &&
 | 
					                        spell.Source.Contains(source) &&
 | 
				
			||||||
                        spell.Source.Contains(classe) &&
 | 
					                        spell.Source.Contains(classe) &&
 | 
				
			||||||
                        spell.Type.Contains(rituel) &&
 | 
					                        spell.Type.Contains(rituel) &&
 | 
				
			||||||
                            Helpers.RemoveDiacritics(spell.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText).ToLower());
 | 
					                        spell.NamePHB.ToLower().Contains(SearchText.ToLower());
 | 
				
			||||||
                    })
 | 
					                }).OrderBy(spell => spell.NamePHB)
 | 
				
			||||||
                    .OrderBy(spell => spell.NamePHB)
 | 
					                            .AsEnumerable();
 | 
				
			||||||
                    .ToList();
 | 
					            }, token);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public abstract List<KeyValuePair<string, string>> Classes { get; }
 | 
					        public abstract List<KeyValuePair<string, string>> Classes { get; }
 | 
				
			||||||
| 
						 | 
					@ -343,17 +347,28 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override IEnumerable<Item> FilterItems(IEnumerable<Item> items)
 | 
					        public override async Task<IEnumerable<Item>> FilterItems(IEnumerable<Item> items, CancellationToken token = default)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return await Task.Run(() =>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var powerComparer = new PowerComparer();
 | 
					                var powerComparer = new PowerComparer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //var category = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Category).SelectedKey ?? "";
 | 
					                //var category = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Category).SelectedKey ?? "";
 | 
				
			||||||
                var type = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Type).SelectedKey ?? "";
 | 
					                var type = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Type).SelectedKey ?? "";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var minPower = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinPower).SelectedKey ?? "0 (0 PX)";
 | 
					                var minPower = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MinPower).SelectedKey ?? "0 (0 PX)";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var maxPower = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxPower).SelectedKey ?? "30 (155000 PX)";
 | 
					                var maxPower = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxPower).SelectedKey ?? "30 (155000 PX)";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var size = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Size).SelectedKey ?? "";
 | 
					                var size = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Size).SelectedKey ?? "";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
                //var legendary = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Legendary).SelectedKey ?? "";
 | 
					                //var legendary = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Legendary).SelectedKey ?? "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? "";
 | 
					                var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? "";
 | 
				
			||||||
 | 
					                token.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return items.Where(item =>
 | 
					                return items.Where(item =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -366,7 +381,9 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
                        Helpers.RemoveDiacritics(monster.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText).ToLower());
 | 
					                        Helpers.RemoveDiacritics(monster.NamePHB).ToLower().Contains(Helpers.RemoveDiacritics(SearchText).ToLower());
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                    .OrderBy(monster => monster.NamePHB)
 | 
					                    .OrderBy(monster => monster.NamePHB)
 | 
				
			||||||
                .ToList();
 | 
					                            .AsEnumerable();
 | 
				
			||||||
 | 
					            }, token);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public abstract List<KeyValuePair<string, string>> Categories { get; }
 | 
					        public abstract List<KeyValuePair<string, string>> Categories { get; }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,15 +8,18 @@ using System.Diagnostics;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using System.Windows.Input;
 | 
					using System.Windows.Input;
 | 
				
			||||||
using Xamarin.Forms;
 | 
					using Xamarin.Forms;
 | 
				
			||||||
 | 
					using System.Threading;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace AideDeJeu.ViewModels
 | 
					namespace AideDeJeu.ViewModels
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public abstract class ItemsViewModel : BaseViewModel
 | 
					    public abstract class ItemsViewModel : BaseViewModel
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        CancellationTokenSource cancellationTokenSource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public ItemsViewModel(ItemSourceType itemSourceType)
 | 
					        public ItemsViewModel(ItemSourceType itemSourceType)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            this.ItemSourceType = itemSourceType;
 | 
					            this.ItemSourceType = itemSourceType;
 | 
				
			||||||
            LoadItemsCommand = new Command(() => ExecuteLoadItemsCommand());
 | 
					            LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public ICommand LoadItemsCommand { get; protected set; }
 | 
					        public ICommand LoadItemsCommand { get; protected set; }
 | 
				
			||||||
        //public abstract void ExecuteLoadItemsCommand();
 | 
					        //public abstract void ExecuteLoadItemsCommand();
 | 
				
			||||||
| 
						 | 
					@ -66,26 +69,28 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void ExecuteLoadItemsCommand()
 | 
					        async Task LoadItemsAsync(CancellationToken token = default)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (IsBusy)
 | 
					 | 
				
			||||||
                return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            IsBusy = true;
 | 
					            IsBusy = true;
 | 
				
			||||||
 | 
					            Main.IsLoading = true;
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Main.Items.Clear();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                var filterViewModel = Main.GetFilterViewModel(ItemSourceType);
 | 
					                var filterViewModel = Main.GetFilterViewModel(ItemSourceType);
 | 
				
			||||||
                var items = filterViewModel.FilterItems(AllItems);
 | 
					                var items = await filterViewModel.FilterItems(AllItems, token);
 | 
				
			||||||
 | 
					                await Task.Run(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Main.Items.Clear();
 | 
				
			||||||
                    foreach (var item in items)
 | 
					                    foreach (var item in items)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
 | 
					                        token.ThrowIfCancellationRequested();
 | 
				
			||||||
                        Main.Items.Add(item);
 | 
					                        Main.Items.Add(item);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //On arrete le loading ici car on annule toujours avant de lancer une nouvelle opération
 | 
				
			||||||
 | 
					                Main.IsLoading = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (OperationCanceledException ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Debug.WriteLine(ex);
 | 
					                Debug.WriteLine(ex);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -95,6 +100,14 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public async Task ExecuteLoadItemsCommandAsync()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (cancellationTokenSource != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                cancellationTokenSource.Cancel();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            cancellationTokenSource = new CancellationTokenSource();
 | 
				
			||||||
 | 
					            await LoadItemsAsync(cancellationTokenSource.Token);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,6 +52,13 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private bool _isLoading;
 | 
				
			||||||
 | 
					        public bool IsLoading
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => _isLoading;
 | 
				
			||||||
 | 
					            set => SetProperty(ref _isLoading, value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Dictionary<ItemSourceType, Lazy<ItemsViewModel>> AllItemsViewModel = new Dictionary<ItemSourceType, Lazy<ItemsViewModel>>()
 | 
					        public Dictionary<ItemSourceType, Lazy<ItemsViewModel>> AllItemsViewModel = new Dictionary<ItemSourceType, Lazy<ItemsViewModel>>()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            { ItemSourceType.SpellVF, new Lazy<ItemsViewModel>(() => new SpellsViewModel(ItemSourceType.SpellVF)) },
 | 
					            { ItemSourceType.SpellVF, new Lazy<ItemsViewModel>(() => new SpellsViewModel(ItemSourceType.SpellVF)) },
 | 
				
			||||||
| 
						 | 
					@ -116,9 +123,9 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public MainViewModel()
 | 
					        public MainViewModel()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            LoadItemsCommand = new Command(() =>
 | 
					            LoadItemsCommand = new Command(async () =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    GetItemsViewModel(ItemSourceType).ExecuteLoadItemsCommand();
 | 
					                    await GetItemsViewModel(ItemSourceType).ExecuteLoadItemsCommandAsync();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            GotoItemCommand = new Command<Item>(async (item) => await GetItemsViewModel(ItemSourceType).ExecuteGotoItemCommandAsync(item));
 | 
					            GotoItemCommand = new Command<Item>(async (item) => await GetItemsViewModel(ItemSourceType).ExecuteGotoItemCommandAsync(item));
 | 
				
			||||||
            SwitchToSpells = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.Monster) | ItemSourceType.Spell);
 | 
					            SwitchToSpells = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.Monster) | ItemSourceType.Spell);
 | 
				
			||||||
| 
						 | 
					@ -127,10 +134,10 @@ namespace AideDeJeu.ViewModels
 | 
				
			||||||
            SwitchToVO = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.VF & ~ItemSourceType.HD) | ItemSourceType.VO);
 | 
					            SwitchToVO = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.VF & ~ItemSourceType.HD) | ItemSourceType.VO);
 | 
				
			||||||
            SwitchToHD = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.VF & ~ItemSourceType.VO) | ItemSourceType.HD);
 | 
					            SwitchToHD = new Command(() => ItemSourceType = (ItemSourceType & ~ItemSourceType.VF & ~ItemSourceType.VO) | ItemSourceType.HD);
 | 
				
			||||||
            AboutCommand = new Command(async () => await Main.Navigator.GotoAboutPageAsync());
 | 
					            AboutCommand = new Command(async () => await Main.Navigator.GotoAboutPageAsync());
 | 
				
			||||||
            SearchCommand = new Command<string>((text) =>
 | 
					            SearchCommand = new Command<string>(async (text) =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    GetFilterViewModel(ItemSourceType).SearchText = text;
 | 
					                    GetFilterViewModel(ItemSourceType).SearchText = text;
 | 
				
			||||||
                    GetItemsViewModel(ItemSourceType).ExecuteLoadItemsCommand();
 | 
					                    await GetItemsViewModel(ItemSourceType).ExecuteLoadItemsCommandAsync();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,31 +1,15 @@
 | 
				
			||||||
<?xml version="1.0" encoding="utf-8" ?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
 | 
					<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:AideDeJeu.Views" xmlns:tools="clr-namespace:AideDeJeu.Tools" x:Class="AideDeJeu.Views.MainPage" x:Name="This" IsPresented="False" Title="">
 | 
				
			||||||
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
 | 
					 | 
				
			||||||
                xmlns:local="clr-namespace:AideDeJeu.Views"
 | 
					 | 
				
			||||||
                xmlns:tools="clr-namespace:AideDeJeu.Tools"
 | 
					 | 
				
			||||||
                x:Class="AideDeJeu.Views.MainPage"
 | 
					 | 
				
			||||||
                x:Name="This"
 | 
					 | 
				
			||||||
                IsPresented="False"
 | 
					 | 
				
			||||||
                Title="">
 | 
					 | 
				
			||||||
    <MasterDetailPage.Resources>
 | 
					    <MasterDetailPage.Resources>
 | 
				
			||||||
        <ResourceDictionary>
 | 
					        <ResourceDictionary>
 | 
				
			||||||
            <tools:ItemSourceTypeToStringConverter 
 | 
					            <tools:ItemSourceTypeToStringConverter x:Key="ItemSourceTypeToTitleConverter" SpellVF="Sorts" SpellVO="Spells" SpellHD="Sorts (H&D)" MonsterVF="Monstres" MonsterVO="Monsters" MonsterHD="Créatures (H&D)" />
 | 
				
			||||||
                x:Key="ItemSourceTypeToTitleConverter" 
 | 
					            <tools:ItemSourceTypeToItemsConverter x:Key="ItemSourceTypeToItemsConverter" />
 | 
				
			||||||
                SpellVF="Sorts" 
 | 
					            <tools:ItemSourceTypeToFilterConverter x:Key="ItemSourceTypeToFilterConverter" />
 | 
				
			||||||
                SpellVO="Spells" 
 | 
					 | 
				
			||||||
                SpellHD="Sorts (H&D)" 
 | 
					 | 
				
			||||||
                MonsterVF="Monstres" 
 | 
					 | 
				
			||||||
                MonsterVO="Monsters" 
 | 
					 | 
				
			||||||
                MonsterHD="Créatures (H&D)" 
 | 
					 | 
				
			||||||
                />
 | 
					 | 
				
			||||||
            <tools:ItemSourceTypeToItemsConverter 
 | 
					 | 
				
			||||||
                x:Key="ItemSourceTypeToItemsConverter" />
 | 
					 | 
				
			||||||
            <tools:ItemSourceTypeToFilterConverter 
 | 
					 | 
				
			||||||
                x:Key="ItemSourceTypeToFilterConverter" />
 | 
					 | 
				
			||||||
        </ResourceDictionary>
 | 
					        </ResourceDictionary>
 | 
				
			||||||
    </MasterDetailPage.Resources>
 | 
					    </MasterDetailPage.Resources>
 | 
				
			||||||
    <MasterDetailPage.Master>
 | 
					    <MasterDetailPage.Master>
 | 
				
			||||||
        <ContentPage Title=" ">
 | 
					        <ContentPage Title=" ">
 | 
				
			||||||
 | 
					            <AbsoluteLayout>
 | 
				
			||||||
                <ListView ItemsSource="{Binding ItemSourceType, Converter={StaticResource ItemSourceTypeToFilterConverter}}" HasUnevenRows="True" RowHeight="-1" SeparatorVisibility="None" IsPullToRefreshEnabled="False">
 | 
					                <ListView ItemsSource="{Binding ItemSourceType, Converter={StaticResource ItemSourceTypeToFilterConverter}}" HasUnevenRows="True" RowHeight="-1" SeparatorVisibility="None" IsPullToRefreshEnabled="False">
 | 
				
			||||||
                    <ListView.ItemTemplate>
 | 
					                    <ListView.ItemTemplate>
 | 
				
			||||||
                        <DataTemplate>
 | 
					                        <DataTemplate>
 | 
				
			||||||
| 
						 | 
					@ -40,6 +24,7 @@
 | 
				
			||||||
                        </DataTemplate>
 | 
					                        </DataTemplate>
 | 
				
			||||||
                    </ListView.ItemTemplate>
 | 
					                    </ListView.ItemTemplate>
 | 
				
			||||||
                </ListView>
 | 
					                </ListView>
 | 
				
			||||||
 | 
					            </AbsoluteLayout>
 | 
				
			||||||
        </ContentPage>
 | 
					        </ContentPage>
 | 
				
			||||||
    </MasterDetailPage.Master>
 | 
					    </MasterDetailPage.Master>
 | 
				
			||||||
    <MasterDetailPage.Detail>
 | 
					    <MasterDetailPage.Detail>
 | 
				
			||||||
| 
						 | 
					@ -54,38 +39,27 @@
 | 
				
			||||||
                        <ToolbarItem Name="VO" Text="VO AideDD/SRD" Order="Secondary" Command="{Binding SwitchToVO}" />
 | 
					                        <ToolbarItem Name="VO" Text="VO AideDD/SRD" Order="Secondary" Command="{Binding SwitchToVO}" />
 | 
				
			||||||
                        <ToolbarItem Name="HD" Text="VF H&D" Order="Secondary" Command="{Binding SwitchToHD}" />
 | 
					                        <ToolbarItem Name="HD" Text="VF H&D" Order="Secondary" Command="{Binding SwitchToHD}" />
 | 
				
			||||||
                    </ContentPage.ToolbarItems>
 | 
					                    </ContentPage.ToolbarItems>
 | 
				
			||||||
 | 
					                    <AbsoluteLayout>
 | 
				
			||||||
                        <StackLayout Orientation="Vertical">
 | 
					                        <StackLayout Orientation="Vertical">
 | 
				
			||||||
                            <SearchBar x:Name="SearchBar" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference SearchBar}}">
 | 
					                            <SearchBar x:Name="SearchBar" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference SearchBar}}">
 | 
				
			||||||
                                <SearchBar.Behaviors>
 | 
					                                <SearchBar.Behaviors>
 | 
				
			||||||
                                    <tools:TextChangedBehavior />
 | 
					                                    <tools:TextChangedBehavior />
 | 
				
			||||||
                                </SearchBar.Behaviors>
 | 
					                                </SearchBar.Behaviors>
 | 
				
			||||||
                            </SearchBar>
 | 
					                            </SearchBar>
 | 
				
			||||||
 | 
					                            <ListView x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" IsRefreshing="{Binding IsBusy, Mode=OneWay}" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
 | 
				
			||||||
                        <ListView 
 | 
					 | 
				
			||||||
                            x:Name="ItemsListView" 
 | 
					 | 
				
			||||||
                            ItemsSource="{Binding Items}" 
 | 
					 | 
				
			||||||
                            VerticalOptions="FillAndExpand"
 | 
					 | 
				
			||||||
                            HasUnevenRows="true"
 | 
					 | 
				
			||||||
                            IsRefreshing="{Binding IsBusy, Mode=OneWay}"
 | 
					 | 
				
			||||||
                            CachingStrategy="RecycleElement"
 | 
					 | 
				
			||||||
                            SelectedItem="{Binding SelectedItem}"
 | 
					 | 
				
			||||||
                            ItemTapped="ItemsListView_ItemTapped">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                <ListView.ItemTemplate>
 | 
					                                <ListView.ItemTemplate>
 | 
				
			||||||
                                    <DataTemplate>
 | 
					                                    <DataTemplate>
 | 
				
			||||||
                                        <ViewCell>
 | 
					                                        <ViewCell>
 | 
				
			||||||
                                            <StackLayout Padding="10">
 | 
					                                            <StackLayout Padding="10">
 | 
				
			||||||
                                            <Label 
 | 
					                                                <Label Text="{Binding NamePHB}" LineBreakMode="NoWrap" Style="{DynamicResource subsubsection}" FontSize="16" />
 | 
				
			||||||
                                                Text="{Binding NamePHB}" 
 | 
					 | 
				
			||||||
                                                LineBreakMode="NoWrap" 
 | 
					 | 
				
			||||||
                                                Style="{DynamicResource subsubsection}" 
 | 
					 | 
				
			||||||
                                                FontSize="16" />
 | 
					 | 
				
			||||||
                                            </StackLayout>
 | 
					                                            </StackLayout>
 | 
				
			||||||
                                        </ViewCell>
 | 
					                                        </ViewCell>
 | 
				
			||||||
                                    </DataTemplate>
 | 
					                                    </DataTemplate>
 | 
				
			||||||
                                </ListView.ItemTemplate>
 | 
					                                </ListView.ItemTemplate>
 | 
				
			||||||
                            </ListView>
 | 
					                            </ListView>
 | 
				
			||||||
                        </StackLayout>
 | 
					                        </StackLayout>
 | 
				
			||||||
 | 
					                        <ActivityIndicator AbsoluteLayout.LayoutBounds="0.5,0.5" AbsoluteLayout.LayoutFlags="XProportional, YProportional" IsRunning="{x:Binding IsLoading}" Color="Olive" />
 | 
				
			||||||
 | 
					                    </AbsoluteLayout>
 | 
				
			||||||
                </ContentPage>
 | 
					                </ContentPage>
 | 
				
			||||||
            </x:Arguments>
 | 
					            </x:Arguments>
 | 
				
			||||||
        </NavigationPage>
 | 
					        </NavigationPage>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue