Compare commits

..

7 Commits
main ... Lab6

Author SHA1 Message Date
nikbel2004@outlook.com
0c6c75b191 Лабораторная работа 6 2024-04-08 16:04:03 +04:00
nikbel2004@outlook.com
07f331ec78 Лабораторная работа 5 2024-04-08 15:35:44 +04:00
nikbel2004@outlook.com
f9cea4042e Лабораторная работа 4 2024-04-05 12:04:33 +04:00
nikbel2004@outlook.com
38d99503cd Лабораторная работа 4 2024-04-05 11:59:35 +04:00
nikbel2004@outlook.com
aa02bd5976 Лабораторная работа 3 2024-04-05 11:46:20 +04:00
nikbel2004@outlook.com
1ab51b7b8a Лабораторная работа 2 2024-03-22 12:02:15 +04:00
nikbel2004@outlook.com
7c09322623 Лабораторная работа 1 2024-03-22 11:53:09 +04:00
18 changed files with 534 additions and 0 deletions

25
Lab6/Lab6.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab6", "Lab6\Lab6.csproj", "{89D87EF0-C674-45F3-8DEE-EDAB39D2AF21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{89D87EF0-C674-45F3-8DEE-EDAB39D2AF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89D87EF0-C674-45F3-8DEE-EDAB39D2AF21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89D87EF0-C674-45F3-8DEE-EDAB39D2AF21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89D87EF0-C674-45F3-8DEE-EDAB39D2AF21}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6933EF1A-3810-40B0-B781-FCA51C06FFD5}
EndGlobalSection
EndGlobal

9
Lab6/Lab6/App.xaml Normal file
View File

@ -0,0 +1,9 @@
<Application x:Class="Lab6.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Lab6"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
Lab6/Lab6/App.xaml.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Lab6
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
Lab6/Lab6/AssemblyInfo.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

BIN
Lab6/Lab6/Images/exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
Lab6/Lab6/Images/foto.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

BIN
Lab6/Lab6/Images/foto2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
Lab6/Lab6/Images/foto3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

31
Lab6/Lab6/Lab6.csproj Normal file
View File

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Update="Source\Forsazh.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Source\Hobbit.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Source\Kung-Fu-Panda.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Source\Piraty-Caribean.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Page>
</ItemGroup>
</Project>

180
Lab6/Lab6/MainWindow.xaml Normal file
View File

