Последняя лаба

This commit is contained in:
Никита Потапов 2024-04-11 12:52:37 +04:00
parent 2e0c6e46a7
commit 448bad8982
7 changed files with 89 additions and 9 deletions

View File

@ -13,6 +13,7 @@
<None Remove="static\images\kachel.jpg" />
<None Remove="static\images\karusel.jpeg" />
<None Remove="static\images\korable.jpg" />
<None Remove="static\videos\zmey-sochi.mp4" />
</ItemGroup>
<ItemGroup>
@ -33,4 +34,10 @@
</Content>
</ItemGroup>
<ItemGroup>
<Resource Include="static\videos\zmey-sochi.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>

View File

@ -24,7 +24,7 @@
<SolidColorBrush
x:Key="controlSolidBrush"
Color="{StaticResource whiteColor}"/>
<Style x:Key="ScaleOnMouse" TargetType="Image">
<Style x:Key="ScaleOnMouse" TargetType="Button">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="Width" Value="{Binding ActualWidth}"/>
<Setter Property="Height" Value="{Binding ActualHeight}"/>
@ -142,6 +142,7 @@
TextWrapping="Wrap"
HorizontalContentAlignment="Right"
VerticalContentAlignment="Center"
MinWidth="50"
Background="{StaticResource controlSolidBrush}"/>
</StackPanel>
@ -163,10 +164,18 @@
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="static\images\american_gorki.jpg" Grid.Row="1" Grid.Column="0" Style="{StaticResource ScaleOnMouse}" Stretch="Fill"/>
<Image Source="static\images\cepnoy.jpg" Grid.Row="1" Grid.Column="1" Style="{StaticResource ScaleOnMouse}" Stretch="Fill"/>
<Image Source="static\images\kachel.jpg" Grid.Row="2" Grid.Column="0" Style="{StaticResource ScaleOnMouse}" Stretch="Fill"/>
<Image Source="static\images\korable.jpg" Grid.Row="2" Grid.Column="1" Style="{StaticResource ScaleOnMouse}" Stretch="Fill"/>
<Button Click="AmericanButtonClick" Style="{StaticResource ScaleOnMouse}" Grid.Row="1" Grid.Column="0">
<Image Source="static\images\american_gorki.jpg" Stretch="Fill"/>
</Button>
<Button Click="AmericanButtonClick" Style="{StaticResource ScaleOnMouse}" Grid.Row="1" Grid.Column="1">
<Image Source="static\images\cepnoy.jpg" Stretch="Fill"/>
</Button>
<Button Click="AmericanButtonClick" Style="{StaticResource ScaleOnMouse}" Grid.Row="2" Grid.Column="0">
<Image Source="static\images\kachel.jpg" Stretch="Fill"/>
</Button>
<Button Click="AmericanButtonClick" Style="{StaticResource ScaleOnMouse}" Grid.Row="2" Grid.Column="1">
<Image Source="static\images\korable.jpg" Stretch="Fill"/>
</Button>
</Grid>
</ScrollViewer>

View File

@ -1,5 +1,7 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace Lunapark
{
@ -23,5 +25,21 @@ namespace Lunapark
windowBuyTickets.Show();
}
}
private void PlayVideo(string path)
{
MediaElement mediaElement = new MediaElement();
WindowVideoPlayer windowVideoPlayer = new WindowVideoPlayer();
windowVideoPlayer.VideoElement.Child = mediaElement;
mediaElement.Source = new Uri(path);
mediaElement.Stretch = Stretch.Fill;
mediaElement.LoadedBehavior = MediaState.Manual;
windowVideoPlayer.Show();
mediaElement.Play();
}
private void AmericanButtonClick(object sender, RoutedEventArgs e)
{
string path = "C:\\Users\\ns.potapov\\source\\repos\\TSCHMI_Potapov\\Lunapark\\Lunapark\\static\\videos\\zmey-sochi.mp4";
PlayVideo(path);
}
}
}

View File

@ -5,7 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Lunapark"
mc:Ignorable="d"
Title="Поздравляем!" Height="200" Width="300" Background="LightGreen">
Title="Поздравляем!" Height="200" Width="300" Background="LightGreen"
ResizeMode="NoResize">
<Grid>
<Label Content="Поздравляем!" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top"/>
<Label Content="Вы купили билеты на" HorizontalAlignment="Center" Margin="0,41,0,0" VerticalAlignment="Top"/>

View File

@ -0,0 +1,18 @@
<Window x:Class="Lunapark.WindowVideoPlayer"
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:Lunapark"
mc:Ignorable="d"
Title="WindowVideoPlayer" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="VideoElement" Grid.Column="0" Grid.Row="0"/>
</Grid>
</Window>

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 Lunapark
{
/// <summary>
/// Логика взаимодействия для WindowVideoPlayer.xaml
/// </summary>
public partial class WindowVideoPlayer : Window
{
public WindowVideoPlayer()
{
InitializeComponent();
}
}
}

Binary file not shown.