diff --git a/PacticeSolution/MediaPlayer/App.xaml b/PacticeSolution/MediaPlayer/App.xaml
new file mode 100644
index 0000000..e7c2aac
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/MediaPlayer/App.xaml.cs b/PacticeSolution/MediaPlayer/App.xaml.cs
new file mode 100644
index 0000000..0e93379
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/App.xaml.cs
@@ -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 MediaPlayer
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/MediaPlayer/AssemblyInfo.cs b/PacticeSolution/MediaPlayer/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/AssemblyInfo.cs
@@ -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)
+)]
diff --git a/PacticeSolution/MediaPlayer/MainWindow.xaml b/PacticeSolution/MediaPlayer/MainWindow.xaml
new file mode 100644
index 0000000..e9db83d
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/MainWindow.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/MediaPlayer/MainWindow.xaml.cs b/PacticeSolution/MediaPlayer/MainWindow.xaml.cs
new file mode 100644
index 0000000..7acc378
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/MainWindow.xaml.cs
@@ -0,0 +1,122 @@
+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;
+using System.Windows.Threading;
+
+namespace MediaPlayer
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ private DispatcherTimer _playTimer;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ InitInstance();
+ }
+
+ private void InitInstance()
+ {
+ _playTimer = new DispatcherTimer();
+ _playTimer.Interval = TimeSpan.FromSeconds(1);
+ _playTimer.Tick -= TickTimer;
+ _playTimer.Tick += TickTimer;
+ _playTimer.Start();
+ }
+
+ private void mediaElem_MediaOpened(object sender, RoutedEventArgs e)
+ {
+ playSlider.Minimum = 0;
+ playSlider.Maximum = mediaElem.NaturalDuration.TimeSpan.TotalSeconds;
+ }
+
+ private void mediaElem_MediaEnded(object sender, RoutedEventArgs e)
+ {
+ mediaElem.Stop();
+ }
+
+ private void mediaElem_MediaFailed(object sender, ExceptionRoutedEventArgs e)
+ {
+ MessageBox.Show($"Play error: {e.ErrorException.Message}");
+ }
+
+ private void playSlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
+ {
+ mediaElem.Pause();
+ }
+
+ private void playSlider_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
+ {
+ mediaElem.Position = TimeSpan.FromSeconds(playSlider.Value);
+ mediaElem.Play();
+ }
+
+ private void playSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ mediaElem.Position = TimeSpan.FromSeconds(playSlider.Value);
+ }
+
+ private void playButton_Click(object sender, RoutedEventArgs e)
+ {
+ mediaElem.Play();
+ }
+
+ private void PauseButton_Click(object sender, RoutedEventArgs e)
+ {
+ mediaElem.Pause();
+ }
+
+ private void StopButton_Click(object sender, RoutedEventArgs e)
+ {
+ mediaElem.Stop();
+ }
+
+ private void volumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ mediaElem.Volume = volumeSlider.Value;
+ }
+
+ private void openButton_Click(object sender, RoutedEventArgs e)
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+ if (dlg.ShowDialog() != true)
+ return;
+
+ mediaElem.Source = new Uri(dlg.FileName);
+ mediaElem.Volume = volumeSlider.Value;
+ mediaElem.SpeedRatio = 1;
+
+ mediaElem.Play();
+ }
+
+ private void TickTimer(object? sender, EventArgs e)
+ {
+ if (mediaElem.Source == null)
+ {
+ playTimeLabel.Content = "No File";
+ return;
+ }
+
+ if (!mediaElem.NaturalDuration.HasTimeSpan)
+ return;
+
+ playSlider.Value = mediaElem.Position.TotalSeconds;
+ playTimeLabel.Content = $"{mediaElem.Position.ToString(@"hh\:mm\:ss")} / {mediaElem.NaturalDuration.TimeSpan.ToString(@"hh\:mm\:ss")}";
+ }
+ }
+}
diff --git a/PacticeSolution/MediaPlayer/MediaPlayer.csproj b/PacticeSolution/MediaPlayer/MediaPlayer.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/MediaPlayer/MediaPlayer.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln
index 7836a84..28df5d3 100644
--- a/PacticeSolution/PacticeSolution.sln
+++ b/PacticeSolution/PacticeSolution.sln
@@ -117,13 +117,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComboBoxSample", "ComboBoxS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObervableCollectionSample", "ObervableCollectionSample\ObervableCollectionSample.csproj", "{0C2F6C56-5CAB-44BB-9890-7512C944CE1D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataTemplateSample", "DataTemplateSample\DataTemplateSample.csproj", "{D6507C41-143B-45D2-9A45-F822A9E22B7E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataTemplateSample", "DataTemplateSample\DataTemplateSample.csproj", "{D6507C41-143B-45D2-9A45-F822A9E22B7E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandSample", "CommandSample\CommandSample.csproj", "{AFB4006F-917A-4358-898F-8C4DC0A1E6C8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandSample", "CommandSample\CommandSample.csproj", "{AFB4006F-917A-4358-898F-8C4DC0A1E6C8}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqInNotIn", "LinqInNotIn\LinqInNotIn.csproj", "{9261D8E1-5DEE-4329-AB32-946AD5E69C66}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinqInNotIn", "LinqInNotIn\LinqInNotIn.csproj", "{9261D8E1-5DEE-4329-AB32-946AD5E69C66}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkSample", "EntityFrameworkSample\EntityFrameworkSample.csproj", "{AAEF47BF-A410-4A4D-942B-D9A1F4AA1343}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkSample", "EntityFrameworkSample\EntityFrameworkSample.csproj", "{AAEF47BF-A410-4A4D-942B-D9A1F4AA1343}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaPlayer", "MediaPlayer\MediaPlayer.csproj", "{0E7DB4A2-B598-452B-B1B4-CF36685D0D53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -375,6 +377,10 @@ Global
{AAEF47BF-A410-4A4D-942B-D9A1F4AA1343}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAEF47BF-A410-4A4D-942B-D9A1F4AA1343}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAEF47BF-A410-4A4D-942B-D9A1F4AA1343}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0E7DB4A2-B598-452B-B1B4-CF36685D0D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0E7DB4A2-B598-452B-B1B4-CF36685D0D53}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E7DB4A2-B598-452B-B1B4-CF36685D0D53}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0E7DB4A2-B598-452B-B1B4-CF36685D0D53}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE