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;

namespace FasdDesktopUi.Basics.UserControls
{
    public partial class LoginMask : UserControl
    {
        #region Properties

        public string UserName { get; set; }
        public string Password { get; set; }

        #endregion

        public LoginMask()
        {
            InitializeComponent();
        }

        #region ShowPasswordIcon_Click

        private void ShowPasswordIcon_Click()
        {
            PasswordInputVisible.Visibility = PasswordInputVisible.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;

            PasswordInput.Visibility = PasswordInput.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;

            if (PasswordInputVisible.IsVisible)
                PasswordInputVisible.Text = PasswordInput.Password;
        }

        private void ShowPasswordIcon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ShowPasswordIcon_Click();
        }

        private void ShowPasswordIcon_TouchDown(object sender, TouchEventArgs e)
        {
            ShowPasswordIcon_Click();
        }

        #endregion

        #region DialogButton_Click

        private void DialogButton_Click(object sender)
        {
            if (!(sender is FrameworkElement FE))
                return;

            switch (FE.Tag.ToString().ToLower())
            {
                case "cancle":
                    Visibility = Visibility.Collapsed;
                    break;
                case "confirm":
                    break;

                default:
                    break;
            }
        }

        private void DialogButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DialogButton_Click(sender);
        }

        private void DialogButton_TouchDown(object sender, TouchEventArgs e)
        {
            DialogButton_Click(sender);
        }

        #endregion

    }
}
