Compare commits

..

3 Commits
main ... lab3

17 changed files with 333 additions and 0 deletions

9
lab1/App.xaml Normal file
View File

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

17
lab1/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 lab1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
lab1/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)
)]

19
lab1/MainWindow.xaml Normal file
View File

@ -0,0 +1,19 @@
<Window x:Class="lab1.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:lab1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid Background="#FF8DECC3" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
</Grid>
</Window>

28
lab1/MainWindow.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.Navigation;
using System.Windows.Shapes;
namespace lab1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

10
lab1/lab1.csproj Normal file
View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

37
lab1/lab1.sln Normal file
View File

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "lab1", "lab1.csproj", "{C8A39C3C-7425-4F13-9FF8-4D3C60C43EA1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab2", "..\lab2\lab2.csproj", "{9A7D0454-F395-4D93-B77D-16844927C120}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab3", "..\lab3\lab3.csproj", "{E7CA4407-9AFA-4279-AB13-4E8F985FB476}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8A39C3C-7425-4F13-9FF8-4D3C60C43EA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8A39C3C-7425-4F13-9FF8-4D3C60C43EA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8A39C3C-7425-4F13-9FF8-4D3C60C43EA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8A39C3C-7425-4F13-9FF8-4D3C60C43EA1}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7D0454-F395-4D93-B77D-16844927C120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7D0454-F395-4D93-B77D-16844927C120}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A7D0454-F395-4D93-B77D-16844927C120}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A7D0454-F395-4D93-B77D-16844927C120}.Release|Any CPU.Build.0 = Release|Any CPU
{E7CA4407-9AFA-4279-AB13-4E8F985FB476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7CA4407-9AFA-4279-AB13-4E8F985FB476}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7CA4407-9AFA-4279-AB13-4E8F985FB476}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7CA4407-9AFA-4279-AB13-4E8F985FB476}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E32885F0-D079-4EFB-A303-F772523CC981}
EndGlobalSection
EndGlobal

22
lab3/App.xaml Normal file
View File

@ -0,0 +1,22 @@
<Application x:Class="lab3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:lab3"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!-- Определение стиля для кнопок -->
<SolidColorBrush x:Key="ButtonBackgroundBrush" Color="#FF8DECC3"/>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Margin" Value="5"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Background" Value="{StaticResource ButtonBackgroundBrush}"/>
</Style>
<!-- Определение стиля для текста -->
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Bahnschrift"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</Application.Resources>
</Application>

17
lab3/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 lab3
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
lab3/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)
)]

60
lab3/MainWindow.xaml Normal file
View File

@ -0,0 +1,60 @@
<Window x:Class="lab3.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:lab3"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid Background="#FF8DECC3">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Black" BorderThickness="4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="1">
<Image Source="/free-icon-clover-6365303.png"/>
</Border>
<Border BorderBrush="Black" BorderThickness="4" Grid.Column="2" Grid.Row="1" Grid.RowSpan="1">
<StackPanel Margin="0,20,0,0">
<Button Click="LoadVideoButton_Click">
<TextBlock>Выбрать видео</TextBlock>
</Button>
<Button Click="StartButton_Click">
<TextBlock>Пуск</TextBlock>
</Button>
<Button Click="PauseButton_Click">
<TextBlock>Пауза</TextBlock>
</Button>
<Button>
<TextBlock>Вкл. звук</TextBlock>
</Button>
<Button>
<TextBlock>Выкл. звук</TextBlock>
</Button>
<Button>
<TextBlock>Рестарт</TextBlock>
</Button>
<Button>
<TextBlock>Очистить</TextBlock>
</Button>
<Canvas Height="100"/>
</StackPanel>
</Border>
<Border BorderBrush="Black" BorderThickness="4" Grid.Column="0" Grid.Row="0" Grid.RowSpan="1" Grid.ColumnSpan="2">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" FontSize="18" FontFamily="Bahnschrift" VerticalAlignment="Center">Лютий видеохостинг</TextBlock>
</Border>
<Border BorderBrush="Black" BorderThickness="4" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Grid.ColumnSpan="2">
</Border>
<Grid x:Name="videoPanel" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Grid.ColumnSpan="1">
<!-- Сюда будет загружено видео -->
</Grid>
</Grid>
</Window>

70
lab3/MainWindow.xaml.cs Normal file
View File

@ -0,0 +1,70 @@
using Microsoft.Win32;
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 lab3
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void LoadVideoButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Видео файлы|*.mp4;*.avi;*.wmv;*.mov|Все файлы|*.*";
if (openFileDialog.ShowDialog() == true)
{
// Очистить панель, если она уже содержит видео
videoPanel.Children.Clear();
// Создать элемент MediaElement для воспроизведения видео
MediaElement mediaElement = new MediaElement();
mediaElement.Source = new Uri(openFileDialog.FileName);
// Добавить элемент MediaElement на панель
videoPanel.Children.Add(mediaElement);
}
}
private void StartButton_Click(object sender, RoutedEventArgs e)
{
// Проверяем, есть ли на панели MediaElement
MediaElement mediaElement = videoPanel.Children.OfType<MediaElement>().FirstOrDefault();
// Если MediaElement найден, начинаем воспроизведение видео
if (mediaElement != null)
{
mediaElement.Play();
}
}
private void PauseButton_Click(object sender, RoutedEventArgs e)
{
// Проверяем, есть ли на панели MediaElement
MediaElement mediaElement = videoPanel.Children.OfType<MediaElement>().FirstOrDefault();
// Если MediaElement найден, начинаем воспроизведение видео
if (mediaElement != null)
{
mediaElement.Stop();
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

18
lab3/lab3.csproj Normal file
View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="free-icon-clover-6365303.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="free-icon-clover-6365303.png" />
</ItemGroup>
</Project>

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mainProj", "mainProj.csproj", "{48B3D376-4769-4AF7-9E09-AA8DDC32F2B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "lab1", "..\lab1\lab1.csproj", "{838E02DE-3333-4FA4-A6FB-744DCD3B5533}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{48B3D376-4769-4AF7-9E09-AA8DDC32F2B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48B3D376-4769-4AF7-9E09-AA8DDC32F2B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48B3D376-4769-4AF7-9E09-AA8DDC32F2B0}.Release|Any CPU.Build.0 = Release|Any CPU
{838E02DE-3333-4FA4-A6FB-744DCD3B5533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{838E02DE-3333-4FA4-A6FB-744DCD3B5533}.Debug|Any CPU.Build.0 = Debug|Any CPU
{838E02DE-3333-4FA4-A6FB-744DCD3B5533}.Release|Any CPU.ActiveCfg = Release|Any CPU
{838E02DE-3333-4FA4-A6FB-744DCD3B5533}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE