diff --git a/AideDeJeu/AideDeJeu/AideDeJeu.csproj b/AideDeJeu/AideDeJeu/AideDeJeu.csproj
index d01cbad1..026273da 100644
--- a/AideDeJeu/AideDeJeu/AideDeJeu.csproj
+++ b/AideDeJeu/AideDeJeu/AideDeJeu.csproj
@@ -62,6 +62,12 @@
MainTabbedPage.xaml
+
+ ItemPicker.xaml
+
+
+ ItemPickerView.xaml
+
diff --git a/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacterEditorViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacterEditorViewModel.cs
index 625b31d0..cc09a7a2 100644
--- a/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacterEditorViewModel.cs
+++ b/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacterEditorViewModel.cs
@@ -73,6 +73,22 @@ namespace AideDeJeu.ViewModels
}
}
}
+ 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> LoadAlignmentsAsync(string alignment = null)
{
@@ -181,26 +197,41 @@ namespace AideDeJeu.ViewModels
set
{
SetProperty(ref _BackgroundSelectedIndex, value);
- SelectedPlayerCharacter.Background = Backgrounds.Result[_BackgroundSelectedIndex];
+ SelectedBackground = Backgrounds.Result[_BackgroundSelectedIndex];
+ }
+ }
+
+ private BackgroundItem _SelectedBackground = null;
+ public BackgroundItem SelectedBackground
+ {
+ get
+ {
+ return _SelectedBackground;
+ }
+ set
+ {
+ SetProperty(ref _SelectedBackground, value);
SelectedBackgroundChanged();
}
}
private void SelectedBackgroundChanged()
{
- SubBackgrounds = new NotifyTaskCompletion>(Task.Run(() => LoadSubBackgroundsAsync(SelectedPlayerCharacter.Background)));
- PersonalityTraits = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityTraitsAsync(SelectedPlayerCharacter.Background)));
- PersonalityIdeals = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityIdealsAsync(SelectedPlayerCharacter.Background)));
- PersonalityLinks = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityLinksAsync(SelectedPlayerCharacter.Background)));
- PersonalityDefects = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityDefectsAsync(SelectedPlayerCharacter.Background)));
- BackgroundSpecialties = new NotifyTaskCompletion(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedPlayerCharacter.Background)));
- Task.Run(async () => SelectedPlayerCharacter.BackgroundSkill = await LoadSkillAsync(SelectedPlayerCharacter.Background));
SelectedPlayerCharacter.SubBackground = null;
SelectedPlayerCharacter.PersonalityTrait = null;
SelectedPlayerCharacter.PersonalityIdeal = null;
SelectedPlayerCharacter.PersonalityLink = null;
SelectedPlayerCharacter.PersonalityDefect = null;
SelectedPlayerCharacter.BackgroundSpecialty = null;
+ SelectedPlayerCharacter.Background = SelectedBackground;
+
+ SubBackgrounds = new NotifyTaskCompletion>(Task.Run(() => LoadSubBackgroundsAsync(SelectedBackground)));
+ PersonalityTraits = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityTraitsAsync(SelectedBackground)));
+ PersonalityIdeals = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityIdealsAsync(SelectedBackground)));
+ PersonalityLinks = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityLinksAsync(SelectedBackground)));
+ PersonalityDefects = new NotifyTaskCompletion>(Task.Run(() => LoadPersonalityDefectsAsync(SelectedBackground)));
+ BackgroundSpecialties = new NotifyTaskCompletion(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedBackground)));
+ Task.Run(async () => SelectedPlayerCharacter.BackgroundSkill = await LoadSkillAsync(SelectedBackground));
ResetAlignments();
}
@@ -229,20 +260,35 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _SubBackgroundSelectedIndex, value);
if (_SubBackgroundSelectedIndex == 0)
{
- SelectedPlayerCharacter.SubBackground = null;
+ //SelectedPlayerCharacter.SubBackground = null;
SubBackgroundSelectedIndex = -1;
+ SelectedSubBackground = null;
}
else if (_SubBackgroundSelectedIndex > 0)
{
- SelectedPlayerCharacter.SubBackground = SubBackgrounds.Result[_SubBackgroundSelectedIndex];
+ SelectedSubBackground = SubBackgrounds.Result[_SubBackgroundSelectedIndex];
}
+ }
+ }
+
+ private SubBackgroundItem _SelectedSubBackground = null;
+ public SubBackgroundItem SelectedSubBackground
+ {
+ get
+ {
+ return _SelectedSubBackground;
+ }
+ set
+ {
+ SetProperty(ref _SelectedSubBackground, value);
SelectedSubBackgroundChanged();
}
}
private void SelectedSubBackgroundChanged()
{
- if (SelectedPlayerCharacter.SubBackground == null)
+ SelectedPlayerCharacter.SubBackground = SelectedSubBackground;
+ if (SelectedSubBackground == null)
{
SubBackgroundSpecialties = null;
SelectedPlayerCharacter.SubBackgroundSkill = null;
@@ -250,8 +296,8 @@ namespace AideDeJeu.ViewModels
}
else
{
- SubBackgroundSpecialties = new NotifyTaskCompletion(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedPlayerCharacter.SubBackground)));
- Task.Run(async () => SelectedPlayerCharacter.SubBackgroundSkill = await LoadSkillAsync(SelectedPlayerCharacter.SubBackground));
+ SubBackgroundSpecialties = new NotifyTaskCompletion(Task.Run(() => LoadBackgroundsSpecialtiesAsync(SelectedSubBackground)));
+ Task.Run(async () => SelectedPlayerCharacter.SubBackgroundSkill = await LoadSkillAsync(SelectedSubBackground));
}
}
@@ -267,6 +313,20 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _PersonalityTraits, value);
}
}
+ private string _SelectedPersonalityTrait = null;
+ public string SelectedPersonalityTrait
+ {
+ get
+ {
+ return _SelectedPersonalityTrait;
+ }
+ private set
+ {
+ SetProperty(ref _SelectedPersonalityTrait, value);
+ SelectedPlayerCharacter.PersonalityTrait = value;
+ }
+ }
+
private NotifyTaskCompletion> _PersonalityIdeals = null;
public NotifyTaskCompletion> PersonalityIdeals
{
@@ -279,6 +339,20 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _PersonalityIdeals, value);
}
}
+ private string _SelectedPersonalityIdeal = null;
+ public string SelectedPersonalityIdeal
+ {
+ get
+ {
+ return _SelectedPersonalityIdeal;
+ }
+ private set
+ {
+ SetProperty(ref _SelectedPersonalityIdeal, value);
+ SelectedPlayerCharacter.PersonalityIdeal = value;
+ }
+ }
+
private NotifyTaskCompletion> _PersonalityLinks = null;
public NotifyTaskCompletion> PersonalityLinks
{
@@ -291,6 +365,20 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _PersonalityLinks, value);
}
}
+ private string _SelectedPersonalityLink = null;
+ public string SelectedPersonalityLink
+ {
+ get
+ {
+ return _SelectedPersonalityLink;
+ }
+ private set
+ {
+ SetProperty(ref _SelectedPersonalityLink, value);
+ SelectedPlayerCharacter.PersonalityLink = value;
+ }
+ }
+
private NotifyTaskCompletion> _PersonalityDefects = null;
public NotifyTaskCompletion> PersonalityDefects
{
@@ -303,6 +391,20 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _PersonalityDefects, value);
}
}
+ private string _SelectedPersonalityDefect = null;
+ public string SelectedPersonalityDefect
+ {
+ get
+ {
+ return _SelectedPersonalityDefect;
+ }
+ private set
+ {
+ SetProperty(ref _SelectedPersonalityDefect, value);
+ SelectedPlayerCharacter.PersonalityDefect = value;
+ }
+ }
+
private NotifyTaskCompletion _BackgroundSpecialties = null;
public NotifyTaskCompletion BackgroundSpecialties
{
@@ -476,7 +578,7 @@ namespace AideDeJeu.ViewModels
return new List();
}
}
-
+ /*
public ICommand BackgroundSpecialtyPickerCommand
{
get
@@ -495,7 +597,7 @@ namespace AideDeJeu.ViewModels
{
get
{
- return new Command>(async (strings) => SelectedPlayerCharacter.PersonalityTrait = await ExecuteStringPickerCommandAsync(strings));
+ return new Command>(async (strings) => SelectedPersonalityTrait = await ExecuteStringPickerCommandAsync(strings));
}
}
public ICommand PersonalityIdealPickerCommand
@@ -524,7 +626,8 @@ namespace AideDeJeu.ViewModels
return new Command>(async (strings) => SelectedPlayerCharacter.PersonalityDefect = await ExecuteStringPickerCommandAsync(strings));
}
}
-
+ */
+ /*
private async Task ExecuteStringPickerCommandAsync(List strings)
{
var picker = new Views.StringPicker();
@@ -535,6 +638,7 @@ namespace AideDeJeu.ViewModels
await Main.Navigator.Navigation.PopModalAsync(true);
return result;
}
+ */
#endregion Background
#region Abilities
diff --git a/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml b/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml
new file mode 100644
index 00000000..441a6975
--- /dev/null
+++ b/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml.cs b/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml.cs
new file mode 100644
index 00000000..4d8a8979
--- /dev/null
+++ b/AideDeJeu/AideDeJeu/Views/ItemPicker.xaml.cs
@@ -0,0 +1,24 @@
+using AideDeJeu.ViewModels;
+using AideDeJeuLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace AideDeJeu.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class ItemPicker : ContentPage
+ {
+ public PickerViewModel- ViewModel { get; set; } = new PickerViewModel
- ();
+ public ItemPicker()
+ {
+ InitializeComponent();
+ BindingContext = ViewModel;
+ }
+ }
+}
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml b/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml
new file mode 100644
index 00000000..053a0b42
--- /dev/null
+++ b/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml.cs b/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml.cs
new file mode 100644
index 00000000..c08e757b
--- /dev/null
+++ b/AideDeJeu/AideDeJeu/Views/ItemPickerView.xaml.cs
@@ -0,0 +1,101 @@
+using AideDeJeu.ViewModels;
+using AideDeJeuLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace AideDeJeu.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class ItemPickerView : StackLayout
+ {
+ public MainViewModel Main
+ {
+ get
+ {
+ return DependencyService.Get();
+ }
+ }
+ public ItemPickerView()
+ {
+ InitializeComponent();
+ BindingContext = this;
+ }
+
+ public string Title
+ {
+ get { return (string)GetValue(TitleProperty); }
+ set { SetValue(TitleProperty, value); }
+ }
+ public static readonly BindableProperty TitleProperty = BindableProperty.Create(
+ nameof(Title),
+ typeof(string),
+ typeof(ItemPickerView),
+ defaultValue: default(string));
+
+ public string Description
+ {
+ get { return (string)GetValue(DescriptionProperty); }
+ set { SetValue(DescriptionProperty, value); }
+ }
+ public static readonly BindableProperty DescriptionProperty = BindableProperty.Create(
+ nameof(Description),
+ typeof(string),
+ typeof(ItemPickerView),
+ defaultValue: default(string));
+
+ public Item SelectedItem
+ {
+ get { return (Item)GetValue(SelectedItemProperty); }
+ set { SetValue(SelectedItemProperty, value); }
+ }
+ public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(
+ nameof(SelectedItem),
+ typeof(Item),
+ typeof(ItemPickerView),
+ defaultValue: default(Item),
+ defaultBindingMode: BindingMode.TwoWay);
+
+ public System.Collections.IEnumerable ItemsSource
+ {
+ get { return (System.Collections.IEnumerable)GetValue(ItemsSourceProperty); }
+ set { SetValue(ItemsSourceProperty, value); }
+ }
+ //public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(
+ // nameof(ItemsSource),
+ // typeof(System.Collections.IList),
+ // typeof(StringPickerView),
+ // defaultValue: new List());
+ public static readonly BindableProperty ItemsSourceProperty =
+ BindableProperty.Create(
+ nameof(ItemsSource),
+ typeof(System.Collections.IEnumerable),
+ typeof(ItemPickerView),
+ default(System.Collections.IEnumerable));
+
+ public ICommand PickerCommand
+ {
+ get
+ {
+ return new Command(async (items) => SelectedItem = await ExecuteItemPickerCommandAsync(items));
+ }
+ }
+ private async Task
- ExecuteItemPickerCommandAsync(System.Collections.IEnumerable items)
+ {
+ var picker = new Views.ItemPicker();
+ var vm = picker.ViewModel;
+ vm.Title = Title;
+ vm.Description = Description;
+ vm.Items = items;
+ await Main.Navigator.Navigation.PushModalAsync(picker, true);
+ var result = await vm.PickValueAsync();
+ await Main.Navigator.Navigation.PopModalAsync(true);
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/Views/PlayerCharacterEditorPage.xaml b/AideDeJeu/AideDeJeu/Views/PlayerCharacterEditorPage.xaml
index d834de5b..9f823976 100644
--- a/AideDeJeu/AideDeJeu/Views/PlayerCharacterEditorPage.xaml
+++ b/AideDeJeu/AideDeJeu/Views/PlayerCharacterEditorPage.xaml
@@ -23,8 +23,10 @@
-
-
+
+
+
+
@@ -48,19 +50,32 @@
-
+
+
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+