mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +00:00 
			
		
		
		
	Nettoyage / renommage
This commit is contained in:
		
							parent
							
								
									8735147d3f
								
							
						
					
					
						commit
						1c35626e45
					
				
					 14 changed files with 251 additions and 700 deletions
				
			
		|  | @ -21,24 +21,14 @@ | |||
|     <Compile Update="Views\AboutPage.xaml.cs"> | ||||
|       <SubType>Code</SubType> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\MainPage.xaml.cs"> | ||||
|       <DependentUpon>MainPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\MonstersPage.xaml.cs"> | ||||
|       <DependentUpon>MonstersPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\MonsterDetailPage.xaml.cs"> | ||||
|       <DependentUpon>MonsterDetailPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\SpellDetailPage.xaml.cs"> | ||||
|       <DependentUpon>SpellDetailPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\ItemsPage.xaml.cs"> | ||||
|       <DependentUpon>ItemsPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|     <Compile Update="Views\SpellsPage.xaml.cs"> | ||||
|       <SubType>Code</SubType> | ||||
|       <DependentUpon>SpellsPage.xaml</DependentUpon> | ||||
|     <Compile Update="Views\MainPage.xaml.cs"> | ||||
|       <DependentUpon>MainPage.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,8 +12,7 @@ namespace AideDeJeu | |||
| 		{ | ||||
| 			InitializeComponent(); | ||||
| 
 | ||||
|             //MainPage = new ItemsPage(); | ||||
|             MainPage = new NavigationPage(new ItemsPage()); | ||||
|             MainPage = new NavigationPage(new MainPage()); | ||||
|         } | ||||
| 
 | ||||
|         protected override void OnStart () | ||||
|  |  | |||
							
								
								
									
										20
									
								
								AideDeJeu/AideDeJeu/ViewModels/ItemsViewModel.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								AideDeJeu/AideDeJeu/ViewModels/ItemsViewModel.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| using AideDeJeuLib; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Input; | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public abstract class ItemsViewModel : BaseViewModel | ||||
|     { | ||||
|         public ItemsViewModel(ObservableCollection<Item> items) | ||||
|         { | ||||
|             Items = items; | ||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync()); | ||||
|         } | ||||
|         public ObservableCollection<Item> Items { get; protected set; } | ||||
|         public ICommand LoadItemsCommand { get; protected set; } | ||||
|         public abstract Task ExecuteLoadItemsCommandAsync(); | ||||
|     } | ||||
| } | ||||
|  | @ -1,14 +1,7 @@ | |||
| using System; | ||||
| using AideDeJeuLib; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| using AideDeJeuLib.Spells; | ||||
| using System.Collections.Generic; | ||||
| using AideDeJeuLib; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class MainViewModel : BaseViewModel | ||||
|  | @ -18,8 +11,8 @@ namespace AideDeJeu.ViewModels | |||
|             Spell, | ||||
|             Monster, | ||||
|         } | ||||
|         public SpellsViewModel Spells { get; set; } = new SpellsViewModel(); | ||||
|         public MonstersViewModel Monsters { get; set; } = new MonstersViewModel(); | ||||
|         public SpellsViewModel Spells { get; private set; } | ||||
|         public MonstersViewModel Monsters { get; private set; } | ||||
| 
 | ||||
|         private ItemType _ItemsType = ItemType.Spell; | ||||
|         public ItemType ItemsType | ||||
|  | @ -31,53 +24,42 @@ namespace AideDeJeu.ViewModels | |||
|             set | ||||
|             { | ||||
|                 SetProperty(ref _ItemsType, value); | ||||
|                 OnPropertyChanged(nameof(Items)); | ||||
|                 OnPropertyChanged(nameof(CurrentViewModel)); | ||||
|                 LoadItemsCommand.Execute(null); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public ObservableCollection<Item> Items | ||||
|         public ItemsViewModel CurrentViewModel | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 if (ItemsType == ItemType.Spell) | ||||
|                 { | ||||
|                     return Spells.Items; | ||||
|                     return Spells; | ||||
|                 } | ||||
|                 if (ItemsType == ItemType.Monster) | ||||
|                 { | ||||
|                     return Monsters.Items; | ||||
|                     return Monsters; | ||||
|                 } | ||||
|                 return null; | ||||
|             } | ||||
|         } | ||||
|         public ObservableCollection<Item> Items { get; private set; } = new ObservableCollection<Item>(); | ||||
| 
 | ||||
|         public Command LoadItemsCommand { get; set; } | ||||
|         public Command LoadItemsCommand { get; private set; } | ||||
| 
 | ||||
|         public Command SwitchToSpells { get; set; } | ||||
|         public Command SwitchToMonsters { get; set; } | ||||
|         public Command AboutCommand { get; set; } | ||||
|         public Command SwitchToSpells { get; private set; } | ||||
|         public Command SwitchToMonsters { get; private set; } | ||||
|         public Command AboutCommand { get; private set; } | ||||
| 
 | ||||
|         public MainViewModel(INavigation navigation) | ||||
|         { | ||||
|             //Title = "Browse"; | ||||
|             //Items = new ObservableCollection<Item>(); | ||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand()); | ||||
|             Spells = new SpellsViewModel(Items); | ||||
|             Monsters = new MonstersViewModel(Items); | ||||
|             LoadItemsCommand = new Command(async () => await CurrentViewModel.ExecuteLoadItemsCommandAsync()); | ||||
|             SwitchToSpells = new Command(() => ItemsType = ItemType.Spell); | ||||
|             SwitchToMonsters = new Command(() => ItemsType = ItemType.Monster); | ||||
|             AboutCommand = new Command(async() => await navigation.PushAsync(new Views.AboutPage())); | ||||
|         } | ||||
| 
 | ||||
|         async Task ExecuteLoadItemsCommand() | ||||
|         { | ||||
|             if(ItemsType == ItemType.Spell) | ||||
|             { | ||||
|                 await Spells.ExecuteLoadItemsCommand(); | ||||
|             } | ||||
|             else if (ItemsType == ItemType.Monster) | ||||
|             { | ||||
|                 await Monsters.ExecuteLoadItemsCommand(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,20 +1,15 @@ | |||
| using System; | ||||
| using AideDeJeuLib; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| using System.Collections.Generic; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using AideDeJeuLib; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class MonstersViewModel : BaseViewModel | ||||
|     public class MonstersViewModel : ItemsViewModel | ||||
|     { | ||||
|         public ObservableCollection<Item> Items { get; set; } | ||||
| 
 | ||||
|         public List<KeyValuePair<string, string>> Categories { get; set; } = new List<KeyValuePair<string, string>>() | ||||
|         { | ||||
|             new KeyValuePair<string, string>("", "Toutes" ), | ||||
|  | @ -186,15 +181,12 @@ namespace AideDeJeu.ViewModels | |||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         public Command LoadItemsCommand { get; set; } | ||||
| 
 | ||||
|         public MonstersViewModel() | ||||
|         public MonstersViewModel(ObservableCollection<Item> items) | ||||
|             : base(items) | ||||
|         { | ||||
|             Items = new ObservableCollection<Item>(); | ||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand()); | ||||
|         } | ||||
| 
 | ||||
|         public async Task ExecuteLoadItemsCommand() | ||||
|         public override async Task ExecuteLoadItemsCommandAsync() | ||||
|         { | ||||
|             if (IsBusy) | ||||
|                 return; | ||||
|  | @ -204,10 +196,10 @@ namespace AideDeJeu.ViewModels | |||
|             try | ||||
|             { | ||||
|                 Items.Clear(); | ||||
|                 var items = await new MonstersScrappers().GetMonsters(category: Categories[Category].Key, type: Types[Type].Key, minPower: Powers[MinPower].Key, maxPower: Powers[MaxPower].Key, size: Sizes[Size].Key, legendary:Legendaries[Legendary].Key, source: Sources[Source].Key); | ||||
|                 foreach (var item in items) | ||||
|                 var monsters = await new MonstersScrappers().GetMonsters(category: Categories[Category].Key, type: Types[Type].Key, minPower: Powers[MinPower].Key, maxPower: Powers[MaxPower].Key, size: Sizes[Size].Key, legendary:Legendaries[Legendary].Key, source: Sources[Source].Key); | ||||
|                 foreach (var monster in monsters) | ||||
|                 { | ||||
|                     Items.Add(item); | ||||
|                     Items.Add(monster); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|  |  | |||
|  | @ -1,20 +1,15 @@ | |||
| using System; | ||||
| using AideDeJeuLib; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Diagnostics; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| 
 | ||||
| using AideDeJeuLib.Spells; | ||||
| using System.Collections.Generic; | ||||
| using AideDeJeuLib; | ||||
| 
 | ||||
| namespace AideDeJeu.ViewModels | ||||
| { | ||||
|     public class SpellsViewModel : BaseViewModel | ||||
|     public class SpellsViewModel : ItemsViewModel | ||||
|     { | ||||
|         public ObservableCollection<Item> Items { get; set; } | ||||
| 
 | ||||
|         public List<KeyValuePair<string, string>> Classes { get; set; } = new List<KeyValuePair<string, string>>() | ||||
|         { | ||||
|             new KeyValuePair<string, string>("", "Toutes" ), | ||||
|  | @ -157,23 +152,12 @@ namespace AideDeJeu.ViewModels | |||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         public Command LoadItemsCommand { get; set; } | ||||
| 
 | ||||
|         public SpellsViewModel() | ||||
|         public SpellsViewModel(ObservableCollection<Item> items) | ||||
|             : base(items) | ||||
|         { | ||||
|             //Title = "Browse"; | ||||
|             Items = new ObservableCollection<Item>(); | ||||
|             LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand()); | ||||
| 
 | ||||
|             //MessagingCenter.Subscribe<NewItemPage, Spell>(this, "AddItem", async (obj, item) => | ||||
|             //{ | ||||
|             //    var _item = item as Item; | ||||
|             //    Items.Add(_item); | ||||
|             //    await DataStore.AddItemAsync(_item); | ||||
|             //}); | ||||
|         } | ||||
| 
 | ||||
|         public async Task ExecuteLoadItemsCommand() | ||||
|         public override async Task ExecuteLoadItemsCommandAsync() | ||||
|         { | ||||
|             if (IsBusy) | ||||
|                 return; | ||||
|  | @ -182,15 +166,6 @@ namespace AideDeJeu.ViewModels | |||
| 
 | ||||
|             try | ||||
|             { | ||||
|                 //<option value="b">Barde</option> | ||||
|                 //<option value="c">Clerc</option> | ||||
|                 //<option value="d">Druide</option> | ||||
|                 //<option value="s">Ensorceleur</option> | ||||
|                 //<option value="w">Magicien</option> | ||||
|                 //<option value="p">Paladin</option> | ||||
|                 //<option value="r">Rôdeur</option> | ||||
|                 //<option value="k">Sorcier</option> | ||||
| 
 | ||||
|                 Items.Clear(); | ||||
|                 var items = await SpellsScrappers.GetSpells(classe: Classes[Classe].Key, niveauMin: NiveauMin, niveauMax: NiveauMax, ecole: Ecoles[Ecole].Key, rituel: Rituels[Rituel].Key, source: Sources[Source].Key); | ||||
|                 foreach (var item in items) | ||||
|  |  | |||
|  | @ -1,170 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <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.ItemsPage" | ||||
|                   x:Name="This" | ||||
|                 IsPresented="False" | ||||
|                   Title="{Binding ItemsType,Converter={StaticResource ItemTypeToStringConverter}}" | ||||
|                 > | ||||
|     <MasterDetailPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <ControlTemplate x:Key="SpellsMasterDataTemplate"> | ||||
|                 <ScrollView Orientation="Vertical"> | ||||
|                     <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|                         <Label Text="Classe" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Classes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Classe}" /> | ||||
| 
 | ||||
|                         <Label Text="Niveau minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.NiveauMin}" /> | ||||
| 
 | ||||
|                         <Label Text="Niveau maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.NiveauMax}" /> | ||||
| 
 | ||||
|                         <Label Text="École" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Ecoles, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Ecole}" /> | ||||
| 
 | ||||
|                         <Label Text="Rituel" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Rituels, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Rituel}" /> | ||||
| 
 | ||||
|                         <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Source}" IsEnabled="False" /> | ||||
|                     </StackLayout> | ||||
|                 </ScrollView> | ||||
|             </ControlTemplate> | ||||
|             <ControlTemplate x:Key="MonstersMasterDataTemplate"> | ||||
|                 <ScrollView Orientation="Vertical"> | ||||
|                     <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|                         <Label Text="Catégorie" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Categories, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Category}" /> | ||||
| 
 | ||||
|                         <Label Text="Type" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Types, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Type}" /> | ||||
| 
 | ||||
|                         <StackLayout Orientation="Horizontal"> | ||||
|                             <StackLayout Orientation="Vertical"> | ||||
|                                 <Label Text="FP minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                                 <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.MinPower}" /> | ||||
|                             </StackLayout> | ||||
| 
 | ||||
|                             <StackLayout Orientation="Vertical"> | ||||
|                                 <Label Text="FP maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                                 <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.MaxPower}" /> | ||||
|                             </StackLayout> | ||||
|                         </StackLayout> | ||||
| 
 | ||||
|                         <Label Text="Taille" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Sizes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Size}" /> | ||||
| 
 | ||||
|                         <Label Text="Légendaire" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Legendaries, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Legendary}" /> | ||||
| 
 | ||||
|                         <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Source}" IsEnabled="False"/> | ||||
|                     </StackLayout> | ||||
|                 </ScrollView> | ||||
|             </ControlTemplate> | ||||
|             <tools:ItemTypeToStringConverter  | ||||
|                 x:Key="ItemTypeToStringConverter"  | ||||
|                 Spells="Sorts"  | ||||
|                 Monsters="Monstres" /> | ||||
|             <tools:ItemsTypeTemplateConverter  | ||||
|                 x:Key="ItemsTypeTemplateConverter"  | ||||
|                 SpellsTemplate="{StaticResource SpellsMasterDataTemplate}"  | ||||
|                 MonstersTemplate="{StaticResource MonstersMasterDataTemplate}" /> | ||||
|         </ResourceDictionary> | ||||
|     </MasterDetailPage.Resources> | ||||
|     <MasterDetailPage.Master> | ||||
|         <ContentPage Title=" "> | ||||
|             <ContentView ControlTemplate="{Binding ItemsType, Converter={StaticResource ItemsTypeTemplateConverter}}" BindingContext="{Binding}" /> | ||||
|             <!--<ContentView ControlTemplate="{StaticResource SpellsMasterDataTemplate}" BindingContext="{Binding}" />--> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Master> | ||||
|     <MasterDetailPage.Detail> | ||||
|         <ContentPage Title=""> | ||||
|             <ContentPage.ToolbarItems> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="spell_book.png" Command="{Binding SwitchToSpells}" /> | ||||
|                 <ToolbarItem Name="Monsters" Text="Monstres" Order="Primary" Icon="dragon_head.png" Command="{Binding SwitchToMonsters}" /> | ||||
|                 <ToolbarItem Name="About" Text="À propos de..." Order="Primary" Icon="wooden_sign.png" Command="{Binding AboutCommand}" /> | ||||
|                 <!--<ToolbarItem Name="Home" Text="Accueil" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" /> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" />--> | ||||
|                 <!--<ToolbarItem Name="Blog" Text="Blog" Order="Primary" Icon="ic_blog.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Blog/" /> | ||||
|                 <ToolbarItem Name="Wikis" Text="Wikis" Order="Primary" Icon="ic_wikis.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/" /> | ||||
|                 <ToolbarItem Name="Forum" Text="Forum" Order="Primary" Icon="ic_forum.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Forum/" /> | ||||
| 
 | ||||
|                 <ToolbarItem Name="Gallery2" Text="Galerie" Order="Secondary" Icon="ic_gallery.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Media/" /> | ||||
|                 <ToolbarItem Name="Plays2" Text="Parties" Order="Secondary" Icon="ic_plays.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/Parties.MainPage.ashx" /> | ||||
|                 <ToolbarItem Name="Search2" Text="Rechercher" Order="Secondary" Icon="ic_search.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/search/default.aspx" />--> | ||||
|                 <!--<ToolbarItem Text="Profil" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/yaf_cp_profile.aspx" /> | ||||
|                 <ToolbarItem Text="Messages privés" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/default.aspx?g=cp_pm" /> | ||||
|                 <ToolbarItem Text="Connexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/login.aspx" /> | ||||
|                 <ToolbarItem Text="Déconnexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/logout.aspx" /> | ||||
|                 <ToolbarItem Text="Inscription" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/register.aspx" />--> | ||||
|             </ContentPage.ToolbarItems> | ||||
|             <StackLayout Orientation="Vertical"> | ||||
|                 <SearchBar /> | ||||
| 
 | ||||
|                 <ListView x:Name="ItemsListView"  | ||||
|                 ItemsSource="{Binding Items}" | ||||
|                 VerticalOptions="FillAndExpand" | ||||
|                  HasUnevenRows="true" | ||||
|                  RefreshCommand="{Binding LoadItemsCommand}" | ||||
|                  IsPullToRefreshEnabled="true" | ||||
|                  IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                  CachingStrategy="RecycleElement" | ||||
|                  ItemSelected="OnItemSelected"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10"> | ||||
|                                     <Label Text="{Binding Name}"  | ||||
|                        LineBreakMode="NoWrap"  | ||||
|                        Style="{DynamicResource subsubsection}"  | ||||
|                        FontSize="16" /> | ||||
|                                     <!--<Label Text="{Binding Description}"  | ||||
|                        LineBreakMode="NoWrap" | ||||
|                        Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                        FontSize="13" />--> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|                 <!--<WebView x:Name="MainView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Navigating="OnNavigating" Source="{Binding Source}" />--> | ||||
|                 <!--<ActivityIndicator x:Name="aiProgress" Color="Black" IsRunning="True" IsVisible="True" />--> | ||||
|             </StackLayout> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Detail> | ||||
| </MasterDetailPage> | ||||
| 
 | ||||
| <!--<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|             xmlns:views="clr-namespace:AideDeJeu.Views" | ||||
|             x:Class="AideDeJeu.Views.MainPage"> | ||||
|     <TabbedPage.Children> | ||||
|         <NavigationPage Title="Browse"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_feed.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:ItemsPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|          | ||||
|         <NavigationPage Title="About"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_about.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:AboutPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|     </TabbedPage.Children> | ||||
| </TabbedPage>--> | ||||
|  | @ -1,64 +0,0 @@ | |||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| 
 | ||||
| namespace AideDeJeu.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class ItemsPage : MasterDetailPage //TabbedPage | ||||
|     { | ||||
|         MainViewModel viewModel; | ||||
| 
 | ||||
|         public ItemsPage () | ||||
| 		{ | ||||
| 			InitializeComponent (); | ||||
|             BindingContext = viewModel = new MainViewModel(Navigation); | ||||
|         } | ||||
| 
 | ||||
|         protected override bool OnBackButtonPressed() | ||||
|         { | ||||
|             IsPresented = !IsPresented; | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) | ||||
|         { | ||||
|             if (args.SelectedItem is Spell) | ||||
|             { | ||||
|                 var item = args.SelectedItem as Spell; | ||||
|                 if (item == null) | ||||
|                     return; | ||||
| 
 | ||||
|                 var vm = new SpellDetailViewModel(item); | ||||
|                 vm.LoadItemCommand.Execute(null); | ||||
|                 await Navigation.PushAsync(new SpellDetailPage(vm)); | ||||
|             } | ||||
|             else if (args.SelectedItem is Monster) | ||||
|             { | ||||
|                 var item = args.SelectedItem as Monster; | ||||
|                 if (item == null) | ||||
|                     return; | ||||
| 
 | ||||
|                 var vm = new MonsterDetailViewModel(item); | ||||
|                 vm.LoadItemCommand.Execute(null); | ||||
|                 await Navigation.PushAsync(new MonsterDetailPage(vm)); | ||||
|             } | ||||
| 
 | ||||
|             // Manually deselect item. | ||||
|             ItemsListView.SelectedItem = null; | ||||
|         } | ||||
| 
 | ||||
|         protected override void OnAppearing() | ||||
|         { | ||||
|             base.OnAppearing(); | ||||
| 
 | ||||
|             if (viewModel.Items.Count == 0) | ||||
|                 viewModel.LoadItemsCommand.Execute(null); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -2,22 +2,169 @@ | |||
| <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="{Binding ItemsType,Converter={StaticResource ItemTypeToStringConverter}}" | ||||
|                 > | ||||
|     <MasterDetailPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <ControlTemplate x:Key="SpellsMasterDataTemplate"> | ||||
|                 <ScrollView Orientation="Vertical"> | ||||
|                     <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|                         <Label Text="Classe" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Classes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Classe}" /> | ||||
| 
 | ||||
|                         <Label Text="Niveau minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.NiveauMin}" /> | ||||
| 
 | ||||
|                         <Label Text="Niveau maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.NiveauMax}" /> | ||||
| 
 | ||||
|                         <Label Text="École" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Ecoles, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Ecole}" /> | ||||
| 
 | ||||
|                         <Label Text="Rituel" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Rituels, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Rituel}" /> | ||||
| 
 | ||||
|                         <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Spells.Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Spells.Source}" IsEnabled="False" /> | ||||
|                     </StackLayout> | ||||
|                 </ScrollView> | ||||
|             </ControlTemplate> | ||||
|             <ControlTemplate x:Key="MonstersMasterDataTemplate"> | ||||
|                 <ScrollView Orientation="Vertical"> | ||||
|                     <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|                         <Label Text="Catégorie" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Categories, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Category}" /> | ||||
| 
 | ||||
|                         <Label Text="Type" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Types, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Type}" /> | ||||
| 
 | ||||
|                         <StackLayout Orientation="Horizontal"> | ||||
|                             <StackLayout Orientation="Vertical"> | ||||
|                                 <Label Text="FP minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                                 <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.MinPower}" /> | ||||
|                             </StackLayout> | ||||
| 
 | ||||
|                             <StackLayout Orientation="Vertical"> | ||||
|                                 <Label Text="FP maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                                 <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.MaxPower}" /> | ||||
|                             </StackLayout> | ||||
|                         </StackLayout> | ||||
| 
 | ||||
|                         <Label Text="Taille" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Sizes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Size}" /> | ||||
| 
 | ||||
|                         <Label Text="Légendaire" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Legendaries, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Legendary}" /> | ||||
| 
 | ||||
|                         <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                         <Picker HorizontalOptions="FillAndExpand" ItemsSource="{TemplateBinding Parent.BindingContext.Monsters.Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{TemplateBinding Parent.BindingContext.Monsters.Source}" IsEnabled="False"/> | ||||
|                     </StackLayout> | ||||
|                 </ScrollView> | ||||
|             </ControlTemplate> | ||||
|             <tools:ItemTypeToStringConverter  | ||||
|                 x:Key="ItemTypeToStringConverter"  | ||||
|                 Spells="Sorts"  | ||||
|                 Monsters="Monstres" /> | ||||
|             <tools:ItemsTypeTemplateConverter  | ||||
|                 x:Key="ItemsTypeTemplateConverter"  | ||||
|                 SpellsTemplate="{StaticResource SpellsMasterDataTemplate}"  | ||||
|                 MonstersTemplate="{StaticResource MonstersMasterDataTemplate}" /> | ||||
|         </ResourceDictionary> | ||||
|     </MasterDetailPage.Resources> | ||||
|     <MasterDetailPage.Master> | ||||
|         <ContentPage Title=" "> | ||||
|             <ContentView ControlTemplate="{Binding ItemsType, Converter={StaticResource ItemsTypeTemplateConverter}}" BindingContext="{Binding}" /> | ||||
|             <!--<ContentView ControlTemplate="{StaticResource SpellsMasterDataTemplate}" BindingContext="{Binding}" />--> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Master> | ||||
|     <MasterDetailPage.Detail> | ||||
|         <ContentPage Title="Aide de Jeu"> | ||||
|         <ContentPage Title=""> | ||||
|             <ContentPage.ToolbarItems> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="spell_book.png" Command="{Binding SwitchToSpells}" /> | ||||
|                 <ToolbarItem Name="Monsters" Text="Monstres" Order="Primary" Icon="dragon_head.png" Command="{Binding SwitchToMonsters}" /> | ||||
|                 <ToolbarItem Name="About" Text="À propos de..." Order="Primary" Icon="wooden_sign.png" Command="{Binding AboutCommand}" /> | ||||
|                 <!--<ToolbarItem Name="Home" Text="Accueil" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" /> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" />--> | ||||
|                 <!--<ToolbarItem Name="Blog" Text="Blog" Order="Primary" Icon="ic_blog.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Blog/" /> | ||||
|                 <ToolbarItem Name="Wikis" Text="Wikis" Order="Primary" Icon="ic_wikis.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/" /> | ||||
|                 <ToolbarItem Name="Forum" Text="Forum" Order="Primary" Icon="ic_forum.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Forum/" /> | ||||
| 
 | ||||
