1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Nettoyage + recablage filtre de recherche

This commit is contained in:
Yan Maniez 2019-10-14 15:20:26 +02:00
parent d0701dc686
commit 383e19d144
5 changed files with 19 additions and 222 deletions

View file

@ -1,6 +1,4 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views

View file

@ -27,14 +27,16 @@
<ToolbarItem Name="Speak" Text="Écouter / Arrêter" Order="Secondary" Icon="scroll_unfurled.png" Command="{Binding Main.Speech.SpeakItemCommand, Mode=OneTime}" CommandParameter="{Binding Item}" />
</ContentPage.ToolbarItems>
<Grid>
<!--<ScrollView Orientation="Vertical" BackgroundColor="{StaticResource HDWhite}">
<mdview:MarkdownView
Theme="{StaticResource MonsterMarkdownTheme}"
Markdown="{Binding Item.Item.Markdown}"
NavigateToLinkCommand="{Binding Main.Navigator.NavigateToLinkCommand}"
/>
</ScrollView>-->
<ListView Grid.Column="0" Grid.Row="0" x:Name="ItemsListView" ItemsSource="{Binding Children}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<SearchBar Grid.Column="0" Grid.Row="0" x:Name="SearchBar" IsVisible="{Binding Filter, Converter={StaticResource NullToFalseConverter}, Mode=OneWay}" HeightRequest="42" SearchCommand="{Binding SearchCommand}" SearchCommandParameter="{Binding Text, Source={x:Reference SearchBar}}">
<SearchBar.Behaviors>
<tools:TextChangedBehavior />
</SearchBar.Behaviors>
</SearchBar>
<ListView Grid.Column="0" Grid.Row="1" x:Name="ItemsListView" ItemsSource="{Binding Children}" VerticalOptions="FillAndExpand" HasUnevenRows="true" CachingStrategy="RecycleElement" SelectedItem="{Binding SelectedItem}" ItemTapped="ItemsListView_ItemTapped">
<ListView.Header>
<mdview:MarkdownView
Theme="{StaticResource MonsterMarkdownTheme}"
@ -54,6 +56,7 @@
</ListView.ItemTemplate>
</ListView>
<ActivityIndicator
Grid.RowSpan="2"
VerticalOptions="StartAndExpand"
HorizontalOptions="End"
Color="{StaticResource HDRed}"

View file

@ -1,16 +1,4 @@

using AideDeJeu.ViewModels;
using AideDeJeu.ViewModels.Library;
using AideDeJeuLib;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AideDeJeu.ViewModels.Library;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -20,7 +8,7 @@ namespace AideDeJeu.Views.Library
[QueryProperty("Path", "path")]
public partial class ItemPage : ContentPage
{
public ItemViewModel Item
public ItemViewModel BindingItem
{
get
{
@ -48,13 +36,13 @@ namespace AideDeJeu.Views.Library
protected override void OnAppearing()
{
base.OnAppearing();
Item.Main.CurrentItem = Item;
BindingItem.Main.CurrentItem = BindingItem;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
Item.Main.CurrentItem = null;
BindingItem.Main.CurrentItem = null;
}
private string _Path { get; set; } = null; //"index.md";
public string Path
@ -68,7 +56,7 @@ namespace AideDeJeu.Views.Library
_Path = value;
if (Path != null)
{
Item?.LoadPageAsync(Path);
BindingItem?.LoadPageAsync(Path);
}
}
}

View file

@ -1,11 +1,4 @@
using AideDeJeu.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views
@ -13,18 +6,9 @@ namespace AideDeJeu.Views
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainPage : ContentPage
{
//public MainViewModel Main
//{
// get
// {
// return DependencyService.Get<MainViewModel>();
// }
//}
public MainPage ()
{
InitializeComponent ();
//BindingContext = this;
}
}
}

View file

@ -1,14 +1,4 @@
using AideDeJeu.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AideDeJeu.Views
@ -19,172 +9,6 @@ namespace AideDeJeu.Views
public MainShell()
{
InitializeComponent();
//BindingContext = this;
}
//public MainViewModel Main
//{
// get
// {
// return DependencyService.Get<MainViewModel>();
// }
//}
//public ICommand NavigateToItemCommand
//{
// get
// {
// return new Command<string>(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 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 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 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);
// 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_Appearing(object sender, EventArgs e)
//{
// Debug.WriteLine(e.ToString());
//}
//private void CurrentItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
//{
// Debug.WriteLine(e.PropertyName);
//}
//protected bool SetProperty<T>(ref T backingStore, T value,
// [CallerMemberName]string propertyName = "",
// Action onChanged = null)
//{
// if (EqualityComparer<T>.Default.Equals(backingStore, value))
// return false;
// 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;
// changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
//}
//#endregion
}
}