test de différent fonc pour améliorer la vue. séparation de la page de connexion dans trois différents UC pour faciliter la vue
continuous-integration/drone/push Build is passing Details

Navigator
Vincent ASTOLFI 2 years ago
parent f9a409f010
commit 56467f1ae4

@ -9,9 +9,26 @@
<conv:Func2WindowPartConverter x:Key="Func2WpConv"/>
<Style x:Key="BorderRessource" TargetType="Border">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#63A4FF"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="20"/>
<Setter Property="CornerRadius" Value="5"/>
</Style>
<Style TargetType="UserControl" x:Key="ImageFondRessource">
<Setter Property="Background">
<Setter.Value>
<VisualBrush>
<VisualBrush.Visual>
<Image Source="./images/fond2.png">
<Image.Effect>
<BlurEffect Radius="0"/>
</Image.Effect>
</Image>
</VisualBrush.Visual>
</VisualBrush>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TextBlockRessource" TargetType="TextBlock">
@ -19,18 +36,36 @@
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="TransparentButtonRessource" TargetType="Button">
<Style TargetType="Button" x:Key="TransparentButtonRessource">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="5" Background="Transparent" BorderBrush="#63A4FF" BorderThickness="1" >
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="GreenButtonRessource" TargetType="Button">
<Setter Property="Background" Value="#7FB196"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="5" BorderBrush="#63A4FF" BorderThickness="1" >
<Border.Background>
<LinearGradientBrush>
<GradientStop Color="#80FF72" Offset="0"/>
<GradientStop Color="#7EE8FA" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>

@ -8,10 +8,18 @@
</PropertyGroup>
<ItemGroup>
<None Remove="images\fond.jpg" />
<None Remove="images\fond2.png" />
<None Remove="images\logo.png" />
</ItemGroup>
<ItemGroup>
<Content Include="images\fond.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\fond2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="images\logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

@ -18,7 +18,9 @@ namespace IHM
public const string PART_PLANNIFICATION = "Plannification";
public const string PART_STATISTIQUE = "Statistique";
public const string PART_MAIN = "Main";
public const string PART_CONNEXION = "Connexion";
public const string PART_INSCRIPTION = "Inscription";
public ReadOnlyDictionary<string, Func<UserControl>> WindowPart { get; private set; }
@ -31,17 +33,26 @@ namespace IHM
// [PART_STATISTIQUE] = () => new UCStatistique(),
};
public ReadOnlyDictionary<string, Func<UserControl>> WindowPartMain { get; private set; }
Dictionary<string, Func<UserControl>> windowPartMain { get; set; } = new Dictionary<string, Func<UserControl>>
{
[PART_CONNEXION] = () => new UCConnexion(),
[PART_INSCRIPTION] = () => new UCInscription(),
};
public ReadOnlyDictionary<string, Func<UserControl>> WindowMain { get; private set; }
Dictionary<string, Func<UserControl>> windowMain { get; set; } = new Dictionary<string, Func<UserControl>>
{
[PART_CONNEXION] = () => new UCConnexion(),
[PART_MAIN] = () => new UCBienvenue(),
};
public Navigator()
{
WindowPart = new ReadOnlyDictionary<string, Func<UserControl>>(windowPart);
WindowMain = new ReadOnlyDictionary<string, Func<UserControl>>(windowMain);
WindowPartMain = new ReadOnlyDictionary<string, Func<UserControl>>(windowPartMain);
SelectedUserControlCreator = windowMain.First();
}
@ -63,12 +74,26 @@ namespace IHM
void OnPropertyChanged([CallerMemberName] string propertyName = "")
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void NavigateTo(string windowPartName)
public void NavigateTo(string windowPartName, string? windowPartNameScd=default)
{
if (WindowPart.ContainsKey(windowPartName))
{
selectedUserControlCreator = WindowPart.Single(kvp => kvp.Key == windowPartName);
}
if (windowPartNameScd == default) return;
else NavigateToEx(windowPartNameScd);
}
public void NavigateToEx(string windowPartName)
{
if (WindowPartMain.ContainsKey(windowPartName))
{
SelectedUserControlCreator = WindowPartMain.Single(kvp => kvp.Key == windowPartName);
}
if (WindowMain.ContainsKey(windowPartName))
{
SelectedUserControlCreator = WindowMain.Single(kvp => kvp.Key == windowPartName);
}
}
}
}

@ -0,0 +1,42 @@
<UserControl x:Class="IHM.UCBienvenue"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:IHM"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Style="{StaticResource ImageFondRessource}">
<DockPanel>
<TextBlock Text="Bienvenue sur Cons'Eco" DockPanel.Dock="Top" Foreground="White" HorizontalAlignment="Center" FontSize="28" Margin="20"/>
<Image Source="./images/logo.png" DockPanel.Dock="Top" Height="100" />
<TextBlock Foreground="Black" FontSize="15" HorizontalAlignment="Center" DockPanel.Dock="Top">
La première application d'aide à la gestion de budget personnel ou en entreprise
</TextBlock>
<Grid DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Margin="50" FontSize="15">
Vous pouvez créer un compte
</TextBlock>
<Button Click="Button_Click_Inscription" Style="{StaticResource GreenButtonRessource}" Height="30" Width="100">
<TextBlock Text="Inscription"/>
</Button>
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock HorizontalAlignment="Center" Margin="50" FontSize="15">
Ou vous connecter si vous en possédée déjà un
</TextBlock>
<Button Click="Button_Click_Connexion" Style="{StaticResource GreenButtonRessource}" Height="30" Width="100">
<TextBlock Text="Connexion"/>
</Button>
</StackPanel>
</Grid>
</DockPanel>
</UserControl>

