1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 06:56:10 +00:00

Test + OrderBy

This commit is contained in:
Yan Maniez 2019-04-17 09:11:53 +02:00
parent 00dd85ee3f
commit 965ffea7ba
4 changed files with 49 additions and 6 deletions

View file

@ -6,19 +6,21 @@ namespace AideDeJeu.Tools
{
public class NotifyTaskCompletion<TResult> : INotifyPropertyChanged
{
public NotifyTaskCompletion(Task<TResult> task)
private bool ContinueOnCapturedContext = false;
public NotifyTaskCompletion(Task<TResult> task, bool continueOnCapturedContext = false)
{
Task = task;
ContinueOnCapturedContext = continueOnCapturedContext;
if (task != null && !task.IsCompleted)
{
var _ = WatchTaskAsync(task);
var _ = WatchTaskAsync(task, continueOnCapturedContext);
}
}
private async Task WatchTaskAsync(Task task)
private async Task WatchTaskAsync(Task task, bool continueOnCapturedContext = false)
{
try
{
await task.ConfigureAwait(false);
await task.ConfigureAwait(continueOnCapturedContext);
}
catch
{

View file

@ -1,4 +1,5 @@
using AideDeJeu.Views;
using AideDeJeu.Tools;
using AideDeJeu.Views;
using AideDeJeuLib;
using Rg.Plugins.Popup.Services;
using System;
@ -48,10 +49,31 @@ namespace AideDeJeu.ViewModels
}
}
//private NotifyTaskCompletion<bool> _TestNotify = null;
//public NotifyTaskCompletion<bool> TestNotify
//{
// get
// {
// return _TestNotify;
// }
// set
// {
// SetProperty(ref _TestNotify, value);
// }
//}
//public async Task<bool> TestGotoAsync()
//{
// var page = new Views.MainTabbedPage();
// Device.BeginInvokeOnMainThread(async() =>
// await Navigation.PushAsync(page, true));
// return true;
//}
public async Task GotoLibraryPageAsync()
{
//await Navigation.PushAsync(new Views.ItemDetailPage(),true);
await Navigation.PushAsync(new Views.MainTabbedPage(), true);
//TestNotify = new NotifyTaskCompletion<bool>(TestGotoAsync(), true);
}
private Command _BookmarksCommand = null;

View file

@ -252,7 +252,7 @@ namespace AideDeJeu.ViewModels
expandedRaces.Add(new ExpandedRaceItem() { Race = race, SubRace = null });
}
}
return expandedRaces;
return expandedRaces.OrderBy(r => Tools.Helpers.RemoveDiacritics(r.Name)).ToList();
//return await context.Races.Where(r => !r.HasSubRaces).OrderBy(r => Tools.Helpers.RemoveDiacritics(r.Name)).ToListAsync().ConfigureAwait(false);
}
}

View file

@ -65,7 +65,26 @@
<ContentPage.Content>
<ScrollView>
<FlexLayout>
<!--<ActivityIndicator
VerticalOptions="StartAndExpand"
HorizontalOptions="End"
Color="{StaticResource HDRed}"
IsVisible="{Binding Main.Navigator.TestNotify.IsNotCompleted, FallbackValue=False}" IsRunning="{Binding Main.Navigator.TestNotify.IsNotCompleted, FallbackValue=False}" >
<ActivityIndicator.WidthRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="UWP" Value="400" />
<On Platform="iOS, Android" Value="50" />
</OnPlatform>
</ActivityIndicator.WidthRequest>
<ActivityIndicator.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="UWP" Value="10" />
<On Platform="iOS, Android" Value="50" />
</OnPlatform>
</ActivityIndicator.HeightRequest>
</ActivityIndicator>-->
<Label Text="{Binding Main.DebugCount.Result, StringFormat='Count : {0}'}" TextColor="Transparent" />
<!--<Label Text="{Binding Main.Navigator.TestNotify}" TextColor="Transparent" />-->
<Frame>
<Grid>
<Label Text="Personnages" />