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 static System.Net.Mime.MediaTypeNames;

namespace DontHarmDesktop.Pages
{
    /// <summary>
    /// Логика взаимодействия для UserInfoPage.xaml
    /// </summary>
    public partial class UserInfoPage : Page
    {
        private string UserImagePath;
        public UserInfoPage()
        {
            InitializeComponent();
            DataContext = this;

            Models.users current_user = App.CurrentUser;

            UserImagePath = current_user.image_path;

            // Получение названия роли
            Models.roles role = App.Context.roles.First(r => r.id == current_user.role);

            GreetingTextBlock.Text = $"Добро пожаловать, {current_user.surname} {current_user.name} {current_user.patronymic} ({role.name})";
            //ProfilePictureImage.Source = new BitmapImage( new Uri("pack://application:,,,/Images/ProfilePictures/" + current_user.image_path, UriKind.Absolute));
        }

        public string ProfileImagePath
        {
            get
            {
                return "/Images/ProfilePictures/" + UserImagePath;
            }
        }
    }
}
