1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-31 15:36:07 +00:00

Début refonte pc

This commit is contained in:
Yan Maniez 2019-05-10 09:10:07 +02:00
parent c46212b76e
commit 020ed61657
5 changed files with 129 additions and 128 deletions

View file

@ -31,8 +31,6 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
} }
private async Task ExecuteResetPlayerCharacterCommandAsync() private async Task ExecuteResetPlayerCharacterCommandAsync()
{
await Task.Run(() =>
{ {
_Random = new Random(DateTime.Now.Millisecond); _Random = new Random(DateTime.Now.Millisecond);
@ -41,10 +39,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
ResetAlignments(); ResetAlignments();
Races = new NotifyTaskCompletion<List<RaceViewModel>>(Task.Run(() => LoadRacesAsync())); Races = await Task.Run(async () => await LoadRacesAsync());
Classes = new NotifyTaskCompletion<List<ClassViewModel>>(Task.Run(() => LoadClassesAsync())); Classes = await Task.Run(async () => await LoadClassesAsync());
Backgrounds = new NotifyTaskCompletion<List<BackgroundItem>>(Task.Run(() => LoadBackgroundsAsync())); Backgrounds = await Task.Run(async () => await LoadBackgroundsAsync());
SelectedBackground = null; SelectedBackground = null;
//NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null); //NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null);
SubBackgrounds = null; SubBackgrounds = null;
@ -63,7 +61,6 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
BackgroundSpecialty = null; BackgroundSpecialty = null;
BackgroundSkill = null; BackgroundSkill = null;
SubBackgroundSkill = null; SubBackgroundSkill = null;
});
} }
public PlayerCharacterEditorViewModel() public PlayerCharacterEditorViewModel()
@ -71,7 +68,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
ExecuteResetPlayerCharacterCommandAsync(); ExecuteResetPlayerCharacterCommandAsync();
} }
private void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e) private async void SelectedPlayerCharacter_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
switch (e.PropertyName) switch (e.PropertyName)
{ {
@ -107,6 +104,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
SelectedPlayerCharacter.Abilities.Listen(); SelectedPlayerCharacter.Abilities.Listen();
break; break;
case nameof(SelectedPlayerCharacter.Background):
SubBackgrounds = await LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background.Background);
break;
} }
} }
@ -228,7 +228,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
#endregion Alignment #endregion Alignment
#region Race #region Race
public NotifyTaskCompletion<List<RaceViewModel>> Races { get; private set; }
private List<RaceViewModel> _Races = null;
public List<RaceViewModel> Races { get { return _Races; } private set { SetProperty(ref _Races, value); } }
public async Task<List<RaceViewModel>> LoadRacesAsync() public async Task<List<RaceViewModel>> LoadRacesAsync()
{ {
@ -258,7 +260,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
#endregion Race #endregion Race
#region Class #region Class
public NotifyTaskCompletion<List<ClassViewModel>> Classes { get; private set; } private List<ClassViewModel> _Classes = null;
public List<ClassViewModel> Classes { get { return _Classes; } private set { SetProperty(ref _Classes, value); } }
public async Task<List<ClassViewModel>> LoadClassesAsync() public async Task<List<ClassViewModel>> LoadClassesAsync()
{ {
@ -270,7 +273,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
#endregion Class #endregion Class
#region Background #region Background
public NotifyTaskCompletion<List<BackgroundItem>> Backgrounds { get; private set; } private List<BackgroundItem> _Backgrounds = null;
public List<BackgroundItem> Backgrounds { get { return _Backgrounds; } private set { SetProperty(ref _Backgrounds, value); } }
//private int _BackgroundSelectedIndex = -1; //private int _BackgroundSelectedIndex = -1;
//public int BackgroundSelectedIndex //public int BackgroundSelectedIndex

View file

@ -20,7 +20,7 @@
<Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" /> <Label Text="{Binding NotifySelectedBackground.Status, StringFormat='NotifySelectedBackground.Status = {0}'}" />
<Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />--> <Label Text="{Binding NotifySelectedSubBackground.Status, StringFormat='NotifySelectedSubBackground.Status = {0}'}" />-->
<pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds.Result}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" /> <pickers:ItemPickerView BindingContext="{Binding}" Title="Historique" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}" />
<pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" /> <pickers:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" />
<!-- test --> <!-- test -->

View file

@ -14,7 +14,7 @@
<ContentView.Content> <ContentView.Content>
<ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> <ScrollView Grid.ColumnSpan="2" Orientation="Vertical">
<StackLayout> <StackLayout>
<pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" /> <pickers:ItemPickerView BindingContext="{Binding}" Title="Classe" ItemsSource="{Binding Classes}" SelectedItem="{Binding SelectedPlayerCharacter.Class, Mode=TwoWay}" />
<!--<Picker Title="Classe" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Classes.IsSuccessfullyCompleted}" ItemsSource="{Binding Classes.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}" />--> <!--<Picker Title="Classe" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Classes.IsSuccessfullyCompleted}" ItemsSource="{Binding Classes.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding ClassSelectedIndex, Mode=TwoWay}" />-->
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Class, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Class, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" >

View file

@ -52,9 +52,6 @@
<tools:NullToFalseConverter x:Key="NullToFalseConverter" /> <tools:NullToFalseConverter x:Key="NullToFalseConverter" />
</ResourceDictionary> </ResourceDictionary>
</CarouselPage.Resources> </CarouselPage.Resources>
<!--<CarouselPage.ToolbarItems>
<ToolbarItem Text="Ouvrir en PDF avec..." Command="{Binding GenerateAndOpenPdfCommand}" Order="Secondary" />
</CarouselPage.ToolbarItems>-->
<ContentPage x:Name="Race" Title="Race"> <ContentPage x:Name="Race" Title="Race">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>

View file

@ -14,7 +14,7 @@
<ContentView.Content> <ContentView.Content>
<ScrollView Grid.ColumnSpan="2" Orientation="Vertical"> <ScrollView Grid.ColumnSpan="2" Orientation="Vertical">
<StackLayout> <StackLayout>
<pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" /> <pickers:ItemPickerView BindingContext="{Binding}" Title="Race" ItemsSource="{Binding Races}" SelectedItem="{Binding SelectedPlayerCharacter.Race, Mode=TwoWay}" IsEnabled="{Binding Races, Converter={StaticResource NullToFalseConverter}}}" />
<!--<Picker Title="Race" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" ItemsSource="{Binding Races.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}" />--> <!--<Picker Title="Race" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Races.IsSuccessfullyCompleted}" ItemsSource="{Binding Races.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding RaceSelectedIndex, Mode=TwoWay}" />-->
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Race, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" > <Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedPlayerCharacter.Race, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" >