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

Suppression des notify backgrounds

This commit is contained in:
Yan Maniez 2019-04-28 20:55:00 +02:00
parent 9cf62f4de3
commit 6d110c08bc
3 changed files with 42 additions and 79 deletions

View file

@ -8,12 +8,12 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
public class BackgroundViewModel : BaseViewModel
{
private BackgroundItem _Background = null;
public BackgroundItem Background { get { return _Background; } set { SetProperty(ref _Background, value); OnPropertyChanged(nameof(SelectedBackground)); } }
public BackgroundItem Background { get { return _Background; } set { SetProperty(ref _Background, value); OnPropertyChanged(nameof(BackgroundOrSubBackground)); } }
private SubBackgroundItem _SubBackground = null;
public SubBackgroundItem SubBackground { get { return _SubBackground; } set { SetProperty(ref _SubBackground, value); OnPropertyChanged(nameof(SelectedBackground)); } }
public SubBackgroundItem SubBackground { get { return _SubBackground; } set { SetProperty(ref _SubBackground, value); OnPropertyChanged(nameof(BackgroundOrSubBackground)); } }
public BackgroundItem SelectedBackground
public BackgroundItem BackgroundOrSubBackground
{
get
{

View file

@ -27,10 +27,10 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
Backgrounds = new NotifyTaskCompletion<List<BackgroundItem>>(Task.Run(() => LoadBackgroundsAsync()));
SelectedBackground = null;
NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null);
//NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(null);
SubBackgrounds = null;
SelectedSubBackground = null;
NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null);
//NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null);
PersonalityTraits = null;
PersonalityIdeals = null;
PersonalityLinks = null;
@ -75,43 +75,6 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
}
}
private int _AlignmentSelectedIndex = -1;
public int AlignmentSelectedIndex
{
get
{
return _AlignmentSelectedIndex;
}
set
{
SetProperty(ref _AlignmentSelectedIndex, value);
if (0 <= _AlignmentSelectedIndex && _AlignmentSelectedIndex < Alignments.Result.Count)
{
SelectedAlignment = Alignments.Result[_AlignmentSelectedIndex];
}
else
{
SelectedAlignment = null;
}
}
}
private AlignmentItem _SelectedAlignment = null;
public AlignmentItem SelectedAlignment
{
get
{
return _SelectedAlignment;
}
set
{
SetProperty(ref _SelectedAlignment, value);
//if (0 <= _AlignmentSelectedIndex && _AlignmentSelectedIndex < Alignments.Result.Count)
//{
SelectedPlayerCharacter.Alignment = SelectedAlignment;
//}
}
}
public async Task<List<AlignmentItem>> LoadAlignmentsAsync(string alignment = null)
{
using (var context = await StoreViewModel.GetLibraryContextAsync())
@ -222,21 +185,21 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
{
SetProperty(ref _SelectedBackground, value);
OnPropertyChanged(nameof(PreferedBackground));
NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(Task.Run(() => LoadBackgroundAsync(_SelectedBackground)));
}
}
private NotifyTaskCompletion<BackgroundItem> _NotifySelectedBackground = null;
public NotifyTaskCompletion<BackgroundItem> NotifySelectedBackground
{
get
{
return _NotifySelectedBackground;
}
private set
{
SetProperty(ref _NotifySelectedBackground, value);
//NotifySelectedBackground = new NotifyTaskCompletion<BackgroundItem>(Task.Run(() => LoadBackgroundAsync(_SelectedBackground)));
}
}
//private NotifyTaskCompletion<BackgroundItem> _NotifySelectedBackground = null;
//public NotifyTaskCompletion<BackgroundItem> NotifySelectedBackground
//{
// get
// {
// return _NotifySelectedBackground;
// }
// private set
// {
// SetProperty(ref _NotifySelectedBackground, value);
// }
//}
private async Task<BackgroundItem> LoadBackgroundAsync(BackgroundItem background)
{
@ -252,7 +215,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
{
SubBackgrounds = await LoadSubBackgroundsAsync(background);
SelectedSubBackground = null;
NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null);
//NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(null);
PersonalityTraits = await LoadPersonalityTraitsAsync(background);
PersonalityIdeals = await LoadPersonalityIdealsAsync(background);
PersonalityLinks = await LoadPersonalityLinksAsync(background);
@ -318,21 +281,21 @@ namespace AideDeJeu.ViewModels.PlayerCharacter
{
SetProperty(ref _SelectedSubBackground, value);
OnPropertyChanged(nameof(PreferedBackground));
NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(Task.Run(() => LoadSubBackgroundAsync(SelectedSubBackground)));
}
}
private NotifyTaskCompletion<SubBackgroundItem> _NotifySelectedSubBackground = null;
public NotifyTaskCompletion<SubBackgroundItem> NotifySelectedSubBackground
{
get
{
return _NotifySelectedSubBackground;
}
private set
{
SetProperty(ref _NotifySelectedSubBackground, value);
//NotifySelectedSubBackground = new NotifyTaskCompletion<SubBackgroundItem>(Task.Run(() => LoadSubBackgroundAsync(SelectedSubBackground)));
}
}
//private NotifyTaskCompletion<SubBackgroundItem> _NotifySelectedSubBackground = null;
//public NotifyTaskCompletion<SubBackgroundItem> NotifySelectedSubBackground
//{
// get
// {
// return _NotifySelectedSubBackground;
// }
// private set
// {
// SetProperty(ref _NotifySelectedSubBackground, value);
// }
//}
private async Task<SubBackgroundItem> LoadSubBackgroundAsync(SubBackgroundItem subbackground)
{

View file

@ -153,27 +153,27 @@
<views:ItemPickerView BindingContext="{Binding}" Title="Variante" ItemsSource="{Binding SubBackgrounds}" SelectedItem="{Binding SelectedSubBackground, Mode=TwoWay}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" />
<!-- test -->
<!--<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" Title="Compétences" SelectedItem="{Binding PreferedBackground.Abilities}" />-->
<!--<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" Title="Compétences" SelectedItem="{Binding PreferedBackground.Abilities}" />-->
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}">
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}">
<StackLayout Padding="0">
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Compétences" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackground.Abilities}" />
</StackLayout>
</Frame>
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}">
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}">
<StackLayout Padding="0">
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Outils maîtrisés" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackground.MasteredTools}" />
</StackLayout>
</Frame>
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}">
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}">
<StackLayout Padding="0">
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Langues maîtrisées" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackground.MasteredLanguages}" />
</StackLayout>
</Frame>
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}">
<Frame BorderColor="Black" Padding="2" Margin="10" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}">
<StackLayout Padding="0">
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="# Équipement" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" HorizontalOptions="FillAndExpand" Markdown="{Binding PreferedBackground.Equipment}" />
@ -188,13 +188,13 @@
<views:StringPickerView BindingContext="{Binding}" IsVisible="{Binding HasBackgroundSpecialties}" Title="{Binding PreferedBackgroundSpecialties.Name}" Description="{Binding PreferedBackgroundSpecialties.Description}" ItemsSource="{Binding PreferedBackgroundSpecialties.BindableTable}" SelectedItem="{Binding BackgroundSpecialty, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Trait de personnalité" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityTraits}" SelectedItem="{Binding SelectedPersonalityTrait, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Trait de personnalité" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityTraits}" SelectedItem="{Binding SelectedPersonalityTrait, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Idéal" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityIdeals}" SelectedItem="{Binding SelectedPersonalityIdeal, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Idéal" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityIdeals}" SelectedItem="{Binding SelectedPersonalityIdeal, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Lien" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityLinks}" SelectedItem="{Binding SelectedPersonalityLink, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Lien" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityLinks}" SelectedItem="{Binding SelectedPersonalityLink, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding NotifySelectedBackground.IsSuccessfullyCompleted}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPersonalityDefect, Mode=TwoWay}" />
<views:StringPickerView BindingContext="{Binding}" Title="Défaut" IsVisible="{Binding SelectedBackground, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" ItemsSource="{Binding PersonalityDefects}" SelectedItem="{Binding SelectedPersonalityDefect, Mode=TwoWay}" />
</StackLayout>
</ScrollView>
@ -225,7 +225,7 @@
<StackLayout>
<Entry Placeholder="Nom" Text="{Binding Name}" Keyboard="Text" />
<!--<Picker Title="Alignement" HorizontalOptions="FillAndExpand" IsEnabled="{Binding Alignments.IsSuccessfullyCompleted}" ItemsSource="{Binding Alignments.Result}" ItemDisplayBinding="{Binding Name}" SelectedIndex="{Binding AlignmentSelectedIndex, Mode=TwoWay}" />-->
<views:ItemPickerView BindingContext="{Binding}" IsEnabled="{Binding Alignments.IsSuccessfullyCompleted}" Title="Alignement" ItemsSource="{Binding Alignments.Result}" SelectedItem="{Binding SelectedAlignment, Mode=TwoWay}" />
<views:ItemPickerView BindingContext="{Binding}" IsEnabled="{Binding Alignments.IsSuccessfullyCompleted}" Title="Alignement" ItemsSource="{Binding Alignments.Result}" SelectedItem="{Binding SelectedPlayerCharacter.Alignment, Mode=TwoWay}" />
<!--<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding SelectedPlayerCharacter.Alignment.Description}" />-->
<Picker Title="Niveau" HorizontalOptions="FillAndExpand" ItemsSource="{Binding Levels}" ItemDisplayBinding="{Binding StringFormat='Niveau : {0}'}" />