diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln
index 73306e5..80a1a06 100644
--- a/PacticeSolution/PacticeSolution.sln
+++ b/PacticeSolution/PacticeSolution.sln
@@ -129,6 +129,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaPlayer", "MediaPlayer\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speech", "Speech\Speech.csproj", "{248DDC0C-F8C0-4687-BBC2-71C7C310537E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimerAndWorker", "TimerAndWorker\TimerAndWorker.csproj", "{6210631F-C8DF-45DC-B53E-3119E8BDFF9E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TreeViewSample", "TreeViewSample\TreeViewSample.csproj", "{CA88EE83-8C7F-4FEF-963A-DEACA5E502FB}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -387,6 +391,14 @@ Global
{248DDC0C-F8C0-4687-BBC2-71C7C310537E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{248DDC0C-F8C0-4687-BBC2-71C7C310537E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{248DDC0C-F8C0-4687-BBC2-71C7C310537E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6210631F-C8DF-45DC-B53E-3119E8BDFF9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6210631F-C8DF-45DC-B53E-3119E8BDFF9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6210631F-C8DF-45DC-B53E-3119E8BDFF9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6210631F-C8DF-45DC-B53E-3119E8BDFF9E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CA88EE83-8C7F-4FEF-963A-DEACA5E502FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CA88EE83-8C7F-4FEF-963A-DEACA5E502FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CA88EE83-8C7F-4FEF-963A-DEACA5E502FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CA88EE83-8C7F-4FEF-963A-DEACA5E502FB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PacticeSolution/TimerAndWorker/App.xaml b/PacticeSolution/TimerAndWorker/App.xaml
new file mode 100644
index 0000000..8a0ae1e
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/TimerAndWorker/App.xaml.cs b/PacticeSolution/TimerAndWorker/App.xaml.cs
new file mode 100644
index 0000000..adee813
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/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 TimerAndWorker
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/TimerAndWorker/AssemblyInfo.cs b/PacticeSolution/TimerAndWorker/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/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/TimerAndWorker/MainWindow.xaml b/PacticeSolution/TimerAndWorker/MainWindow.xaml
new file mode 100644
index 0000000..5388cd0
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/MainWindow.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/TimerAndWorker/MainWindow.xaml.cs b/PacticeSolution/TimerAndWorker/MainWindow.xaml.cs
new file mode 100644
index 0000000..d9f8154
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/MainWindow.xaml.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading;
+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 TimerAndWorker
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ private readonly int RECURSIVE_COUNT = 10000;
+
+ private DispatcherTimer _timer;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ InitInstance();
+ }
+
+ private void InitInstance()
+ {
+ _timer = new DispatcherTimer();
+ _timer.Interval = TimeSpan.FromMilliseconds(1);
+ _timer.Tick += _timer_Tick;
+ _timer.Start();
+ }
+
+ private void _timer_Tick(object? sender, EventArgs e)
+ {
+ lblTime.Content = DateTime.Now.ToString("HH:mm:ss.fff");
+ }
+
+ private void btnSyncCalc_Click(object sender, RoutedEventArgs e)
+ {
+ pbCalcProcess.Value = 0;
+ lbResult.Items.Clear();
+
+ int result = 0;
+ for (int i = 0; i < RECURSIVE_COUNT; i++)
+ {
+ if (i % 7 == 0)
+ {
+ lbResult.Items.Add(i);
+ lbResult.SelectedIndex = lbResult.Items.Count - 1;
+ lbResult.ScrollIntoView(lbResult.SelectedItem);
+ result++;
+ }
+
+ Thread.Sleep(1);
+ pbCalcProcess.Value = Convert.ToInt32((double)i / RECURSIVE_COUNT * 100);
+ }
+
+ MessageBox.Show($"Numbers between 0 and {RECURSIVE_COUNT} divisable by 7: {result}");
+ }
+
+ private void btnAsyncCalc_Click(object sender, RoutedEventArgs e)
+ {
+ pbCalcProcess.Value = 0;
+ lbResult.Items.Clear();
+
+ BackgroundWorker worker = new BackgroundWorker();
+ worker.WorkerReportsProgress = true;
+ worker.DoWork += Worker_DoWork;
+ worker.ProgressChanged += Worker_ProgressChanged;
+ worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
+ worker.RunWorkerAsync(RECURSIVE_COUNT);
+ }
+
+ private void Worker_RunWorkerCompleted(object? sender, RunWorkerCompletedEventArgs e)
+ {
+ MessageBox.Show($"Numbers between 0 and {RECURSIVE_COUNT} divisable by 7: {e.Result}");
+ }
+
+ private void Worker_ProgressChanged(object? sender, ProgressChangedEventArgs e)
+ {
+ pbCalcProcess.Value = e.ProgressPercentage;
+ if (e.UserState != null)
+ {
+ lbResult.Items.Add(e.UserState);
+ lbResult.SelectedIndex = lbResult.Items.Count - 1;
+ lbResult.ScrollIntoView(lbResult.SelectedItem);
+ }
+ }
+
+ private void Worker_DoWork(object? sender, DoWorkEventArgs e)
+ {
+ int max = (int)e.Argument;
+ int result = 0;
+ for (int i = 0; i < max; i++)
+ {
+ int progressPercentage = Convert.ToInt32((double)i / RECURSIVE_COUNT * 100);
+ if (i % 7 == 0)
+ {
+ result++;
+ (sender as BackgroundWorker)?.ReportProgress(progressPercentage, i);
+ }
+ else
+ (sender as BackgroundWorker)?.ReportProgress(progressPercentage);
+
+ Thread.Sleep(1);
+ }
+
+ e.Result = result;
+ }
+ }
+}
diff --git a/PacticeSolution/TimerAndWorker/TimerAndWorker.csproj b/PacticeSolution/TimerAndWorker/TimerAndWorker.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/TimerAndWorker/TimerAndWorker.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/PacticeSolution/TreeViewSample/App.xaml b/PacticeSolution/TreeViewSample/App.xaml
new file mode 100644
index 0000000..f1187ae
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/TreeViewSample/App.xaml.cs b/PacticeSolution/TreeViewSample/App.xaml.cs
new file mode 100644
index 0000000..529c80f
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/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 TreeViewSample
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/TreeViewSample/AssemblyInfo.cs b/PacticeSolution/TreeViewSample/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/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/TreeViewSample/MainWindow.xaml b/PacticeSolution/TreeViewSample/MainWindow.xaml
new file mode 100644
index 0000000..4bc7e94
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/MainWindow.xaml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/TreeViewSample/MainWindow.xaml.cs b/PacticeSolution/TreeViewSample/MainWindow.xaml.cs
new file mode 100644
index 0000000..296f152
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/MainWindow.xaml.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+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 TreeViewSample
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ InitInstance();
+ }
+
+ private void InitInstance()
+ {
+ DriveInfo[] drives = DriveInfo.GetDrives();
+ foreach (DriveInfo drive in drives)
+ {
+ trvStructure.Items.Add(CreateTreeItem(drive));
+ }
+ }
+
+ private TreeViewItem CreateTreeItem(object obj)
+ {
+ TreeViewItem item = new TreeViewItem();
+ item.Header = obj.ToString();
+ item.Tag = obj;
+ item.Items.Add("Loading...");
+ return item;
+ }
+
+ private void trvStructure_Expanded(object sender, RoutedEventArgs e)
+ {
+ TreeViewItem item = e.Source as TreeViewItem;
+ if (item.Items.Count != 1 || !(item.Items[0] is string))
+ return;
+
+ item.Items.Clear();
+ DirectoryInfo expandedDir = null;
+ if (item.Tag is DriveInfo)
+ expandedDir = (item.Tag as DriveInfo).RootDirectory;
+ if (item.Tag is DirectoryInfo)
+ expandedDir = (item.Tag as DirectoryInfo);
+
+ try
+ {
+ foreach (DirectoryInfo subDir in expandedDir.GetDirectories())
+ item.Items.Add(CreateTreeItem(subDir));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+ }
+}
diff --git a/PacticeSolution/TreeViewSample/TreeViewSample.csproj b/PacticeSolution/TreeViewSample/TreeViewSample.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/TreeViewSample/TreeViewSample.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+