mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Busy
This commit is contained in:
		
							parent
							
								
									6659b4f533
								
							
						
					
					
						commit
						3d9dfa517d
					
				
					 7 changed files with 73 additions and 32 deletions
				
			
		|  | @ -59,6 +59,7 @@ namespace AideDeJeu.ViewModels | |||
|         private Dictionary<string, ItemWithAnchors> _AllItems = new Dictionary<string, ItemWithAnchors>(); | ||||
|         public async Task<Item> GetItemFromDataAsync(string source, string anchor) | ||||
|         { | ||||
|             await Task.Delay(3000); | ||||
|             if (!_AllItems.ContainsKey(source)) | ||||
|             { | ||||
|                 //var md = await Tools.Helpers.GetStringFromUrl($"https://raw.githubusercontent.com/Nioux/AideDeJeu/master/Data/{source}.md"); | ||||
|  |  | |||
|  | @ -91,7 +91,7 @@ namespace AideDeJeu.ViewModels | |||
|                 var with = match.Groups["with"].Value; | ||||
|                 Main.IsBusy = true; | ||||
|                 Main.IsLoading = true; | ||||
|                 var item = await Main.GetItemFromDataAsync(file, anchor); | ||||
|                 var item = await Task.Run(async () => await Main.GetItemFromDataAsync(file, anchor)); | ||||
|                 Main.IsBusy = false; | ||||
|                 Main.IsLoading = false; | ||||
|                 if (item != null) | ||||
|  |  | |||
|  | @ -3,8 +3,7 @@ | |||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              x:Class="AideDeJeu.Views.AboutPage" | ||||
|              xmlns:vm="clr-namespace:AideDeJeu.ViewModels;" | ||||
|              Title="{Binding Title}"  | ||||
|              IsBusy="{Binding IsBusy}"> | ||||
|              Title="{Binding Title}"> | ||||
|     <ContentPage.BindingContext> | ||||
|         <vm:AboutViewModel /> | ||||
|     </ContentPage.BindingContext> | ||||
|  |  | |||
|  | @ -6,8 +6,7 @@ | |||
|     xmlns:tools="clr-namespace:AideDeJeu.Tools"  | ||||
|     x:Class="AideDeJeu.Views.FilteredItemsPage"  | ||||
|     x:Name="This"  | ||||
|     Title="{Binding Title}" | ||||
|     IsBusy="{Binding Main.IsLoading}"> | ||||
|     Title="{Binding Title}"> | ||||
|     <MasterDetailPage.ToolbarItems> | ||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.AboutCommand}" /> | ||||
|     </MasterDetailPage.ToolbarItems> | ||||
|  | @ -64,6 +63,19 @@ | |||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|                 <ActivityIndicator  | ||||
|                     VerticalOptions="StartAndExpand" | ||||
|                     HorizontalOptions="End" | ||||
|                     Color="{StaticResource titlered}" | ||||
|                     IsRunning="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"  | ||||
|                     IsVisible="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"> | ||||
|                     <ActivityIndicator.WidthRequest> | ||||
|                         <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="400" Android="50" /> | ||||
|                     </ActivityIndicator.WidthRequest> | ||||
|                     <ActivityIndicator.HeightRequest> | ||||
|                         <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="10" Android="50" /> | ||||
|                     </ActivityIndicator.HeightRequest> | ||||
|                 </ActivityIndicator> | ||||
|             </Grid> | ||||
|         </ContentPage> | ||||
|     </MasterDetailPage.Detail> | ||||
|  |  | |||
|  | @ -5,8 +5,7 @@ | |||
|              xmlns:mdview="clr-namespace:Xam.Forms.Markdown" | ||||
|              x:Class="AideDeJeu.Views.ItemDetailPage" | ||||
|              Title="{Binding Title}" | ||||
|              x:Name="This" | ||||
|              IsBusy="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"> | ||||
|              x:Name="This"> | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" /> | ||||
|  | @ -16,11 +15,26 @@ | |||
|     <ContentPage.ToolbarItems> | ||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.AboutCommand}" /> | ||||
|     </ContentPage.ToolbarItems> | ||||
|     <ScrollView Orientation="Vertical" BackgroundColor="#fdf1dc"> | ||||
|         <mdview:MarkdownView  | ||||
|             Theme="{StaticResource MonsterMarkdownTheme}"  | ||||
|             Markdown="{Binding Item.Markdown}"  | ||||
|             NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}" | ||||
|             /> | ||||
|     </ScrollView> | ||||
|     <Grid> | ||||
|         <ScrollView Orientation="Vertical" BackgroundColor="#fdf1dc"> | ||||
|             <mdview:MarkdownView  | ||||
|                 Theme="{StaticResource MonsterMarkdownTheme}"  | ||||
|                 Markdown="{Binding Item.Markdown}"  | ||||
|                 NavigateToLinkCommand="{Binding BindingContext.Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}" | ||||
|                 /> | ||||
|         </ScrollView> | ||||
|         <ActivityIndicator  | ||||
|             VerticalOptions="StartAndExpand" | ||||
|             HorizontalOptions="End" | ||||
|             Color="{StaticResource titlered}" | ||||
|             IsRunning="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"  | ||||
|             IsVisible="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"> | ||||
|             <ActivityIndicator.WidthRequest> | ||||
|                 <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="400" Android="50" /> | ||||
|             </ActivityIndicator.WidthRequest> | ||||
|             <ActivityIndicator.HeightRequest> | ||||
|                 <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="10" Android="50" /> | ||||
|             </ActivityIndicator.HeightRequest> | ||||
|         </ActivityIndicator> | ||||
|     </Grid> | ||||
| </ContentPage> | ||||
|  | @ -7,8 +7,7 @@ | |||
|     xmlns:mdview="clr-namespace:Xam.Forms.Markdown" | ||||
|     x:Class="AideDeJeu.Views.ItemsPage"  | ||||
|     x:Name="This"  | ||||
|     Title="{Binding Title}" | ||||
|     IsBusy="{Binding Main.IsLoading}"> | ||||
|     Title="{Binding Title}"> | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" /> | ||||
|  | @ -19,23 +18,38 @@ | |||
|     <ContentPage.ToolbarItems> | ||||
|         <ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.AboutCommand}" /> | ||||
|     </ContentPage.ToolbarItems> | ||||
|     <ListView BackgroundColor="{StaticResource bgtan}" x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped"> | ||||
|         <ListView.Header> | ||||
|             <mdview:MarkdownView  | ||||
|     <Grid> | ||||
|         <ListView BackgroundColor="{StaticResource bgtan}" x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped"> | ||||
|             <ListView.Header> | ||||
|                 <mdview:MarkdownView  | ||||
|                 Theme="{StaticResource MonsterMarkdownTheme}"  | ||||
|                 Markdown="{Binding BindingContext.Items.Markdown, Source={x:Reference This}}"  | ||||
|                 NavigateToLinkCommand="{Binding Main.Navigator.NavigateToLinkCommand, Source={x:Reference This}}" | ||||
|                 /> | ||||
|         </ListView.Header> | ||||
|         <ListView.ItemTemplate> | ||||
|             <DataTemplate> | ||||
|                 <ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop"> | ||||
|                     <StackLayout Padding="10" Orientation="Vertical"> | ||||
|                         <Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="#0366d6" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}}" /> | ||||
|                         <Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" Style="{DynamicResource subsubsection}" FontSize="12" /> | ||||
|                     </StackLayout> | ||||
|                 </ViewCell> | ||||
|             </DataTemplate> | ||||
|         </ListView.ItemTemplate> | ||||
|     </ListView> | ||||
|             </ListView.Header> | ||||
|             <ListView.ItemTemplate> | ||||
|                 <DataTemplate> | ||||
|                     <ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop"> | ||||
|                         <StackLayout Padding="10" Orientation="Vertical"> | ||||
|                             <Label Text="{Binding Name}" LineBreakMode="WordWrap" TextColor="#0366d6" Style="{Binding NameLevel,Converter={StaticResource HeaderLevelToStyleConverter}}" /> | ||||
|                             <Label Text="{Binding AltNameText}" LineBreakMode="WordWrap" Style="{DynamicResource subsubsection}" FontSize="12" /> | ||||
|                         </StackLayout> | ||||
|                     </ViewCell> | ||||
|                 </DataTemplate> | ||||
|             </ListView.ItemTemplate> | ||||
|         </ListView> | ||||
|         <ActivityIndicator  | ||||
|             VerticalOptions="StartAndExpand" | ||||
|             HorizontalOptions="End" | ||||
|             Color="{StaticResource titlered}" | ||||
|             IsRunning="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"  | ||||
|             IsVisible="{Binding BindingContext.Main.IsLoading, Source={x:Reference This}}"> | ||||
|             <ActivityIndicator.WidthRequest> | ||||
|                 <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="400" Android="50" /> | ||||
|             </ActivityIndicator.WidthRequest> | ||||
|             <ActivityIndicator.HeightRequest> | ||||
|                 <OnPlatform x:TypeArguments="x:Double" iOS="50" WinPhone="10" Android="50" /> | ||||
|             </ActivityIndicator.HeightRequest> | ||||
|         </ActivityIndicator> | ||||
|     </Grid> | ||||
| </ContentPage> | ||||
|  | @ -1,5 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <NavigationPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              x:Class="AideDeJeu.Views.MainNavigationPage" IsBusy="{Binding BindingContext.Main.IsLoading}"> | ||||
|              x:Class="AideDeJeu.Views.MainNavigationPage"> | ||||
| 
 | ||||
| </NavigationPage> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez