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

Refonte main page

This commit is contained in:
Yan Maniez 2019-03-04 23:37:01 +01:00
parent 8ad104f5d5
commit 68dee142af
7 changed files with 125 additions and 13 deletions

View file

@ -24,6 +24,8 @@ namespace AideDeJeu.Droid
global::Xamarin.Forms.Forms.Init(this, bundle);
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());
Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
LoadApplication(new App());
}

View file

@ -26,6 +26,8 @@ namespace AideDeJeu.iOS
global::Xamarin.Forms.Forms.Init();
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
LoadApplication(new App());
return base.FinishedLaunching(app, options);

View file

@ -87,6 +87,9 @@
<EmbeddedResource Update="Views\MainNavigationPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\MainPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Views\MainTabbedPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>

View file

@ -20,19 +20,23 @@ namespace AideDeJeu
DependencyService.Register<BookmarksViewModel>();
DependencyService.Register<StoreViewModel>();
var vm = DependencyService.Get<MainViewModel>();
MainPage = new PlayerCharacterEditorPage();
return;
var tabbeddPage = new AideDeJeu.Views.MainTabbedPage();
//var mainPage = new ItemDetailPage(new ItemDetailViewModel(new HomeItem()) { Title = "Haches & Dés" });
var titlered = (Color)Resources["HDRed"];
var bgtan = (Color)Resources["HDWhite"];
//var navigationPage = new MainNavigationPage(mainPage) { BarBackgroundColor = titlered, BarTextColor = bgtan };
//tabbeddPage.MainNavigationPage = navigationPage;
var navigationPage = tabbeddPage.MainNavigationPage;
vm.Navigator = new Navigator(navigationPage.Navigation);
MainPage = tabbeddPage;
var mainNavigationPage = new MainNavigationPage();
//MainPage = new PlayerCharacterEditorPage();
//MainPage = new MainPage();
//var tabbeddPage = new AideDeJeu.Views.MainTabbedPage();
//var navigationPage = tabbeddPage.MainNavigationPage;
vm.Navigator = new Navigator(mainNavigationPage.Navigation);
MainPage = mainNavigationPage;
mainNavigationPage.Navigation.PushAsync(new MainPage());
}

View file

@ -39,6 +39,50 @@ namespace AideDeJeu.ViewModels
await Navigation.PushAsync(new Views.AboutPage());
}
private Command _LibraryCommand = null;
public Command LibraryCommand
{
get
{
return _LibraryCommand ?? (_LibraryCommand = new Command(async () => await GotoLibraryPageAsync()));
}
}
public async Task GotoLibraryPageAsync()
{
await Navigation.PushAsync(new Views.ItemDetailPage());
}
private Command _BookmarksCommand = null;
public Command BookmarksCommand
{
get
{
return _BookmarksCommand ?? (_BookmarksCommand = new Command(async () => await GotoBookmarksPageAsync()));
}
}
public async Task GotoBookmarksPageAsync()
{
await Navigation.PushAsync(new Views.BookmarksPage());
}
private Command _PlayerCharacterEditorCommand = null;
public Command PlayerCharacterEditorCommand
{
get
{
return _PlayerCharacterEditorCommand ?? (_PlayerCharacterEditorCommand = new Command(async () => await GotoPlayerCharacterEditorPageAsync()));
}
}
public async Task GotoPlayerCharacterEditorPageAsync()
{
await Navigation.PushAsync(new Views.PlayerCharacterEditorPage());
}
private Command _DeepSearchCommand = null;
public Command DeepSearchCommand
{
@ -119,8 +163,11 @@ namespace AideDeJeu.ViewModels
public void SwitchToMainTab()
{
var tabbedPage = App.Current.MainPage as MainTabbedPage;
tabbedPage.SelectedItem = null;
tabbedPage.SelectedItem = tabbedPage.MainNavigationPage;
if (tabbedPage != null)
{
tabbedPage.SelectedItem = null;
tabbedPage.SelectedItem = tabbedPage.MainNavigationPage;
}
}
public async Task GotoItemsPageAsync(ItemsViewModel itemsVM)

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AideDeJeu.Views.MainPage">
<ContentPage.Content>
<!--<CollectionView ItemsSource="{Binding tralala}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="2" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
</CollectionView.ItemTemplate>
</CollectionView>-->
<ScrollView>
<FlexLayout Wrap="Wrap" JustifyContent="SpaceEvenly">
<ImageButton Source="battle_axe.png" Command="{Binding Main.Navigator.PlayerCharacterEditorCommand}"/>
<ImageButton Source="spell_book.png" Command="{Binding Main.Navigator.LibraryCommand}" />
<ImageButton Source="stars_stack.png" Command="{Binding Main.Navigator.BookmarksCommand}" />
<ImageButton Source="crystal_ball.png" Command="{Binding Main.Navigator.DeepSearchCommand}" />
<ImageButton Source="wooden_sign.png" Command="{Binding Main.Navigator.AboutCommand}" />
</FlexLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,30 @@
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.Xaml;
namespace AideDeJeu.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainPage : ContentPage
{
public MainViewModel Main
{
get
{
return DependencyService.Get<MainViewModel>();
}
}
public MainPage ()
{
InitializeComponent ();
BindingContext = this;
}
}
}