@ -0,0 +1,40 @@
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.Navigation;
using System.Windows.Shapes;
namespace IHM
{
/// <summary>
/// Logique d'interaction pour UCBienvenue.xaml
/// </summary>
public partial class UCBienvenue : UserControl
{
public Navigator Nav => (App.Current as App).Navigator;
public UCBienvenue()
{
InitializeComponent();
DataContext = this;
}
private void Button_Click_Inscription(object sender, RoutedEventArgs e)
{
Nav.NavigateTo(Navigator.PART_MAIN, Navigator.PART_INSCRIPTION);
}
private void Button_Click_Connexion(object sender, RoutedEventArgs e)
{
Nav.NavigateTo(Navigator.PART_MAIN, Navigator.PART_CONNEXION);
}
}
}

@ -5,68 +5,21 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:IHM"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
Style="{StaticResource ImageFondRessource}">
<DockPanel>
<DockPanel Background="#F2C98C">
<Border DockPanel.Dock="Top" Style="{StaticResource BorderRessource}">
<Border.Background>White</Border.Background>
<TextBlock Text="Login" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderRessource}">
<StackPanel>
<Border Style="{StaticResource BorderRessource}">
<TextBlock Text="Connexion" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderRessource}">
<TextBlock Text="Nom d'utilisateur" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
</Border>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderRessource}">
<TextBlock Text="Mot de passe" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
</Border>
</Grid>
<Button Style="{StaticResource TransparentButtonRessource}" Margin="20" Width="200">
<TextBlock Text="Mot de passe oubliée ?" Style="{StaticResource TextBlockRessource}"/>
<Button Click="Button_Click_Acceuil" Margin="20" DockPanel.Dock="Bottom" Style="{StaticResource GreenButtonRessource}">
<TextBlock Text="Retour à la page d'acceuil"/>
</Button>
<Button Style="{StaticResource GreenButtonRessource}" Height="25" Width="150">
<TextBlock Text="Valider" Style="{StaticResource TextBlockRessource}"/>
</Button>
</StackPanel>
</Border>
<Border DockPanel.Dock="Right" Style="{StaticResource BorderRessource}">
</Border>
<Border Style="{StaticResource BorderRessource}" Grid.Column="1">
<Border.Background>#DF775C</Border.Background>
<StackPanel>
<Border Style="{StaticResource BorderRessource}">
<TextBlock Text="Inscription" Style="{StaticResource TextBlockRessource}"/>
@ -88,35 +41,65 @@
<TextBlock Text="Nom d'utilisateur" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
<TextBox>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</TextBox.Resources>
</TextBox>
</Border>
<Border Style="{StaticResource BorderRessource}" Grid.Row="1">
<TextBlock Text="Nom" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Grid.Row="1" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
<TextBox>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</TextBox.Resources>
</TextBox>
</Border>
<Border Grid.Row="2" Style="{StaticResource BorderRessource}" >
<TextBlock Text="Prenom" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Grid.Row="2" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
<TextBox>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</TextBox.Resources>
</TextBox>
</Border>
<Border Grid.Row="3" Style="{StaticResource BorderRessource}" >
<TextBlock Text="Mail" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Grid.Row="3" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
<TextBox>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</TextBox.Resources>
</TextBox>
</Border>
<Border Grid.Row="4" Style="{StaticResource BorderRessource}" >
<TextBlock Text="Mot de passe" Style="{StaticResource TextBlockRessource}"/>
</Border>
<Border Grid.Column="1" Grid.Row="4" Style="{StaticResource BorderRessource}">
<TextBox></TextBox>
<TextBox>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</TextBox.Resources>
</TextBox>
</Border>
</Grid>
@ -126,7 +109,8 @@
</StackPanel>
</Border>
</Grid>
</DockPanel>

@ -20,9 +20,16 @@ namespace IHM
/// </summary>
public partial class UCConnexion : UserControl
{
public Navigator Nav => (App.Current as App).Navigator;
public UCConnexion()
{
InitializeComponent();
}
private void Button_Click_Acceuil(object sender, RoutedEventArgs e)
{
Nav.NavigateTo(Navigator.PART_CONNEXION, Navigator.PART_MAIN);
}
}
}

@ -0,0 +1,13 @@
<UserControl x:Class="IHM.UCInscription"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:IHM"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Background="DarkSalmon">
<Grid>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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.Navigation;
using System.Windows.Shapes;
namespace IHM
{
/// <summary>
/// Logique d'interaction pour UCInscription.xaml
/// </summary>
public partial class UCInscription : UserControl
{
public UCInscription()
{
InitializeComponent();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Loading…
Cancel
Save