ADD : Page Accueil + Navigation + Ballons

begin_project_view
Lou BRODA 1 year ago
parent 136adc749e
commit 30b14882d5

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PenaltyMaster3000"
StartupUri="View/MainView.xaml">
StartupUri="View/StartView.xaml">
<Application.Resources>
</Application.Resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PenaltyMaster3000.Navigation
{
public interface INavigationService
{
void NavigateTo(string pageKey);
}
}

@ -0,0 +1,34 @@
using PenaltyMaster3000.View;
using PenaltyMaster3000.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PenaltyMaster3000.Navigation
{
public class NavigationService : INavigationService
{
private readonly StartView _startView;
public NavigationService(StartView startView)
{
_startView = startView;
}
public void NavigateTo(string pageKey)
{
switch(pageKey)
{
case "MainView":
MainView mainView = new MainView();
_startView.Content = mainView;
break;
default:
throw new ArgumentException($"PageKey {pageKey} non prise en charge.");
}
}
}
}

@ -87,10 +87,16 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Navigation\INavigationService.cs" />
<Compile Include="Navigation\NavigationService.cs" />
<Compile Include="ViewModel\MainVM.cs" />
<Compile Include="ViewModel\StartVM.cs" />
<Compile Include="View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
<Compile Include="View\StartView.xaml.cs">
<DependentUpon>StartView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -134,10 +140,20 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\StartView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\goal_background.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\whistle.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\football_ball.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CommunityToolkit.Mvvm.8.2.2\build\netstandard2.0\CommunityToolkit.Mvvm.targets" Condition="Exists('..\packages\CommunityToolkit.Mvvm.8.2.2\build\netstandard2.0\CommunityToolkit.Mvvm.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

@ -1,11 +1,11 @@
<Window x:Class="PenaltyMaster3000.View.MainView"
<UserControl x:Class="PenaltyMaster3000.View.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PenaltyMaster3000.View"
mc:Ignorable="d"
Title="MainView" Height="450" Width="800">
Height="Auto" Width="Auto">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/Images/goal_background.jpg"
@ -28,31 +28,85 @@
Grid.RowSpan="2"
Grid.Column="0"
Visibility="Hidden"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Visibility="Hidden"/>
<Image Source="/Images/goalkeeper_top_middle.png"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Visibility="Hidden"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Visibility="Hidden"/>
<Image Source="/Images/goalkeeper_top_left.png"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="2"
Visibility="Hidden"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="2"
Visibility="Hidden"/>
<Image Source="/Images/goalkeeper_down_right.png"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="0"
Visibility="Hidden"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="0"
Visibility="Hidden"/>
<Image Source="{Binding CurrentImageSource}"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="1"/>
Grid.Column="1"
Visibility="Visible"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="1"
Visibility="Hidden"/>
<Image Source="/Images/goalkeeper_down_left.png"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="2"
Visibility="Hidden"/>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="2"
Visibility="Hidden"/>
</Grid>
<Image Source="/Images/football_ball.png"
Width="50"
Height="50"
VerticalAlignment="Bottom"
Visibility="Visible"/>
</Grid>
</Window>
</UserControl>

@ -18,7 +18,7 @@ namespace PenaltyMaster3000.View
/// <summary>
/// Logique d'interaction pour MainView.xaml
/// </summary>
public partial class MainView : Window
public partial class MainView : UserControl
{
public MainVM MainVM { get; set; }

@ -0,0 +1,39 @@
<Window x:Class="PenaltyMaster3000.View.StartView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PenaltyMaster3000.View"
mc:Ignorable="d"
Title="StartView" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="PENALTY MASTER"
FontSize="40"
FontWeight="Bold"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Grid.Row="0"/>
<Border Width="400"
Height="100"
BorderBrush="#FF2196F3"
BorderThickness="2"
CornerRadius="10"
Padding="5"
Grid.Row="1">
<Button Width="400"
Height="100"
Content="Start"
FontSize="30"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#FF2196F3"
Foreground="White"
BorderThickness="0"
Command="{Binding StartCommand}"/>
</Border>
</Grid>
</Window>

@ -0,0 +1,34 @@
using PenaltyMaster3000.Navigation;
using PenaltyMaster3000.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PenaltyMaster3000.View
{
/// <summary>
/// Logique d'interaction pour StartView.xaml
/// </summary>
public partial class StartView : Window
{
public StartVM StartVM { get; set; }
public StartView()
{
var navigationService = new NavigationService(this);
StartVM = new StartVM(navigationService);
InitializeComponent();
DataContext = StartVM;
}
}
}

@ -0,0 +1,32 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using PenaltyMaster3000.Navigation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Navigation;
namespace PenaltyMaster3000.ViewModel
{
public class StartVM : ObservableObject
{
private readonly INavigationService _navigationService;
public ICommand StartCommand { get; set; }
public StartVM(INavigationService navigationService)
{
_navigationService = navigationService;
StartCommand = new RelayCommand(Start);
}
private void Start()
{
_navigationService.NavigateTo("MainView");
}
}
}
Loading…
Cancel
Save