diff --git a/FunctionWindow.axaml b/FunctionWindow.axaml
index 2243393..40d50cb 100644
--- a/FunctionWindow.axaml
+++ b/FunctionWindow.axaml
@@ -22,6 +22,9 @@
+
+
+
diff --git a/FunctionWindow.axaml.cs b/FunctionWindow.axaml.cs
index f76f11d..837d48e 100644
--- a/FunctionWindow.axaml.cs
+++ b/FunctionWindow.axaml.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
@@ -11,6 +12,12 @@ namespace demo_hard;
public partial class FunctionWindow : Window
{
+ private readonly TimeSpan sessionDuration = TimeSpan.FromMinutes(10);
+ private readonly TimeSpan warningTime = TimeSpan.FromMinutes(5);
+ //private readonly TimeSpan lockoutDuration = TimeSpan.FromMinutes(1);
+
+ private DateTime sessionStartTime;
+ private bool warningShow = false;
public FunctionWindow(Employee user)
{
InitializeComponent();
@@ -23,16 +30,46 @@ public partial class FunctionWindow : Window
RoleId = user.RoleId,
EmployePhoto = user.EmployePhoto
};
+ sessionStartTime = DateTime.Now;
+ StartSessionTimer();
+
}
-
-
public FunctionWindow()
{
InitializeComponent();
}
+ private async void StartSessionTimer()
+ {
+ while (true)
+ {
+ TimeSpan elapsedTime = DateTime.Now - sessionStartTime;
+ TimeSpan remainingTime = sessionDuration - elapsedTime;
+
+ this.FindControl("SessionTimer").Text = $"Осталось: {remainingTime.Minutes}:{remainingTime.Seconds}";
+ if (!warningShow && remainingTime <= warningTime)
+ {
+ warningShow = true;
+ WarningBlock.Text = "Внимание! Ваш сеанс закончится через 5 минут!";
+ }
+
+ if (remainingTime <= TimeSpan.Zero)
+ {
+ EndSession();
+ break;
+ }
+
+ await Task.Delay(1000);
+ }
+ }
+
+ private async void EndSession()
+ {
+ this.Close();
+ }
+
private void Back_Button(object? sender, RoutedEventArgs e)
{
new MainWindow().ShowDialog(this);
@@ -63,4 +100,9 @@ public partial class FunctionWindow : Window
}
}
}
+
+ private void History_Button(object? sender, RoutedEventArgs e)
+ {
+ new HistoryWindow().ShowDialog(this);
+ }
}
\ No newline at end of file
diff --git a/HistoryWindow.axaml b/HistoryWindow.axaml
new file mode 100644
index 0000000..42515a7
--- /dev/null
+++ b/HistoryWindow.axaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HistoryWindow.axaml.cs b/HistoryWindow.axaml.cs
new file mode 100644
index 0000000..9581baf
--- /dev/null
+++ b/HistoryWindow.axaml.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using demo_hard.Model;
+using Tmds.DBus.Protocol;
+
+namespace demo_hard;
+
+public partial class HistoryWindow : Window
+{
+ public HistoryWindow()
+ {
+ InitializeComponent();
+ LoadInfo();
+ }
+
+ private void LoadInfo()
+ {
+ using var context = new User2Context();
+ LastEnterBox.ItemsSource = context.LastEnters.ToList();
+ }
+ }
\ No newline at end of file
diff --git a/bin/Debug/net8.0/demo_hard.dll b/bin/Debug/net8.0/demo_hard.dll
index c01fece..5d1bfa3 100644
Binary files a/bin/Debug/net8.0/demo_hard.dll and b/bin/Debug/net8.0/demo_hard.dll differ
diff --git a/bin/Debug/net8.0/demo_hard.exe b/bin/Debug/net8.0/demo_hard.exe
index 78038df..02bafbb 100644
Binary files a/bin/Debug/net8.0/demo_hard.exe and b/bin/Debug/net8.0/demo_hard.exe differ
diff --git a/bin/Debug/net8.0/demo_hard.pdb b/bin/Debug/net8.0/demo_hard.pdb
index 0db7c9e..a1ed085 100644
Binary files a/bin/Debug/net8.0/demo_hard.pdb and b/bin/Debug/net8.0/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/Avalonia/Resources.Inputs.cache b/obj/Debug/net8.0/Avalonia/Resources.Inputs.cache
index 71dbceb..08cb4c1 100644
--- a/obj/Debug/net8.0/Avalonia/Resources.Inputs.cache
+++ b/obj/Debug/net8.0/Avalonia/Resources.Inputs.cache
@@ -1 +1 @@
-e6051517762c73d0b60e393e672af03d7de4691d3b1385d70c76d6bcb0e8114b
+1bb4aad2af4080c40f10bd47fb00ff5ae4a956da4d13f762d92fb2f830c6f5bb
diff --git a/obj/Debug/net8.0/Avalonia/demo_hard.dll b/obj/Debug/net8.0/Avalonia/demo_hard.dll
index c01fece..5d1bfa3 100644
Binary files a/obj/Debug/net8.0/Avalonia/demo_hard.dll and b/obj/Debug/net8.0/Avalonia/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/Avalonia/demo_hard.pdb b/obj/Debug/net8.0/Avalonia/demo_hard.pdb
index 0db7c9e..a1ed085 100644
Binary files a/obj/Debug/net8.0/Avalonia/demo_hard.pdb and b/obj/Debug/net8.0/Avalonia/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/Avalonia/resources b/obj/Debug/net8.0/Avalonia/resources
index 3a8137b..e3f6e5e 100644
Binary files a/obj/Debug/net8.0/Avalonia/resources and b/obj/Debug/net8.0/Avalonia/resources differ
diff --git a/obj/Debug/net8.0/apphost.exe b/obj/Debug/net8.0/apphost.exe
index 78038df..02bafbb 100644
Binary files a/obj/Debug/net8.0/apphost.exe and b/obj/Debug/net8.0/apphost.exe differ
diff --git a/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs b/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
index 52d051e..bc3d9af 100644
--- a/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
+++ b/obj/Debug/net8.0/demo_hard.AssemblyInfo.cs
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+35948e2f7930d51d02ff270c1b9716997a137f13")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+76087f367db98dd96eb5d00b84f1cbdda7da181d")]
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache b/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
index d67c09f..84b83e0 100644
--- a/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
+++ b/obj/Debug/net8.0/demo_hard.AssemblyInfoInputs.cache
@@ -1 +1 @@
-4dfcac57e00f99bed249a768354c782e7687e32487b7c7b52914c8db973043c4
+5b2767f893e7da3e6840a62cc19d1789e0f7f6add39e0be46f0182d0771bb4f5
diff --git a/obj/Debug/net8.0/demo_hard.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net8.0/demo_hard.GeneratedMSBuildEditorConfig.editorconfig
index f8862f3..bb41307 100644
--- a/obj/Debug/net8.0/demo_hard.GeneratedMSBuildEditorConfig.editorconfig
+++ b/obj/Debug/net8.0/demo_hard.GeneratedMSBuildEditorConfig.editorconfig
@@ -28,6 +28,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
[C:/Users/IVAN/RiderProjects/demo_hard/FunctionWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
+[C:/Users/IVAN/RiderProjects/demo_hard/HistoryWindow.axaml]
+build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
+
[C:/Users/IVAN/RiderProjects/demo_hard/MainWindow.axaml]
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
diff --git a/obj/Debug/net8.0/demo_hard.csproj.CoreCompileInputs.cache b/obj/Debug/net8.0/demo_hard.csproj.CoreCompileInputs.cache
index c32abbd..c83eec7 100644
--- a/obj/Debug/net8.0/demo_hard.csproj.CoreCompileInputs.cache
+++ b/obj/Debug/net8.0/demo_hard.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-41cd13734ade819c8046d18d1904e155c2283d2ce9e11fdaa55f2bcefa4338d7
+aee666d28c43098d7df81700364862e84dbc7372e568978b94bb010969a56d0c
diff --git a/obj/Debug/net8.0/demo_hard.dll b/obj/Debug/net8.0/demo_hard.dll
index d46f4e5..e2f7bc2 100644
Binary files a/obj/Debug/net8.0/demo_hard.dll and b/obj/Debug/net8.0/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/demo_hard.pdb b/obj/Debug/net8.0/demo_hard.pdb
index 02f277f..f3c47d7 100644
Binary files a/obj/Debug/net8.0/demo_hard.pdb and b/obj/Debug/net8.0/demo_hard.pdb differ
diff --git a/obj/Debug/net8.0/ref/demo_hard.dll b/obj/Debug/net8.0/ref/demo_hard.dll
index 7d267a5..0c05a3b 100644
Binary files a/obj/Debug/net8.0/ref/demo_hard.dll and b/obj/Debug/net8.0/ref/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll b/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll
index 7d267a5..0c05a3b 100644
Binary files a/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll and b/obj/Debug/net8.0/refint/Avalonia/demo_hard.dll differ
diff --git a/obj/Debug/net8.0/refint/demo_hard.dll b/obj/Debug/net8.0/refint/demo_hard.dll
index 78e00d3..963ca67 100644
Binary files a/obj/Debug/net8.0/refint/demo_hard.dll and b/obj/Debug/net8.0/refint/demo_hard.dll differ