using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Threading;
using SPC.Kiosk.Base;
using SPC.Kiosk.Common;
using SPC.Kiosk.Popup.Model;
namespace SPC.Kiosk.Popup.ViewModel
{
    /// <summary>
    /// CallEmployee.xaml 의 ViewModel
    /// </summary>
    public class VmStepInfoPopup : PopupViewModelBase
    {
        #region [ Members ]

        public string StepIamge { get; set; } = ResourceManager.GetNximagePathAdd("step.gif", CommonValue.PBdesignImagesPath);

        private List<M_Language> okButtonText;
        /// <summary>
        /// OK Button Text
        /// </summary>
        public List<M_Language> OkButtonText
        {
            get { return okButtonText; }
            set { okButtonText = value; PropertyChange("OkButtonText"); }
        }
        private double okButtonWidth = 800d;
        /// <summary>
        /// OK Button Width
        /// </summary>
        public double OkButtonWidth
        {
            get { return okButtonWidth; }
            set { okButtonWidth = value; PropertyChange("OkButtonWidth"); }
        }
        /// <summary>
        /// OK Click Command
        /// </summary>
        public ICommand OkCommand { get; protected set; }

        #endregion Members

        #region [ Ctor ]
        /// <summary>
        /// Ctor
        /// </summary>
        public VmStepInfoPopup()
        {
            OkCommand = new Command(OkCommandHandler);
            this.PropertyChanged += VmStepInfoPopup_PropertyChanged;
            OkButtonText = Languages.GetMessages("BTN0039");
            TimeOutSeconds = 10d;
        }
        ~VmStepInfoPopup()
        {
            this.PropertyChanged -= VmStepInfoPopup_PropertyChanged;
        }
        #endregion Ctor

        #region [ Methods ]
        #endregion Methods

        #region [ Event Handlers ]

        private void OkCommandHandler(object obj)
        {
            TimerEnabled = false;
            
            ReturnValue = new M_PopupReturn
            {
                OKAnswer = true,
                TimeOut = false,
                ReturnLanguage = ShowLanguageType,
                PopupArgs = null
            };
            CanWindowClose = true;                
            
        }

        private void VmStepInfoPopup_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "IsTimeout":
                    if (IsTimeout)
                    {
                        ReturnValue = new M_PopupReturn
                        {
                            OKAnswer = false,
                            TimeOut = true,
                            ReturnLanguage = ShowLanguageType,
                            PopupArgs = null
                        };
                        CanWindowClose = true;
                    }
                    break;
            }
        }


        #endregion Event Handlers
    }
}