This commit is contained in:
Administrator 2018-10-01 11:35:19 +02:00
parent d7b793f296
commit df56e0405a
12 changed files with 286 additions and 5 deletions

23
ISET2018_WPF/Fen1.xaml Normal file
View File

@ -0,0 +1,23 @@
<Window x:Class="ISET2018_WPF.Fen1"
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:ISET2018_WPF"
mc:Ignorable="d"
Title="Fen1" Height="450" Width="800">
<StackPanel>
<WrapPanel Margin="5">
<!--2h05-->
<TextBlock Text="Titre : "/>
<TextBox Width="150" Text="{Binding Title, UpdateSourceTrigger=PropertyChanged}" />
</WrapPanel>
<WrapPanel Margin="5">
<!--2h05-->
<TextBlock Text="Dimension : "/>
<TextBox Width="150" Text="{Binding Width}" />
<TextBlock Text="x"/>
<TextBox Width="150" Text="{Binding Height}" />
</WrapPanel>
</StackPanel>
</Window>

28
ISET2018_WPF/Fen1.xaml.cs Normal file
View File

@ -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.Shapes;
namespace ISET2018_WPF
{
/// <summary>
/// Logique d'interaction pour Fen1.xaml
/// </summary>
public partial class Fen1 : Window
{
public Fen1()
{
InitializeComponent();
DataContext = this;
}
}
}

34
ISET2018_WPF/Fen2.xaml Normal file
View File

@ -0,0 +1,34 @@
<Window x:Class="ISET2018_WPF.Fen2"
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:ISET2018_WPF"
mc:Ignorable="d"
Title="Fen2" Height="450" Width="800">
<Grid>
<Grid.Resources>
<!--2h30-->
<RotateTransform x:Key="Rota" Angle="0"/>
<local:Degre2Radian x:Key="Convertisseur" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="Red" Width="100" Height="50" >
<Rectangle.RenderTransform>
<RotateTransform Angle="{Binding ElementName=Barre, Path=Value}"
CenterX="50" CenterY="25" />
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle Fill="Yellow" Width="50" Height="100" LayoutTransform="{StaticResource Rota}" />
<Slider Name="Barre" Grid.Row="1" Minimum="0" Maximum="360" Value="{Binding Source={StaticResource Rota}, Path=Angle}" />
<TextBox Grid.Row="2" TextAlignment="Center" Text="{Binding ElementName=Barre, Path=Value, Converter={StaticResource Convertisseur}}" />
<TextBox Grid.Row="3" TextAlignment="Center" Text="{Binding Source={StaticResource Rota}, Path=Angle, Converter={StaticResource Convertisseur}}" />
<!--2h55-->
</Grid>
</Window>

47
ISET2018_WPF/Fen2.xaml.cs Normal file
View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Globalization;
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 ISET2018_WPF
{
/// <summary>
/// Logique d'interaction pour Fen2.xaml
/// </summary>
public partial class Fen2 : Window
{
public Fen2()
{
InitializeComponent();
}
}
public class Degre2Radian : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (double)value * Math.PI / 180;
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double angle = 0;
if(double.TryParse(value.ToString(), out angle))
{
if (angle < 0) angle = 0;
else if (angle > 2 * Math.PI) angle = 2 * Math.PI;
}
return angle*180/Math.PI;
}
}
}

12
ISET2018_WPF/Fen3.xaml Normal file
View File

@ -0,0 +1,12 @@
<Window x:Class="ISET2018_WPF.Fen3"
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:ISET2018_WPF"
mc:Ignorable="d"
Title="Fen3" Height="450" Width="800">
<Grid>
</Grid>
</Window>

27
ISET2018_WPF/Fen3.xaml.cs Normal file
View File

@ -0,0 +1,27 @@
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 ISET2018_WPF
{
/// <summary>
/// Logique d'interaction pour Fen3.xaml
/// </summary>
public partial class Fen3 : Window
{
public Fen3()
{
InitializeComponent();
}
}
}

View File