|                 <ToolbarItem Name="Gallery2" Text="Galerie" Order="Secondary" Icon="ic_gallery.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Media/" /> | ||||
|                 <ToolbarItem Name="Plays2" Text="Parties" Order="Secondary" Icon="ic_plays.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/Parties.MainPage.ashx" /> | ||||
|                 <ToolbarItem Name="Search2" Text="Rechercher" Order="Secondary" Icon="ic_search.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/search/default.aspx" />--> | ||||
|                 <!--<ToolbarItem Text="Profil" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/yaf_cp_profile.aspx" /> | ||||
|                 <ToolbarItem Text="Messages privés" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/default.aspx?g=cp_pm" /> | ||||
|                 <ToolbarItem Text="Connexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/login.aspx" /> | ||||
|                 <ToolbarItem Text="Déconnexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/logout.aspx" /> | ||||
|                 <ToolbarItem Text="Inscription" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/register.aspx" />--> | ||||
|             </ContentPage.ToolbarItems> | ||||
|             <StackLayout Orientation="Vertical"> | ||||
|                 <Button Text="Liste des sorts" Clicked="OnSpellsClicked" BackgroundColor="{StaticResource titlered}" TextColor="{StaticResource bgtan}" /> | ||||
|                 <Button Text="Liste des monstres" Clicked="OnMonstersClicked" BackgroundColor="{StaticResource titlered}" TextColor="{StaticResource bgtan}" /> | ||||
|                 <Button Text="À propos de ..." Clicked="OnAboutClicked" BackgroundColor="{StaticResource titlered}" TextColor="{StaticResource bgtan}" /> | ||||
|                 <SearchBar /> | ||||
| 
 | ||||
