
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BodyshopPartner.ViewModels
{
    public partial class LoginViewModel : BaseViewModel
    {
        private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

        public LoginViewModel()
        {
            logger.Trace("Login VM Created.");
        }

        private async Task LoginAsync(Window W)
        {
            Loading = true;

            Utils.LoginHelpers.SaveLoginSettings(UserName, UserPassword);

            logger.Trace("Attempting to login as user: {0}", UserName);
            (Error, ErrorMsg) = await Utils.Auth.LoginAsync(UserName, Utils.LoginHelpers.DecodePassword(UserPassword));
            if(ErrorMsg ==null)
            {
                Views.Main m = new Views.Main();
                m.Show();
                W.Hide();
            }
            Loading = false;
        }
    }
}
