demo_hard/FunctionWindow.axaml.cs

66 lines
1.5 KiB
C#
Raw Normal View History

2025-02-05 10:07:55 +00:00
using System;
using System.IO;
2025-02-04 12:27:32 +00:00
using Avalonia;
using Avalonia.Controls;
2025-02-05 10:07:55 +00:00
using Avalonia.Interactivity;
2025-02-04 12:27:32 +00:00
using Avalonia.Markup.Xaml;
2025-02-05 10:07:55 +00:00
using Avalonia.Media.Imaging;
2025-02-04 12:27:32 +00:00
using demo_hard.Models;
namespace demo_hard;
public partial class FunctionWindow : Window
{
2025-02-05 10:07:55 +00:00
public FunctionWindow(Employee user)
{
InitializeComponent();
DataContext = new ImageEmployee()
{
EmployeId = user.EmployeId,
Fio = user.Fio,
EmployeLogin = user.EmployeLogin,
EmployePassword = user.EmployePassword,
RoleId = user.RoleId,
EmployePhoto = user.EmployePhoto
};
}
2025-02-04 12:27:32 +00:00
public FunctionWindow()
{
InitializeComponent();
2025-02-05 10:07:55 +00:00
}
private void Back_Button(object? sender, RoutedEventArgs e)
{
new MainWindow().ShowDialog(this);
}
private void Next_Function_Button(object? sender, RoutedEventArgs e)
{
new SallerWindow().ShowDialog(this);
}
public class ImageEmployee: Employee
{
Bitmap? Image
{
get
{
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, EmployePhoto);
return new Bitmap(absolutePath);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
return null;
}
}
}
2025-02-04 12:27:32 +00:00
}
}