|                 <ListView x:Name="ItemsListView"  | ||||
|                 ItemsSource="{Binding Items}" | ||||
|                 VerticalOptions="FillAndExpand" | ||||
|                  HasUnevenRows="true" | ||||
|                  RefreshCommand="{Binding LoadItemsCommand}" | ||||
|                  IsPullToRefreshEnabled="true" | ||||
|                  IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                  CachingStrategy="RecycleElement" | ||||
|                  ItemSelected="OnItemSelected"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10"> | ||||
|                                     <Label Text="{Binding Name}"  | ||||
|                        LineBreakMode="NoWrap"  | ||||
|                        Style="{DynamicResource subsubsection}"  | ||||
|                        FontSize="16" /> | ||||
|                                     <!--<Label Text="{Binding Description}"  | ||||
|                        LineBreakMode="NoWrap" | ||||
|                        Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                        FontSize="13" />--> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|                 <!--<WebView x:Name="MainView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Navigating="OnNavigating" Source="{Binding Source}" />--> | ||||
|                 <!--<ActivityIndicator x:Name="aiProgress" Color="Black" IsRunning="True" IsVisible="True" />--> | ||||
|             </StackLayout> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Detail> | ||||
| </MasterDetailPage> | ||||
| 
 | ||||
| <!--<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|             xmlns:views="clr-namespace:AideDeJeu.Views" | ||||
|             x:Class="AideDeJeu.Views.MainPage"> | ||||
|     <TabbedPage.Children> | ||||
|         <NavigationPage Title="Browse"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_feed.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:ItemsPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|          | ||||
|         <NavigationPage Title="About"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_about.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:AboutPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|     </TabbedPage.Children> | ||||
| </TabbedPage>--> | ||||
|  | @ -1,4 +1,8 @@ | |||
| using System; | ||||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| 
 | ||||
|  | @ -7,24 +11,54 @@ namespace AideDeJeu.Views | |||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class MainPage : MasterDetailPage | ||||
|     { | ||||
|         MainViewModel viewModel; | ||||
| 
 | ||||
|         public MainPage () | ||||
| 		{ | ||||
| 			InitializeComponent (); | ||||
|             BindingContext = viewModel = new MainViewModel(Navigation); | ||||
|         } | ||||
| 
 | ||||
|         async void OnSpellsClicked(object sender, EventArgs e) | ||||
|         protected override bool OnBackButtonPressed() | ||||
|         { | ||||
|             await Navigation.PushAsync(new SpellsPage()); | ||||
|             IsPresented = !IsPresented; | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         async void OnMonstersClicked(object sender, EventArgs e) | ||||
| 
 | ||||
|         async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) | ||||
|         { | ||||
|             await Navigation.PushAsync(new MonstersPage()); | ||||
|             if (args.SelectedItem is Spell) | ||||
|             { | ||||
|                 var item = args.SelectedItem as Spell; | ||||
|                 if (item == null) | ||||
|                     return; | ||||
| 
 | ||||
|                 var vm = new SpellDetailViewModel(item); | ||||
|                 vm.LoadItemCommand.Execute(null); | ||||
|                 await Navigation.PushAsync(new SpellDetailPage(vm)); | ||||
|             } | ||||
|             else if (args.SelectedItem is Monster) | ||||
|             { | ||||
|                 var item = args.SelectedItem as Monster; | ||||
|                 if (item == null) | ||||
|                     return; | ||||
| 
 | ||||
|                 var vm = new MonsterDetailViewModel(item); | ||||
|                 vm.LoadItemCommand.Execute(null); | ||||
|                 await Navigation.PushAsync(new MonsterDetailPage(vm)); | ||||
|             } | ||||
| 
 | ||||
|         async void OnAboutClicked(object sender, EventArgs e) | ||||
|             // Manually deselect item. | ||||
|             ItemsListView.SelectedItem = null; | ||||
|         } | ||||
| 
 | ||||
|         protected override void OnAppearing() | ||||
|         { | ||||
|             await Navigation.PushAsync(new AboutPage()); | ||||
|             base.OnAppearing(); | ||||
| 
 | ||||
|             if (viewModel.Items.Count == 0) | ||||
|                 viewModel.LoadItemsCommand.Execute(null); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,124 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|                 xmlns:local="clr-namespace:AideDeJeu.Views" | ||||
|                 x:Class="AideDeJeu.Views.MonstersPage" | ||||
|                   x:Name="This" | ||||
|                 IsPresented="False" | ||||
|                   Title="Liste des monstres" | ||||
|                 > | ||||
|     <MasterDetailPage.Master> | ||||
|         <ContentPage Title="Liste des monstres"> | ||||
|             <ScrollView Orientation="Vertical"> | ||||
|                 <StackLayout Orientation="Vertical" Padding="15"> | ||||
| 
 | ||||
|                     <Label Text="Catégorie" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Categories, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Category}" /> | ||||
| 
 | ||||
|                     <Label Text="Type" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Types, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Type}" /> | ||||
| 
 | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <StackLayout Orientation="Vertical"> | ||||
|                             <Label Text="FP minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                             <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding MinPower}" /> | ||||
|                         </StackLayout> | ||||
| 
 | ||||
|                         <StackLayout Orientation="Vertical"> | ||||
|                             <Label Text="FP maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                             <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Powers, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding MaxPower}" /> | ||||
|                         </StackLayout> | ||||
|                     </StackLayout> | ||||
| 
 | ||||
|                     <Label Text="Taille" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Sizes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Size}" /> | ||||
| 
 | ||||
|                     <Label Text="Légendaire" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Legendaries, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Legendary}" /> | ||||
| 
 | ||||
|                     <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Source}" IsEnabled="False"/> | ||||
|                 </StackLayout> | ||||
|             </ScrollView> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Master> | ||||
|     <MasterDetailPage.Detail> | ||||
|         <ContentPage Title="Liste des monstres"> | ||||
|             <ContentPage.ToolbarItems> | ||||
|                 <!--<ToolbarItem Name="Home" Text="Accueil" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" /> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" />--> | ||||
|                 <!--<ToolbarItem Name="Blog" Text="Blog" Order="Primary" Icon="ic_blog.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Blog/" /> | ||||
|                 <ToolbarItem Name="Wikis" Text="Wikis" Order="Primary" Icon="ic_wikis.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/" /> | ||||
|                 <ToolbarItem Name="Forum" Text="Forum" Order="Primary" Icon="ic_forum.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Forum/" /> | ||||
| 
 | ||||
