init commit
This commit is contained in:
parent
76087f367d
commit
a24d02ba9b
@ -22,6 +22,9 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Button Content="Назад" Click="Back_Button" Margin="5"/>
|
<Button Content="Назад" Click="Back_Button" Margin="5"/>
|
||||||
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"/>
|
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"/>
|
||||||
|
<Button Content="История входа" Click="History_Button" Margin="5"/>
|
||||||
|
<TextBlock x:Name="SessionTimer" FontSize="16" Foreground="Red" HorizontalAlignment="Center" Margin="10"/>
|
||||||
|
<TextBlock Text="" HorizontalAlignment="Center" Margin="10" x:Name="WarningBlock"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
@ -11,6 +12,12 @@ namespace demo_hard;
|
|||||||
|
|
||||||
public partial class FunctionWindow : Window
|
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)
|
public FunctionWindow(Employee user)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -23,16 +30,46 @@ public partial class FunctionWindow : Window
|
|||||||
RoleId = user.RoleId,
|
RoleId = user.RoleId,
|
||||||
EmployePhoto = user.EmployePhoto
|
EmployePhoto = user.EmployePhoto
|
||||||
};
|
};
|
||||||
|
sessionStartTime = DateTime.Now;
|
||||||
|
StartSessionTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FunctionWindow()
|
public FunctionWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void StartSessionTimer()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
TimeSpan elapsedTime = DateTime.Now - sessionStartTime;
|
||||||
|
TimeSpan remainingTime = sessionDuration - elapsedTime;
|
||||||
|
|
||||||
|
this.FindControl<TextBlock>("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)
|
private void Back_Button(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
new MainWindow().ShowDialog(this);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
43
HistoryWindow.axaml
Normal file
43
HistoryWindow.axaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1000"
|
||||||
|
x:Class="demo_hard.HistoryWindow"
|
||||||
|
x:CompileBindings="False"
|
||||||
|
Title="HistoryWindow">
|
||||||
|
|
||||||
|
<DockPanel>
|
||||||
|
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Orientation="Horizontal" Margin="5">
|
||||||
|
<TextBlock HorizontalAlignment="Center" Text="Окно истории входа" Margin="5"/>
|
||||||
|
<ComboBox Width="200">
|
||||||
|
|
||||||
|
</ComboBox>
|
||||||
|
<ComboBox Width="200">
|
||||||
|
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<ListBox x:Name="LastEnterBox">
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="1"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border>
|
||||||
|
<StackPanel HorizontalAlignment="Center" Spacing="5">
|
||||||
|
<TextBlock Text="{Binding Login}"/>
|
||||||
|
<TextBlock Text="{Binding EnterDatetime}"/>
|
||||||
|
<TextBlock Text="{Binding EnterType}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
|
</Window>
|
23
HistoryWindow.axaml.cs
Normal file
23
HistoryWindow.axaml.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
e6051517762c73d0b60e393e672af03d7de4691d3b1385d70c76d6bcb0e8114b
|
1bb4aad2af4080c40f10bd47fb00ff5ae4a956da4d13f762d92fb2f830c6f5bb
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
4dfcac57e00f99bed249a768354c782e7687e32487b7c7b52914c8db973043c4
|
5b2767f893e7da3e6840a62cc19d1789e0f7f6add39e0be46f0182d0771bb4f5
|
||||||
|
@ -28,6 +28,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|||||||
[C:/Users/IVAN/RiderProjects/demo_hard/FunctionWindow.axaml]
|
[C:/Users/IVAN/RiderProjects/demo_hard/FunctionWindow.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
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]
|
[C:/Users/IVAN/RiderProjects/demo_hard/MainWindow.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
41cd13734ade819c8046d18d1904e155c2283d2ce9e11fdaa55f2bcefa4338d7
|
aee666d28c43098d7df81700364862e84dbc7372e568978b94bb010969a56d0c
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user