@ -0,0 +1,180 @@
<Window x:Class="Lab6.MainWindow"
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:Lab6"
mc:Ignorable="d"
Title="MainWindow" Height="640" Width="900">
<Window.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard TargetProperty="Opacity" TargetName="btnAnimation1" RepeatBehavior="Forever">
<DoubleAnimation From="1.0"
To="0.1"
Duration="0:0:2"
AutoReverse="True"/>
<DoubleAnimation From="0.1"
To="1.0"
Duration="0:0:2"
BeginTime="0:0:2"/>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard TargetProperty="Opacity" TargetName="btnAnimation2" RepeatBehavior="Forever">
<DoubleAnimation From="1.0"
To="0.1"
Duration="0:0:2"
AutoReverse="True"/>
<DoubleAnimation From="0.1"
To="1.0"
Duration="0:0:2"
BeginTime="0:0:2"/>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard TargetProperty="Opacity" TargetName="btnAnimation3" RepeatBehavior="Forever">
<DoubleAnimation From="1.0"
To="0.1"
Duration="0:0:2"
AutoReverse="True"/>
<DoubleAnimation From="0.1"
To="1.0"
Duration="0:0:2"
BeginTime="0:0:2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Window.Triggers>
<Window.Resources>
<ImageBrush x:Key="TileBrush" TileMode="Tile"
ViewportUnits="Absolute" Viewport="0 0 30 20"
ImageSource="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\exit.png" Opacity="0.3"/>
<ImageBrush x:Key="TileBrushCourse" TileMode="Tile"
ViewportUnits="Absolute" Viewport="0 0 30 20"
ImageSource="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\unnamed.jpg" Opacity="0.3"></ImageBrush>
<Style x:Key="btnPicture" TargetType="Button">
<Setter Property="Control.HorizontalAlignment" Value="Center" />
<Setter Property="TextBlock.Background" Value="#90F5DF" />
<Setter Property="TextBlock.Foreground" Value="Blue" />
<Setter Property="FontFamily" Value="Times New Roman"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Border.BorderBrush" Value="#FFA500"/>
<Setter Property="Border.BorderThickness" Value="3"/>
</Style>
<Style x:Key="buttons" TargetType="Button">
<Setter Property="FontFamily" Value="Times New Roman"/>
<Setter Property="FontSize" Value="16"/>
</Style>
<Style x:Key="Title" TargetType="Label">
<Setter Property="FontFamily" Value="Book Antiqua"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<Style x:Key="textStyle">
<Setter Property="TextBlock.FontFamily" Value="Book Antiqua"/>
<Setter Property="TextBlock.FontSize" Value="12"/>
<Setter Property="TextBlock.Foreground" Value="#191970"/>
<Setter Property="TextBlock.Margin" Value="10"/>
<Setter Property="TextBlock.MaxWidth" Value="250" />
<Setter Property="Control.VerticalAlignment" Value="Center" />
<Setter Property="Control.HorizontalAlignment" Value="Center" />
</Style>
<SolidColorBrush x:Key="OrangeBrush" Color="#FFA500" />
</Window.Resources>
<Grid x:Name="MainGrid" Background="AliceBlue">
<Grid.RowDefinitions>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="1.5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1.5*"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="#FFA500" BorderThickness="4" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3">
<StackPanel Name="ButtonPanel" Background="#5F5F5F">
<Image Source="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\unnamed.jpg" Margin="25"/>
<Button Margin="20" Foreground="Blue" BorderThickness="3" BorderBrush="{StaticResource OrangeBrush}" Background="#90F5DF" Click="Button_Click_playZvuk">
Галерея
</Button>
<Button Margin="20" Foreground="Blue" BorderBrush="{StaticResource OrangeBrush}" BorderThickness="3" Background="#90F5DF" Click="Button_Click_playSound">
Клипы
</Button>
<Button x:Name="btnAnimation1" Style="{StaticResource buttons}" Margin="5">
<Button.Content>
<Image Source="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\foto.jpg" Stretch="UniformToFill" />
</Button.Content>
</Button>
<Button x:Name="btnAnimation2" Style="{StaticResource buttons}" Margin="5">
<Button.Content>
<Image Source="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\foto2.jpg" Stretch="UniformToFill"/>
</Button.Content>
</Button>
<Button x:Name="btnAnimation3" Style="{StaticResource buttons}" Margin="5">
<Button.Content>
<Image Source="E:\2 cource\TSCHMI\Labs\Lab3\Lab3\Lab3\Images\foto3.jpg" Stretch="UniformToFill"/>
</Button.Content>
</Button>
</StackPanel>
</Border>
<Border Grid.Column="1" Grid.Row="0" BorderBrush="#FFA500" BorderThickness="0, 4, 4, 4" Grid.ColumnSpan="2" Background="#5F5F5F">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Foreground="#FFA500" Style="{StaticResource Title}">
<Bold>Видеоплеер UlPlayer</Bold>
</Label>
</WrapPanel>
</Border>
<Border Grid.Column="2" Grid.Row="1" Grid.RowSpan="2" BorderBrush="DarkOliveGreen" BorderThickness="3, 0, 0, 0">
<StackPanel>
<Label FontSize="18" Foreground="#FFA500" Style="{StaticResource textStyle}" >
<Bold>Инструменты</Bold>
</Label>
<Button Name="btn1" Style="{StaticResource buttons}" Margin="10" Click="Button_Click_AddVideo">Добавить видео</Button>
<Button Name="btn2" Style="{StaticResource buttons}" Margin="10" Click="Button_Click_DeliteVideo" >Удалить видео</Button>
<Button Name="btn3" Style="{StaticResource buttons}" Margin="10" Click="Button_Click_ChangeVideo" >Сменить видео</Button>
<Button Name="btn4" Style="{StaticResource buttons}" Margin="10" Background="{StaticResource TileBrushCourse}" Click="Button_Click_onzvuk">Включить звук</Button>
<Button Name="btn5" Style="{StaticResource buttons}" Background="{StaticResource TileBrush}" Margin="10" Click="Button_Click_offzvuk">Выключить звук</Button>
<Button Name="btn6" Margin="15" Foreground="Blue" BorderBrush="#FFA500" BorderThickness="3" Background="#90F5DF" Click="Button_Click_Play">Запуск</Button>
<Button Name="btn7" Margin="15" Foreground="Blue" BorderBrush="#FFA500" BorderThickness="3" Background="#90F5DF" Click="Button_Click_Pause">Стоп</Button>
<Button Margin="10" Style="{StaticResource btnPicture}" Click="Button_Click_UnShowButtons">Спрятать интерфейс</Button>
<Button Margin="10" Style="{StaticResource btnPicture}" Click=" Button_Click_ShowButtons">Показать интерфейс</Button>
</StackPanel>
</Border>
<ListBox x:Name="videoListBox" Grid.Column="2" Grid.Row="2" SelectionChanged="videoListBox_SelectionChanged" Visibility="Collapsed">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<MediaElement x:Name="media" Source="Source/Kung-Fu-Panda.mp4" Grid.Row="1" Grid.Column="1" LoadedBehavior="Manual" Margin="10"/>
<Rectangle Stroke="Black" StrokeThickness="3" Margin="10" Grid.Column="1" Grid.Row="1" MaxHeight="250"/>
<Slider Name="vol" ValueChanged="vol_ValueChanged" Grid.Column="1" Grid.Row="2" Maximum="1" Value="0.5" LargeChange="0.1" SmallChange="0.01" Margin="10" VerticalAlignment="Center"/>
</Grid>
</Window>

View File

@ -0,0 +1,262 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Lab6
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
videoListBox.ItemsSource = videos;
}
private void Button_Click_onzvuk(object sender, RoutedEventArgs e)
{
MessageBox.Show("Кнопка находится в разработке", "Не тыкай");
}
private void Button_Click_offzvuk(object sender, RoutedEventArgs e)
{
MessageBox.Show("Кнопка не работает. Оформите платную подписку", "Мышку сломаешь...");
}
private void Button_Click_playZvuk(object sender, RoutedEventArgs e)
{
MediaPlayer player = new MediaPlayer();
player.Open(new Uri("E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\zv2.wav"));
player.Play();
}
private void Button_Click_playSound(object sender, RoutedEventArgs e)
{
MediaPlayer player = new MediaPlayer();
player.Open(new Uri("E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\zvuk1.mp3"));
player.Play();
}
bool ButtonVideoAdd = true;
bool VideoAdd = false;
int CountLogo = 1;
string password = "";
bool ChangeVid = false;
bool Animate = false;
private void Button_Click_ShowButtons(object sender, RoutedEventArgs e)
{
DoubleAnimation animation = new DoubleAnimation();
animation.From = 0;
animation.To = 1;
animation.Duration = TimeSpan.FromSeconds(0.5);
if (!ButtonVideoAdd)
{
btn1.BeginAnimation(Button.OpacityProperty, animation);
btn1.Visibility = Visibility.Visible;
btn2.BeginAnimation(Button.OpacityProperty, animation);
btn2.Visibility = Visibility.Visible;
btn3.BeginAnimation(Button.OpacityProperty, animation);
btn3.Visibility = Visibility.Visible;
btn4.BeginAnimation(Button.OpacityProperty, animation);
btn4.Visibility = Visibility.Visible;
btn5.BeginAnimation(Button.OpacityProperty, animation);
btn5.Visibility = Visibility.Visible;
btn6.BeginAnimation(Button.OpacityProperty, animation);
btn6.Visibility = Visibility.Visible;
btn7.BeginAnimation(Button.OpacityProperty, animation);
btn7.Visibility = Visibility.Visible;
btn1.Cursor = Cursors.Hand;
btn2.Cursor = Cursors.Hand;
btn3.Cursor = Cursors.Hand;
btn4.Cursor = Cursors.Hand;
btn5.Cursor = Cursors.Hand;
btn6.Cursor = Cursors.Hand;
btn7.Cursor = Cursors.Hand;
ButtonVideoAdd = true;
}
password += "1";
}
private void Button_Click_UnShowButtons(object sender, RoutedEventArgs e)
{
DoubleAnimation animation = new DoubleAnimation();
animation.From = 1;
animation.To = 0;
animation.Duration = TimeSpan.FromSeconds(0.5);
if (ButtonVideoAdd)
{
btn1.BeginAnimation(Button.OpacityProperty, animation);
btn2.BeginAnimation(Button.OpacityProperty, animation);
btn3.BeginAnimation(Button.OpacityProperty, animation);
btn4.BeginAnimation(Button.OpacityProperty, animation);
btn5.BeginAnimation(Button.OpacityProperty, animation);
btn6.BeginAnimation(Button.OpacityProperty, animation);
btn7.BeginAnimation(Button.OpacityProperty, animation);
videoListBox.Visibility = Visibility.Hidden;
btn1.Cursor = Cursors.Arrow;
btn2.Cursor = Cursors.Arrow;
btn3.Cursor = Cursors.Arrow;
btn4.Cursor = Cursors.Arrow;
btn5.Cursor = Cursors.Arrow;
btn6.Cursor = Cursors.Arrow;
btn7.Cursor = Cursors.Arrow;
videoListBox.Cursor = Cursors.Arrow;
ButtonVideoAdd = false;
}
password += "2";
}
private void Button_Click_Play(object sender, RoutedEventArgs e)
{
if (VideoAdd && ButtonVideoAdd)
{
media.Play();
}
}
private void Button_Click_Pause(object sender, RoutedEventArgs e)
{
if (VideoAdd && ButtonVideoAdd)
{
media.Pause();
}
}
private void vol_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
media.Volume = (double)vol.Value;
}
private void Button_Click_AddVideo(object sender, RoutedEventArgs e)
{
if (ButtonVideoAdd)
{
if (!VideoAdd)
{
media.Play();
media.Visibility = Visibility.Visible;
VideoAdd = true;
}
else
{
media.Visibility = Visibility.Visible;
}
}
}
private void Button_Click_DeliteVideo(object sender, RoutedEventArgs e)
{
if (VideoAdd && ButtonVideoAdd)
{
media.Pause();
media.Visibility = Visibility.Hidden;
media.Position = TimeSpan.Zero;
VideoAdd = false;
videoListBox.Visibility = Visibility.Hidden;
}
}
private List<Video> videos = new List<Video>
{
new Video { Path = "E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\Kung-Fu-Panda.mp4", Name = "Видео 1" },
new Video { Path = "E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\Hobbit.mp4", Name = "Видео 2" },
new Video { Path = "E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\Piraty-Caribean.mp4", Name = "Видео 3" },
new Video { Path = "E:\\2 cource\\TSCHMI\\Labs\\Lab3\\Lab3\\Lab3\\Source\\Forsazh.mp4", Name = "Видео 4" }
};
private void videoListBox_SelectionChanged(object sender, RoutedEventArgs e)
{
Video selectedVideo = videoListBox.SelectedItem as Video;
if (selectedVideo != null)
{
media.Source = new System.Uri(selectedVideo.Path, UriKind.RelativeOrAbsolute);
media.Play();
}
}
private void Button_Click_ChangeVideo(object sender, RoutedEventArgs e)
{
if (VideoAdd && ButtonVideoAdd)
{
if (!ChangeVid)
{
videoListBox.Visibility = Visibility.Visible;
ChangeVid = true;
}
else
{
videoListBox.Visibility = Visibility.Collapsed;
ChangeVid = false;
}
}
}
public class Video : INotifyPropertyChanged
{
private string _path;
public string Path
{
get { return _path; }
set
{
_path = value;
NotifyPropertyChanged();
}
}
private string _name;
public string Name
{
get { return _name; }
set
{
_name = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

Binary file not shown.

BIN
Lab6/Lab6/Source/Hobbit.mp4 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Lab6/Lab6/Source/zv2.wav Normal file

Binary file not shown.

BIN
Lab6/Lab6/Source/zvuk1.mp3 Normal file

Binary file not shown.