|                 <ToolbarItem Name="Gallery2" Text="Galerie" Order="Secondary" Icon="ic_gallery.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Media/" /> | ||||
|                 <ToolbarItem Name="Plays2" Text="Parties" Order="Secondary" Icon="ic_plays.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/Parties.MainPage.ashx" /> | ||||
|                 <ToolbarItem Name="Search2" Text="Rechercher" Order="Secondary" Icon="ic_search.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/search/default.aspx" />--> | ||||
|                 <!--<ToolbarItem Text="Profil" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/yaf_cp_profile.aspx" /> | ||||
|                 <ToolbarItem Text="Messages privés" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/default.aspx?g=cp_pm" /> | ||||
|                 <ToolbarItem Text="Connexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/login.aspx" /> | ||||
|                 <ToolbarItem Text="Déconnexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/logout.aspx" /> | ||||
|                 <ToolbarItem Text="Inscription" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/register.aspx" />--> | ||||
|             </ContentPage.ToolbarItems> | ||||
|             <Grid> | ||||
|                 <ListView x:Name="ItemsListView"  | ||||
|                 ItemsSource="{Binding Items}" | ||||
|                 VerticalOptions="FillAndExpand" | ||||
|                  HasUnevenRows="true" | ||||
|                  RefreshCommand="{Binding LoadItemsCommand}" | ||||
|                  IsPullToRefreshEnabled="true" | ||||
|                  IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                  CachingStrategy="RecycleElement" | ||||
|                  ItemSelected="OnItemSelected"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10"> | ||||
|                                     <Label Text="{Binding Name}"  | ||||
|                        LineBreakMode="NoWrap"  | ||||
|                        Style="{DynamicResource subsubsection}"  | ||||
|                        FontSize="16" /> | ||||
|                                     <!--<Label Text="{Binding Description}"  | ||||
|                        LineBreakMode="NoWrap" | ||||
|                        Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                        FontSize="13" />--> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|                 <!--<WebView x:Name="MainView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Navigating="OnNavigating" Source="{Binding Source}" />--> | ||||
|                 <!--<ActivityIndicator x:Name="aiProgress" Color="Black" IsRunning="True" IsVisible="True" />--> | ||||
|             </Grid> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Detail> | ||||
| </MasterDetailPage> | ||||
| 
 | ||||
| <!--<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|             xmlns:views="clr-namespace:AideDeJeu.Views" | ||||
|             x:Class="AideDeJeu.Views.MainPage"> | ||||
|     <TabbedPage.Children> | ||||
|         <NavigationPage Title="Browse"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_feed.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:ItemsPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|          | ||||
|         <NavigationPage Title="About"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_about.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:AboutPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|     </TabbedPage.Children> | ||||
| </TabbedPage>--> | ||||
|  | @ -1,49 +0,0 @@ | |||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeuLib.Monsters; | ||||
| using System; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| 
 | ||||
| namespace AideDeJeu.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class MonstersPage : MasterDetailPage //TabbedPage | ||||
|     { | ||||
|         MonstersViewModel viewModel; | ||||
| 
 | ||||
|         public MonstersPage () | ||||
| 		{ | ||||
| 			InitializeComponent (); | ||||
| 
 | ||||
|             BindingContext = viewModel = new MonstersViewModel(); | ||||
|         } | ||||
| 
 | ||||
|         async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) | ||||
|         { | ||||
|             var item = args.SelectedItem as Monster; | ||||
|             if (item == null) | ||||
|                 return; | ||||
| 
 | ||||
|             var spellvm = new MonsterDetailViewModel(item); | ||||
|             spellvm.LoadItemCommand.Execute(null); | ||||
|             await Navigation.PushAsync(new MonsterDetailPage(spellvm)); | ||||
| 
 | ||||
|             // Manually deselect item. | ||||
|             ItemsListView.SelectedItem = null; | ||||
|         } | ||||
| 
 | ||||
|         async void AddItem_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             //await Navigation.PushModalAsync(new NavigationPage(new NewItemPage())); | ||||
|         } | ||||
| 
 | ||||
|         protected override void OnAppearing() | ||||
|         { | ||||
|             base.OnAppearing(); | ||||
| 
 | ||||
|             if (viewModel.Items.Count == 0) | ||||
|                 viewModel.LoadItemsCommand.Execute(null); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,132 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|                 xmlns:local="clr-namespace:AideDeJeu.Views" | ||||
|                 x:Class="AideDeJeu.Views.SpellsPage" | ||||
|                   x:Name="This" | ||||
|                 IsPresented="False" | ||||
|                   Title="Liste des sorts" | ||||
|                 > | ||||
|     <MasterDetailPage.Master> | ||||
|         <ContentPage Title="Liste des sorts"> | ||||
|             <ScrollView Orientation="Vertical"> | ||||
|                 <StackLayout Orientation="Vertical" Padding="15"> | ||||
|                     <!--<StackLayout Orientation="Horizontal"> | ||||
|                     <Button Clicked="OnPlay" Image="ic_play.png" /> | ||||
|                     <Button Clicked="OnStop" Image="ic_stop.png" /> | ||||
|                 </StackLayout>--> | ||||
|                     <!--<ListView x:Name="NavigationView" ItemsSource="{Binding MainMenu}"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <TextCell Text="{Binding Title}" TextColor="Black" Command="{Binding Path=BindingContext.OpenUrl, Source={x:Reference Name=This}}" CommandParameter="{Binding Url}" /> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView>--> | ||||
|                     <!--<Label Text="Liste" /> | ||||
|                 <Picker HorizontalOptions="FillAndExpand"> | ||||
|                     <Picker.Items> | ||||
|                         <x:String>Sorts</x:String> | ||||
|                     </Picker.Items> | ||||
|                 </Picker>--> | ||||
| 
 | ||||
|                     <Label Text="Classe" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Classes, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Classe}" /> | ||||
| 
 | ||||
|                     <Label Text="Niveau minimum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding NiveauMin}" /> | ||||
| 
 | ||||
|                     <Label Text="Niveau maximum" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Niveaux, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding NiveauMax}" /> | ||||
| 
 | ||||
|                     <Label Text="École" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Ecoles, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Ecole}" /> | ||||
| 
 | ||||
|                     <Label Text="Rituel" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Rituels, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Rituel}" /> | ||||
| 
 | ||||