@ -55,6 +55,18 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Fen1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Fen2.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Fen3.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -63,6 +75,15 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Fen1.xaml.cs">
<DependentUpon>Fen1.xaml</DependentUpon>
</Compile>
<Compile Include="Fen2.xaml.cs">
<DependentUpon>Fen2.xaml</DependentUpon>
</Compile>
<Compile Include="Fen3.xaml.cs">
<DependentUpon>Fen3.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
@ -95,7 +116,14 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\IMG_20180804_110221_146.jpg" />
<None Include="Resources\IMG_20180804_110221_146.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Resources\IMG_20180804_132307_561.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ISET2018_WPF"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="75" />
@ -25,8 +25,37 @@
</TextBlock.Effect>
</TextBlock>
<Button Content="C L I C" Grid.Column="1" Width="75" Height="25" VerticalAlignment="Top" Margin="10" Name="btnClic" Click="btnClic_Click"/>
<Image Source="pack://siteforigin:,,,\Resources\IMG_20180804_110221_146.jpg" Grid.Row="1"
Width="100" Height="70" Stretch="Uniform" Name="ImgYeti"/>
<Image Grid.Row="1"
Width="100" Height="70" Stretch="Uniform" Name="ImgYeti" Source="pack://siteoforigin:,,,/Resources/IMG_20180804_110221_146.jpg">
<Image.RenderTransform>
<RotateTransform Angle="0" CenterX="50" CenterY="35"/>
</Image.RenderTransform>
</Image>
<Rectangle Grid.Row="1" Grid.Column="1" Width="100" Height="80" Fill="BlueViolet"
Stroke="Cyan" StrokeThickness="10" RadiusX="25" RadiusY="15"/>
<Ellipse Grid.Row="1" Grid.Column="1" Width="120" Height="30" Fill="Olive"
Stroke="Orange" StrokeThickness="3" Opacity="0.7" Panel.ZIndex="2"/>
<Polygon Grid.Row="1" Grid.Column="1" Points="10,15,140,15,75,80" Fill="Orange"
Opacity="0.4" />
<Button Grid.RowSpan="2" Grid.Column="2" Background="Fuchsia" Name="btnSsBouton" Margin="0,20,10,0" Click="btnSsBouton_Click">
<StackPanel Orientation="Vertical">
<TextBlock Foreground="Brown" Background="White" FontSize="16" HorizontalAlignment="Center">!!!ORIGINAL!!!</TextBlock>
<Image Source="pack://siteoforigin:,,,/Resources/IMG_20180804_132307_561.jpg" Stretch="UniformToFill" Height="71" Width="169" />
<Button Name="BtnSrBtn" Content="P'tit Bouton" Click="btnSsBouton_Click" />
</StackPanel>
</Button>
<ListBox Name="lbQualite" Grid.Row="3" Grid.Column="1" Width="120" SelectionChanged="lbQualite_SelectionChanged">
<ListBoxItem>Mademoiselle</ListBoxItem>
<ListBoxItem>Madame</ListBoxItem>
<ListBoxItem>Mondamoiseau</ListBoxItem>
<ListBoxItem>Monsieur</ListBoxItem>
<ListBoxItem>Indéfini</ListBoxItem>
</ListBox>
<StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="3">
<Button Name="btnFen1" Content="Fenetre 1" Margin="5" Click="btnFen_Click"/>
<Button Name="btnFen2" Content="Fenetre 2" Margin="5" Click="btnFen_Click"/>
<Button Name="btnFen3" Content="Fenetre 3" Margin="5" Click="btnFen_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -33,5 +33,45 @@ namespace ISET2018_WPF
btnClic.BeginAnimation(Button.OpacityProperty, da);
MessageBox.Show("!!HELLO WORLD!!");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
DoubleAnimation da = new DoubleAnimation(0, -360, new Duration(TimeSpan.FromSeconds(3)));
da.RepeatBehavior = RepeatBehavior.Forever;
ImgYeti.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, da);
}
private void btnSsBouton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Click sur " + ((Button)sender).Name);
}
private void lbQualite_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ListBoxItem lb = (ListBoxItem)((ListBox)sender).SelectedItem;
MessageBox.Show(lb.Content.ToString());
}
private void btnFen_Click(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
Window w = new Window();
w.Name = "fake";
w.Close();
switch(btn.Name)
{
case "btnFen1":
w = new Fen1();
break;
case "btnFen2":
w = new Fen2();
break;
case "btnFen3":
w = new Fen3();
break;
}
w.ShowDialog();
}
}
}

View File

@ -69,5 +69,15 @@ namespace ISET2018_WPF.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap IMG_20180804_132307_561 {
get {
object obj = ResourceManager.GetObject("IMG_20180804_132307_561", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -121,4 +121,7 @@
<data name="IMG_20180804_110221_146" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\IMG_20180804_110221_146.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="IMG_20180804_132307_561" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\IMG_20180804_132307_561.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB