diff --git a/AideDeJeu/AideDeJeu/Tools/BindableToolbarItem.cs b/AideDeJeu/AideDeJeu/Tools/BindableToolbarItem.cs
new file mode 100644
index 00000000..c83c17ed
--- /dev/null
+++ b/AideDeJeu/AideDeJeu/Tools/BindableToolbarItem.cs
@@ -0,0 +1,51 @@
+using Xamarin.Forms;
+
+namespace AideDeJeu.Tools
+{
+ public class BindableToolbarItem : ToolbarItem
+ {
+ public static readonly BindableProperty IsVisibleProperty =
+ BindableProperty.Create("BindableToolbarItem", typeof(bool), typeof(ToolbarItem),
+ true, BindingMode.TwoWay, propertyChanged: OnIsVisibleChanged);
+
+ public BindableToolbarItem()
+ {
+ InitVisibility();
+ }
+
+ public bool IsVisible
+ {
+ get { return (bool)GetValue(IsVisibleProperty); }
+ set { SetValue(IsVisibleProperty, value); }
+ }
+
+ private void InitVisibility()
+ {
+ OnIsVisibleChanged(this, false, IsVisible);
+ }
+
+ private static void OnIsVisibleChanged(BindableObject bindable, object oldvalue, object newvalue)
+ {
+ var item = bindable as BindableToolbarItem;
+
+ if (item != null && item.Parent == null)
+ return;
+
+ if (item != null)
+ {
+ var items = ((Page)item.Parent)?.ToolbarItems;
+
+ if (Equals(items, null)) return;
+ if ((bool)newvalue && !items.Contains(item))
+ {
+ //Device.BeginInvokeOnMainThread(() => { items.Add(item); });
+ Device.BeginInvokeOnMainThread(() => { items.Insert(0, item); });
+ }
+ else if (!(bool)newvalue && items.Contains(item))
+ {
+ Device.BeginInvokeOnMainThread(() => { items.Remove(item); });
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/ViewModels/MainViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/MainViewModel.cs
index 2f938828..2bbc7b97 100644
--- a/AideDeJeu/AideDeJeu/ViewModels/MainViewModel.cs
+++ b/AideDeJeu/AideDeJeu/ViewModels/MainViewModel.cs
@@ -226,5 +226,27 @@ namespace AideDeJeu.ViewModels
SetProperty(ref _CurrentItem, value);
}
}
+
+ private bool _FilterIsPresented = false;
+ public bool FilterIsPresented
+ {
+ get
+ {
+ return _FilterIsPresented;
+ }
+ set
+ {
+ SetProperty(ref _FilterIsPresented, value);
+ }
+ }
+
+ private Command _ChangeFilterIsPresentedCommand = null;
+ public Command ChangeFilterIsPresentedCommand
+ {
+ get
+ {
+ return _ChangeFilterIsPresentedCommand ?? (_ChangeFilterIsPresentedCommand = new Command(() => FilterIsPresented = !FilterIsPresented));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml
index 1ce07c23..4f537a70 100644
--- a/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml
+++ b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml
@@ -21,9 +21,10 @@
-
-
-
+
+
+
+
-
+
diff --git a/AideDeJeu/AideDeJeu/Views/MainShell.xaml.cs b/AideDeJeu/AideDeJeu/Views/MainShell.xaml.cs
index 2e780cba..b606bab7 100644
--- a/AideDeJeu/AideDeJeu/Views/MainShell.xaml.cs
+++ b/AideDeJeu/AideDeJeu/Views/MainShell.xaml.cs
@@ -14,177 +14,177 @@ using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class MainShell : Shell, INotifyPropertyChanged
+ public partial class MainShell : Shell
{
public MainShell()
{
InitializeComponent();
- BindingContext = this;
+ //BindingContext = this;
}
- public MainViewModel Main
- {
- get
- {
- return DependencyService.Get();
- }
- }
+ //public MainViewModel Main
+ //{
+ // get
+ // {
+ // return DependencyService.Get();
+ // }
+ //}
- public ICommand NavigateToItemCommand
- {
- get
- {
- return new Command(async (path) => await ExecuteNavigateToItemCommandAsync(path));
- }
- }
- private async Task ExecuteNavigateToItemCommandAsync(string path)
- {
- await Navigation.PushAsync(new Library.ItemPage(path), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToItemCommand
+ //{
+ // get
+ // {
+ // return new Command(async (path) => await ExecuteNavigateToItemCommandAsync(path));
+ // }
+ //}
+ //private async Task ExecuteNavigateToItemCommandAsync(string path)
+ //{
+ // await Navigation.PushAsync(new Library.ItemPage(path), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToHomeCommand
- {
- get
- {
- return new Command(async() => await ExecuteNavigateToHomeCommandAsync());
- }
- }
- private async Task ExecuteNavigateToHomeCommandAsync()
- {
- await Navigation.PushAsync(new MainPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToHomeCommand
+ //{
+ // get
+ // {
+ // return new Command(async() => await ExecuteNavigateToHomeCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToHomeCommandAsync()
+ //{
+ // await Navigation.PushAsync(new MainPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToPCCommand
- {
- get
- {
- return new Command(async () => await ExecuteNavigateToPCCommandAsync());
- }
- }
- private async Task ExecuteNavigateToPCCommandAsync()
- {
- await Navigation.PushAsync(new PlayerCharacter.PlayerCharacterEditorPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToPCCommand
+ //{
+ // get
+ // {
+ // return new Command(async () => await ExecuteNavigateToPCCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToPCCommandAsync()
+ //{
+ // await Navigation.PushAsync(new PlayerCharacter.PlayerCharacterEditorPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToDicesCommand
- {
- get
- {
- return new Command(async () => await ExecuteNavigateToDicesCommandAsync());
- }
- }
- private async Task ExecuteNavigateToDicesCommandAsync()
- {
- await Navigation.PushAsync(new DicesPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToDicesCommand
+ //{
+ // get
+ // {
+ // return new Command(async () => await ExecuteNavigateToDicesCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToDicesCommandAsync()
+ //{
+ // await Navigation.PushAsync(new DicesPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToBookmarksCommand
- {
- get
- {
- return new Command(async () => await ExecuteNavigateToBookmarksCommandAsync());
- }
- }
- private async Task ExecuteNavigateToBookmarksCommandAsync()
- {
- await Navigation.PushAsync(new Library.BookmarksPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToBookmarksCommand
+ //{
+ // get
+ // {
+ // return new Command(async () => await ExecuteNavigateToBookmarksCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToBookmarksCommandAsync()
+ //{
+ // await Navigation.PushAsync(new Library.BookmarksPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToDeepSearchCommand
- {
- get
- {
- return new Command(async () => await ExecuteNavigateToDeepSearchCommandAsync());
- }
- }
- private async Task ExecuteNavigateToDeepSearchCommandAsync()
- {
- await Navigation.PushAsync(new Library.DeepSearchPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToDeepSearchCommand
+ //{
+ // get
+ // {
+ // return new Command(async () => await ExecuteNavigateToDeepSearchCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToDeepSearchCommandAsync()
+ //{
+ // await Navigation.PushAsync(new Library.DeepSearchPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- public ICommand NavigateToAboutCommand
- {
- get
- {
- return new Command(async () => await ExecuteNavigateToAboutCommandAsync());
- }
- }
- private async Task ExecuteNavigateToAboutCommandAsync()
- {
- await Navigation.PushAsync(new AboutPage(), true);
- this.FlyoutIsPresented = false;
- }
+ //public ICommand NavigateToAboutCommand
+ //{
+ // get
+ // {
+ // return new Command(async () => await ExecuteNavigateToAboutCommandAsync());
+ // }
+ //}
+ //private async Task ExecuteNavigateToAboutCommandAsync()
+ //{
+ // await Navigation.PushAsync(new AboutPage(), true);
+ // this.FlyoutIsPresented = false;
+ //}
- private string _HeaderTitle = string.Empty;
- public string HeaderTitle
- {
- get
- {
- return _HeaderTitle;
- }
- set
- {
- SetProperty(ref _HeaderTitle, value);
- }
- }
- protected override void OnNavigated(ShellNavigatedEventArgs args)
- {
- base.OnNavigated(args);
- Debug.WriteLine(this.CurrentItem?.CurrentItem?.CurrentItem);
- HeaderTitle = this.CurrentItem?.CurrentItem?.CurrentItem?.Route;
- var content = this.CurrentItem?.CurrentItem?.CurrentItem?.Content;
- Debug.WriteLine(content);
+ //private string _HeaderTitle = string.Empty;
+ //public string HeaderTitle
+ //{
+ // get
+ // {
+ // return _HeaderTitle;
+ // }
+ // set
+ // {
+ // SetProperty(ref _HeaderTitle, value);
+ // }
+ //}
+ //protected override void OnNavigated(ShellNavigatedEventArgs args)
+ //{
+ // base.OnNavigated(args);
+ // Debug.WriteLine(this.CurrentItem?.CurrentItem?.CurrentItem);
+ // HeaderTitle = this.CurrentItem?.CurrentItem?.CurrentItem?.Route;
+ // var content = this.CurrentItem?.CurrentItem?.CurrentItem?.Content;
+ // Debug.WriteLine(content);
- this.CurrentItem.CurrentItem.CurrentItem.PropertyChanged += CurrentItem_PropertyChanged;
- this.CurrentItem.CurrentItem.CurrentItem.Appearing += CurrentItem_Appearing;
- this.CurrentItem.CurrentItem.CurrentItem.BindingContextChanged += CurrentItem_BindingContextChanged;
- }
+ // this.CurrentItem.CurrentItem.CurrentItem.PropertyChanged += CurrentItem_PropertyChanged;
+ // this.CurrentItem.CurrentItem.CurrentItem.Appearing += CurrentItem_Appearing;
+ // this.CurrentItem.CurrentItem.CurrentItem.BindingContextChanged += CurrentItem_BindingContextChanged;
+ //}
- private void CurrentItem_BindingContextChanged(object sender, EventArgs e)
- {
- Debug.WriteLine(e.ToString());
- }
+ //private void CurrentItem_BindingContextChanged(object sender, EventArgs e)
+ //{
+ // Debug.WriteLine(e.ToString());
+ //}
- private void CurrentItem_Appearing(object sender, EventArgs e)
- {
- Debug.WriteLine(e.ToString());
- }
+ //private void CurrentItem_Appearing(object sender, EventArgs e)
+ //{
+ // Debug.WriteLine(e.ToString());
+ //}
- private void CurrentItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- Debug.WriteLine(e.PropertyName);
- }
+ //private void CurrentItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ //{
+ // Debug.WriteLine(e.PropertyName);
+ //}
- protected bool SetProperty(ref T backingStore, T value,
- [CallerMemberName]string propertyName = "",
- Action onChanged = null)
- {
- if (EqualityComparer.Default.Equals(backingStore, value))
- return false;
+ //protected bool SetProperty(ref T backingStore, T value,
+ // [CallerMemberName]string propertyName = "",
+ // Action onChanged = null)
+ //{
+ // if (EqualityComparer.Default.Equals(backingStore, value))
+ // return false;
- backingStore = value;
- onChanged?.Invoke();
- CallOnPropertyChanged(propertyName);
- return true;
- }
+ // backingStore = value;
+ // onChanged?.Invoke();
+ // CallOnPropertyChanged(propertyName);
+ // return true;
+ //}
- #region INotifyPropertyChanged
- public event PropertyChangedEventHandler PropertyChanged;
- protected void CallOnPropertyChanged([CallerMemberName] string propertyName = "")
- {
- var changed = PropertyChanged;
- if (changed == null)
- return;
+ //#region INotifyPropertyChanged
+ //public event PropertyChangedEventHandler PropertyChanged;
+ //protected void CallOnPropertyChanged([CallerMemberName] string propertyName = "")
+ //{
+ // var changed = PropertyChanged;
+ // if (changed == null)
+ // return;
- changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- #endregion
+ // changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ //}
+ //#endregion
}
}
\ No newline at end of file