|                     <Label Text="Source" Style="{StaticResource Key=subsubsection}" /> | ||||
|                     <Picker HorizontalOptions="FillAndExpand" ItemsSource="{Binding Sources, Mode=OneWay}" ItemDisplayBinding="{Binding Value, Mode=OneWay}" SelectedIndex="{Binding Source}" IsEnabled="False" /> | ||||
|                 </StackLayout> | ||||
|             </ScrollView> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Master> | ||||
|     <MasterDetailPage.Detail> | ||||
|         <ContentPage Title="Liste des sorts"> | ||||
|             <ContentPage.ToolbarItems> | ||||
|                 <!--<ToolbarItem Name="Home" Text="Accueil" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" /> | ||||
|                 <ToolbarItem Name="Spells" Text="Sorts" Order="Primary" Icon="ic_home.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/" />--> | ||||
|                 <!--<ToolbarItem Name="Blog" Text="Blog" Order="Primary" Icon="ic_blog.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Blog/" /> | ||||
|                 <ToolbarItem Name="Wikis" Text="Wikis" Order="Primary" Icon="ic_wikis.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/" /> | ||||
|                 <ToolbarItem Name="Forum" Text="Forum" Order="Primary" Icon="ic_forum.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Forum/" /> | ||||
| 
 | ||||
|                 <ToolbarItem Name="Gallery2" Text="Galerie" Order="Secondary" Icon="ic_gallery.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Media/" /> | ||||
|                 <ToolbarItem Name="Plays2" Text="Parties" Order="Secondary" Icon="ic_plays.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/Wiki/Parties.MainPage.ashx" /> | ||||
|                 <ToolbarItem Name="Search2" Text="Rechercher" Order="Secondary" Icon="ic_search.png" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/search/default.aspx" />--> | ||||
|                 <!--<ToolbarItem Text="Profil" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/yaf_cp_profile.aspx" /> | ||||
|                 <ToolbarItem Text="Messages privés" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/forum/default.aspx?g=cp_pm" /> | ||||
|                 <ToolbarItem Text="Connexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/login.aspx" /> | ||||
|                 <ToolbarItem Text="Déconnexion" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/logout.aspx" /> | ||||
|                 <ToolbarItem Text="Inscription" Order="Secondary" Command="{Binding OpenUrl}" CommandParameter="http://www.pathfinder-fr.org/members/register.aspx" />--> | ||||
|             </ContentPage.ToolbarItems> | ||||
|             <Grid> | ||||
|                 <ListView x:Name="ItemsListView"  | ||||
|                 ItemsSource="{Binding Items}" | ||||
|                 VerticalOptions="FillAndExpand" | ||||
|                  HasUnevenRows="true" | ||||
|                  RefreshCommand="{Binding LoadItemsCommand}" | ||||
|                  IsPullToRefreshEnabled="true" | ||||
|                  IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                  CachingStrategy="RecycleElement" | ||||
|                  ItemSelected="OnItemSelected"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10"> | ||||
|                                     <Label Text="{Binding Title}"  | ||||
|                        LineBreakMode="NoWrap"  | ||||
|                        Style="{DynamicResource subsubsection}"  | ||||
|                        FontSize="16" /> | ||||
|                                     <!--<Label Text="{Binding Description}"  | ||||
|                        LineBreakMode="NoWrap" | ||||
|                        Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                        FontSize="13" />--> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|                 <!--<WebView x:Name="MainView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Navigating="OnNavigating" Source="{Binding Source}" />--> | ||||
|                 <!--<ActivityIndicator x:Name="aiProgress" Color="Black" IsRunning="True" IsVisible="True" />--> | ||||
|             </Grid> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Detail> | ||||
| </MasterDetailPage> | ||||
| 
 | ||||
| <!--<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|             xmlns:views="clr-namespace:AideDeJeu.Views" | ||||
|             x:Class="AideDeJeu.Views.MainPage"> | ||||
|     <TabbedPage.Children> | ||||
|         <NavigationPage Title="Browse"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_feed.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:ItemsPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|          | ||||
|         <NavigationPage Title="About"> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_about.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:AboutPage /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|     </TabbedPage.Children> | ||||
| </TabbedPage>--> | ||||
|  | @ -1,49 +0,0 @@ | |||
| using AideDeJeu.ViewModels; | ||||
| using AideDeJeuLib.Spells; | ||||
| using System; | ||||
| 
 | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| 
 | ||||
| namespace AideDeJeu.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
| 	public partial class SpellsPage : MasterDetailPage //TabbedPage | ||||
|     { | ||||
|         SpellsViewModel viewModel; | ||||
| 
 | ||||
|         public SpellsPage () | ||||
| 		{ | ||||
| 			InitializeComponent (); | ||||
| 
 | ||||
|             BindingContext = viewModel = new SpellsViewModel(); | ||||
|         } | ||||
| 
 | ||||
|         async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) | ||||
|         { | ||||
|             var item = args.SelectedItem as Spell; | ||||
|             if (item == null) | ||||
|                 return; | ||||
| 
 | ||||
|             var spellvm = new SpellDetailViewModel(item); | ||||
|             spellvm.LoadItemCommand.Execute(null); | ||||
|             await Navigation.PushAsync(new SpellDetailPage(spellvm)); | ||||
| 
 | ||||
|             // Manually deselect item. | ||||
|             ItemsListView.SelectedItem = null; | ||||
|         } | ||||
| 
 | ||||
|         async void AddItem_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             //await Navigation.PushModalAsync(new NavigationPage(new NewItemPage())); | ||||
|         } | ||||
| 
 | ||||
|         protected override void OnAppearing() | ||||
|         { | ||||
|             base.OnAppearing(); | ||||
| 
 | ||||
|             if (viewModel.Items.Count == 0) | ||||
|                 viewModel.LoadItemsCommand.Execute(null); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez